Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #22

Merged
merged 2 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v17.0.6
rev: v18.1.1
hooks:
- id: clang-format
- repo: https://github.com/cheshirekow/cmake-format-precommit
Expand Down
13 changes: 5 additions & 8 deletions src/dbastar/dbastar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,8 @@ void from_solution_to_yaml_and_traj(dynobench::Model_robot &robot,
}
DYNO_CHECK_LEQ(take_num_actions, motion.actions.size(), AT);
if (out) {
*out << space6 + "# "
<< "take_num_actions " << take_num_actions << std::endl;
*out << space6 + "# " << "take_num_actions " << take_num_actions
<< std::endl;
}

for (size_t k = 0; k < take_num_actions; ++k) {
Expand Down Expand Up @@ -703,22 +703,19 @@ void dbastar(const dynobench::Problem &problem, Options_dbastar options_dbastar,
if (static_cast<size_t>(time_bench.expands) >=
options_dbastar.max_expands) {
status = Terminate_status::MAX_EXPANDS;
std::cout << "BREAK search:"
<< "MAX_EXPANDS" << std::endl;
std::cout << "BREAK search:" << "MAX_EXPANDS" << std::endl;
return true;
}

if (watch.elapsed_ms() > options_dbastar.search_timelimit) {
status = Terminate_status::MAX_TIME;
std::cout << "BREAK search:"
<< "MAX_TIME" << std::endl;
std::cout << "BREAK search:" << "MAX_TIME" << std::endl;
return true;
}

if (open.empty()) {
status = Terminate_status::EMPTY_QUEUE;
std::cout << "BREAK search:"
<< "EMPTY_QUEUE" << std::endl;
std::cout << "BREAK search:" << "EMPTY_QUEUE" << std::endl;
return true;
}

Expand Down
17 changes: 6 additions & 11 deletions src/dbrrt/dbrrt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -497,16 +497,14 @@ void dbrrtConnect(const dynobench::Problem &problem,
auto stop_search = [&] {
if (static_cast<size_t>(time_bench.expands) >= options_dbrrt.max_expands) {
status = Terminate_status::MAX_EXPANDS;
std::cout << "BREAK search:"
<< "MAX_EXPANDS" << std::endl;
std::cout << "BREAK search:" << "MAX_EXPANDS" << std::endl;

return true;
}

if (watch.elapsed_ms() > options_dbrrt.timelimit) {
status = Terminate_status::MAX_TIME;
std::cout << "BREAK search:"
<< "MAX_TIME" << std::endl;
std::cout << "BREAK search:" << "MAX_TIME" << std::endl;
return true;
}
return false;
Expand Down Expand Up @@ -1051,16 +1049,14 @@ void dbrrt(const dynobench::Problem &problem,
auto stop_search = [&] {
if (static_cast<size_t>(time_bench.expands) >= options_dbrrt.max_expands) {
status = Terminate_status::MAX_EXPANDS;
std::cout << "BREAK search:"
<< "MAX_EXPANDS" << std::endl;
std::cout << "BREAK search:" << "MAX_EXPANDS" << std::endl;

return true;
}

if (watch.elapsed_ms() > options_dbrrt.timelimit) {
status = Terminate_status::MAX_TIME;
std::cout << "BREAK search:"
<< "MAX_TIME" << std::endl;
std::cout << "BREAK search:" << "MAX_TIME" << std::endl;
return true;
}
return false;
Expand Down Expand Up @@ -1120,9 +1116,8 @@ void dbrrt(const dynobench::Problem &problem,
if (options_dbrrt.ao_rrt &&
near_node->gScore + near_node->hScore >
options_dbrrt.best_cost_prune_factor * cost_bound) {
std::cout << "warning! "
<< "cost of near is above bound -- " << near_node->gScore << " "
<< cost_bound << std::endl;
std::cout << "warning! " << "cost of near is above bound -- "
<< near_node->gScore << " " << cost_bound << std::endl;
continue;
}

Expand Down
4 changes: 2 additions & 2 deletions src/idbastar/idbastar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,8 @@ void idbA(const dynobench::Problem &problem,
std::make_move_iterator(motions_out.end()));

std::cout << "Afer insert " << motions.size() << std::endl;
std::cout << "Warning: "
<< "I am inserting at the beginning" << std::endl;
std::cout << "Warning: " << "I am inserting at the beginning"
<< std::endl;

std::cout << "i update the idx of the motions " << std::endl;
// Very important to update the idx of the motions
Expand Down
3 changes: 1 addition & 2 deletions src/motion_primitives/main_primitives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,7 @@ int main(int argc, const char *argv[]) {
}
CSTR_(trajectories.data.size());
trajectories.compute_stats(out_file.c_str());
std::cout << "writing stats to "
<< "/tmp/tmp_stats.yaml" << std::endl;
std::cout << "writing stats to " << "/tmp/tmp_stats.yaml" << std::endl;
std::filesystem::copy(out_file, "/tmp/tmp_stats.yaml",
std::filesystem::copy_options::overwrite_existing);
}
Expand Down
4 changes: 2 additions & 2 deletions src/motion_primitives/motion_primitives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,8 @@ void split_motion_primitives(const dynobench::Trajectories &in,
}

dynobench::Trajectory new_traj;
std::cout << "i: " << i << " "
<< "start: " << start << " length:" << length << std::endl;
std::cout << "i: " << i << " " << "start: " << start
<< " length:" << length << std::endl;
new_traj.states = std::vector<Eigen::VectorXd>{
traj.states.begin() + start,
traj.states.begin() + start + length + 1};
Expand Down
4 changes: 2 additions & 2 deletions src/ompl/robots.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3114,8 +3114,8 @@ void load_motion_primitives_new(const std::string &motionsFile,
CSTR_(add_noise_first_state);

if (add_noise_first_state) {
std::cout << "WARNING:"
<< "adding noise to first and last state" << std::endl;
std::cout << "WARNING:" << "adding noise to first and last state"
<< std::endl;
const double noise = 1e-7;
for (auto &t : trajs.data) {
t.states.front() +=
Expand Down
6 changes: 2 additions & 4 deletions src/ompl/sst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,10 +422,8 @@ void solve_sst(const dynobench::Problem &problem,
auto &state = states.at(i);
auto &edge = edges.at(i);
out << "- " << std::endl;
out << " "
<< "x: " << state.format(FMT) << std::endl;
out << " "
<< "e: ";
out << " " << "x: " << state.format(FMT) << std::endl;
out << " " << "e: ";
print_vec(edge.data(), edge.size(), out);
}
}
Expand Down
58 changes: 29 additions & 29 deletions src/optimization/croco_models.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,21 +165,21 @@ void check_input_calc(Eigen::Ref<Eigen::VectorXd> xnext,
const Eigen::Ref<const Vxd> &u, size_t nx, size_t nu) {

if (static_cast<std::size_t>(x.size()) != nx) {
throw_pretty("Invalid argument: "
<< "x has wrong dimension (it should be " +
std::to_string(nx) + ")");
throw_pretty(
"Invalid argument: " << "x has wrong dimension (it should be " +
std::to_string(nx) + ")");
}

if (static_cast<std::size_t>(u.size()) != nu) {
throw_pretty("Invalid argument: "
<< "x has wrong dimension (it should be " +
std::to_string(nu) + ")");
throw_pretty(
"Invalid argument: " << "x has wrong dimension (it should be " +
std::to_string(nu) + ")");
}

if (static_cast<std::size_t>(xnext.size()) != nx) {
throw_pretty("Invalid argument: "
<< "xnext has wrong dimension (it should be " +
std::to_string(nx) + ")");
throw_pretty(
"Invalid argument: " << "xnext has wrong dimension (it should be " +
std::to_string(nx) + ")");
}
};

Expand All @@ -190,38 +190,38 @@ void check_input_calcdiff(Eigen::Ref<Eigen::MatrixXd> Fx,
size_t nu) {

if (static_cast<std::size_t>(x.size()) != nx) {
throw_pretty("Invalid argument: "
<< "x has wrong dimension (it should be " +
std::to_string(nx) + ")");
throw_pretty(
"Invalid argument: " << "x has wrong dimension (it should be " +
std::to_string(nx) + ")");
}
if (static_cast<std::size_t>(u.size()) != nu) {
throw_pretty("Invalid argument: "
<< "u has wrong dimension (it should be " +
std::to_string(nu) + ")");
throw_pretty(
"Invalid argument: " << "u has wrong dimension (it should be " +
std::to_string(nu) + ")");
}

if (static_cast<std::size_t>(Fx.cols()) != nx) {
throw_pretty("Invalid argument: "
<< "Fx has wrong dimension (it should be " +
std::to_string(nx) + ")");
throw_pretty(
"Invalid argument: " << "Fx has wrong dimension (it should be " +
std::to_string(nx) + ")");
}

if (static_cast<std::size_t>(Fx.rows()) != nx) {
throw_pretty("Invalid argument: "
<< "Fx has wrong dimension (it should be " +
std::to_string(nx) + ")");
throw_pretty(
"Invalid argument: " << "Fx has wrong dimension (it should be " +
std::to_string(nx) + ")");
}

if (static_cast<std::size_t>(Fu.cols()) != nu) {
throw_pretty("Invalid argument: "
<< "Fu has wrong dimension (it should be " +
std::to_string(nx) + ")");
throw_pretty(
"Invalid argument: " << "Fu has wrong dimension (it should be " +
std::to_string(nx) + ")");
}

if (static_cast<std::size_t>(Fu.rows()) != nx) {
throw_pretty("Invalid argument: "
<< "Fu has wrong dimension (it should be " +
std::to_string(nx) + ")");
throw_pretty(
"Invalid argument: " << "Fu has wrong dimension (it should be " +
std::to_string(nx) + ")");
}
}

Expand Down Expand Up @@ -1043,10 +1043,10 @@ int get_additional_nu(Control_Mode control_mode) {

boost::shared_ptr<StateCrocoDyno>
mk_state_croco(std::shared_ptr<dynobench::Model_robot> model_robot,
Control_Mode control_mode){};
Control_Mode control_mode) {};

int get_nx(std::shared_ptr<dynobench::Model_robot> model_robot,
Control_Mode control_mode){};
Control_Mode control_mode) {};

ActionModelDynov2::ActionModelDynov2(
std::shared_ptr<dynobench::Model_robot> model_robot,
Expand Down
40 changes: 12 additions & 28 deletions src/optimization/ocp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -614,8 +614,7 @@ void fix_problem_quaternion(Eigen::VectorXd &start, Eigen::VectorXd &goal,
double d2 = (xs_init.front().segment<4>(3) + start.segment<4>(3)).norm();

if (d2 < d1) {
std::cout << "WARNING: "
<< "i flip the start state" << std::endl;
std::cout << "WARNING: " << "i flip the start state" << std::endl;
xs_init.front().segment<4>(3) *= -1.;
}

Expand Down Expand Up @@ -1081,8 +1080,8 @@ void __trajectory_optimization(
SOLVER solver = static_cast<SOLVER>(options_trajopt_local.solver_id);

if (modify_to_match_goal_start) {
std::cout << "WARNING: "
<< "i modify last state to match goal" << std::endl;
std::cout << "WARNING: " << "i modify last state to match goal"
<< std::endl;
xs_init.back() = goal;
xs_init.front() = start;
}
Expand Down Expand Up @@ -1649,16 +1648,14 @@ void __trajectory_optimization(

if (is_last) {
finished = true;
std::cout << "finished: "
<< "is_last=TRUE" << std::endl;
std::cout << "finished: " << "is_last=TRUE" << std::endl;
}

counter++;

if (counter > options_trajopt_local.max_mpc_iterations) {
finished = true;
std::cout << "finished: "
<< "max mpc iterations" << std::endl;
std::cout << "finished: " << "max mpc iterations" << std::endl;
}
}
std::cout << "Total TIME: " << total_time << std::endl;
Expand Down Expand Up @@ -2088,9 +2085,7 @@ void trajectory_optimization(const dynobench::Problem &problem,
CSTR_(time_ddp_total);

if (!opti_out.success) {
std::cout << "warning"
<< " "
<< "not success" << std::endl;
std::cout << "warning" << " " << "not success" << std::endl;
do_mpcc = false;
break;
}
Expand All @@ -2115,9 +2110,7 @@ void trajectory_optimization(const dynobench::Problem &problem,
time_ddp_total += std::stod(opti_out.data.at("ddp_time"));
CSTR_(time_ddp_total);
if (!opti_out.success) {
std::cout << "warning"
<< " "
<< "not success" << std::endl;
std::cout << "warning" << " " << "not success" << std::endl;
break;
}
}
Expand All @@ -2144,9 +2137,7 @@ void trajectory_optimization(const dynobench::Problem &problem,
time_ddp_total += std::stod(opti_out.data.at("ddp_time"));
CSTR_(time_ddp_total);
if (!opti_out.success) {
std::cout << "warning"
<< " "
<< "not success" << std::endl;
std::cout << "warning" << " " << "not success" << std::endl;
do_free_time = false;
}

Expand Down Expand Up @@ -2194,9 +2185,7 @@ void trajectory_optimization(const dynobench::Problem &problem,
time_ddp_total += std::stod(opti_out.data.at("ddp_time"));
CSTR_(time_ddp_total);
if (!opti_out.success) {
std::cout << "warning"
<< " "
<< "fail first step" << std::endl;
std::cout << "warning" << " " << "fail first step" << std::endl;
do_free_time = false;
}

Expand Down Expand Up @@ -2374,8 +2363,7 @@ void trajectory_optimization(const dynobench::Problem &problem,
CSTR_(time_ddp_total);

if (!opti_out.success) {
std::cout << "warning:"
<< "not success" << std::endl;
std::cout << "warning:" << "not success" << std::endl;
do_final_repair_step = false;
}

Expand Down Expand Up @@ -2410,9 +2398,7 @@ void trajectory_optimization(const dynobench::Problem &problem,
CSTR_(time_ddp_total);

if (!opti_out.success) {
std::cout << "warning"
<< " "
<< "infeasible" << std::endl;
std::cout << "warning" << " " << "infeasible" << std::endl;
do_final_repair_step = false;
}

Expand Down Expand Up @@ -2523,9 +2509,7 @@ void trajectory_optimization(const dynobench::Problem &problem,
// solve without bounds --

if (!opti_out.success) {
std::cout << "warning"
<< " "
<< "not success" << std::endl;
std::cout << "warning" << " " << "not success" << std::endl;
do_opti_with_real_bounds = false;
}

Expand Down
Loading
Loading