Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jun 10, 2024
1 parent 7451ead commit 18d1a86
Show file tree
Hide file tree
Showing 12 changed files with 104 additions and 74 deletions.
14 changes: 7 additions & 7 deletions include/dynoplan/dbastar/heuristics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ struct Heu_euclidean : Heu_fun {
return robot->lower_bound_time(x, goal);
}

virtual ~Heu_euclidean() override{};
virtual ~Heu_euclidean() override {};
};

struct Heu_blind : Heu_fun {
Expand All @@ -138,7 +138,7 @@ struct Heu_blind : Heu_fun {
return 0;
}

virtual ~Heu_blind() override{};
virtual ~Heu_blind() override {};
};

struct Heu_roadmap : Heu_fun {
Expand Down Expand Up @@ -181,12 +181,12 @@ struct Heu_roadmap : Heu_fun {
return std::max(vel_h, pos_h);
}

virtual ~Heu_roadmap() override{
virtual ~Heu_roadmap() override {

// robot->getSpaceInformation()->freeState(__x_zero_vel);
// robot->getSpaceInformation()->freeState(__x_zero_vel);

// TODO: memory leak
// I have to delete more stuff!!!
// TODO: memory leak
// I have to delete more stuff!!!
};
};

Expand All @@ -213,7 +213,7 @@ template <typename _T, typename _Node> struct Heu_roadmap_bwd : Heu_fun {
}
}

virtual ~Heu_roadmap_bwd() override{};
virtual ~Heu_roadmap_bwd() override {};
};

void build_heuristic_distance_new(
Expand Down
6 changes: 3 additions & 3 deletions include/dynoplan/optimization/croco_models.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ struct StateCrocoDyno : crocoddyl::StateAbstractTpl<double> {
bool use_pin = true;
std::shared_ptr<dynobench::StateDyno> state;
explicit StateCrocoDyno(const std::shared_ptr<dynobench::StateDyno> &state)
: StateAbstractTpl<Scalar>(state->nx, state->ndx), state(state){};
: StateAbstractTpl<Scalar>(state->nx, state->ndx), state(state) {};

virtual ~StateCrocoDyno() {}

Expand Down Expand Up @@ -276,7 +276,7 @@ struct Dynamics {
Eigen::VectorXd x_ub;
Eigen::VectorXd x_weightb;

virtual ~Dynamics(){};
virtual ~Dynamics() {};
};

struct Cost {
Expand Down Expand Up @@ -479,7 +479,7 @@ struct Dynamics_free_time {
Eigen::VectorXd x_ub;
Eigen::VectorXd x_weightb;

virtual ~Dynamics_free_time(){};
virtual ~Dynamics_free_time() {};
};

struct Quaternion_cost : Cost {
Expand Down
13 changes: 8 additions & 5 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,19 +703,22 @@ 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: 11 additions & 6 deletions src/dbrrt/dbrrt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -497,14 +497,16 @@ 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 @@ -1049,14 +1051,16 @@ 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 @@ -1116,8 +1120,9 @@ 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: 2 additions & 1 deletion src/motion_primitives/main_primitives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,8 @@ 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: 4 additions & 2 deletions src/ompl/sst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,8 +422,10 @@ 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
54 changes: 27 additions & 27 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
Loading

0 comments on commit 18d1a86

Please sign in to comment.