Skip to content

Commit

Permalink
lint pt 2
Browse files Browse the repository at this point in the history
  • Loading branch information
efahnestock committed Dec 2, 2024
1 parent 561580d commit aba7896
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 16 deletions.
4 changes: 2 additions & 2 deletions common/math/cubic_hermite_spline.hh
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ class CubicHermiteSpline {
}

X operator()(const T &query_time) const {
ROBOT_CHECK(query_time >= ts_.front() && query_time <= ts_.back(), "query_time is out of bounds",
ts_.front(), ts_.back(), query_time);
ROBOT_CHECK(query_time >= ts_.front() && query_time <= ts_.back(),
"query_time is out of bounds", ts_.front(), ts_.back(), query_time);

const auto iter = std::lower_bound(ts_.begin(), ts_.end(), query_time);
if (iter == ts_.end()) {
Expand Down
2 changes: 1 addition & 1 deletion common/sqlite3/sqlite3.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ struct Database::Impl {
void bind(const Statement &stmt, const std::unordered_map<std::string, Database::Value> &args) {
sqlite3_stmt *stmt_ptr = stmt.impl_->stmt.get();
ROBOT_CHECK(args.size() == sqlite3_bind_parameter_count(stmt_ptr),
"insufficient number of arguments", sqlite3_sql(stmt_ptr), args);
"insufficient number of arguments", sqlite3_sql(stmt_ptr), args);
for (const auto &[key, value] : args) {
const int param_idx = sqlite3_bind_parameter_index(stmt_ptr, key.c_str());
std::visit(
Expand Down
2 changes: 1 addition & 1 deletion experimental/beacon_sim/beacon_potential.cc
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ BeaconPotential operator*(const BeaconPotential &a, const BeaconPotential &b) {
b_sorted_members.begin(), b_sorted_members.end(),
std::back_inserter(common_elements));
ROBOT_CHECK(common_elements.empty(), "Found overlap in members of potentials", a_sorted_members,
b_sorted_members, common_elements);
b_sorted_members, common_elements);

return CombinedPotential({a, b});
}
Expand Down
5 changes: 3 additions & 2 deletions experimental/beacon_sim/belief_road_map_planner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,9 @@ std::function<double(const LandmarkRobotBelief &)> make_uncertainty_size(
return elem.cov_in_robot.determinant();
}
}
ROBOT_CHECK(false, "Landmark Belief has insufficient probability mass to get to threshold",
accumulated_prob);
ROBOT_CHECK(false,
"Landmark Belief has insufficient probability mass to get to threshold",
accumulated_prob);
return elements.back().cov_in_robot.determinant();
};
} else if (std::holds_alternative<ExpectedDeterminant>(options)) {
Expand Down
6 changes: 4 additions & 2 deletions experimental/beacon_sim/compute_oracle_results.cc
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,8 @@ void compute_oracle_results(const std::string server_address, const int server_p
update.set_progress(static_cast<double>(plans_completed) / total_plans);
pack_into(job_start_time, update.mutable_start_time());
pack_into(time::current_robot_time(), update.mutable_current_time());
ROBOT_CHECK(client.update_job_status(&client_context, update_request, &update_response).ok());
ROBOT_CHECK(
client.update_job_status(&client_context, update_request, &update_response).ok());
};

// Compute the results
Expand All @@ -337,7 +338,8 @@ void compute_oracle_results(const std::string server_address, const int server_p
result_request.mutable_job_result()->mutable_plan()->Add(plans.begin(), plans.end());
result_request.set_job_id(maybe_job_response->job_id());
proto::JobResultResponse result_response;
ROBOT_CHECK(client.submit_job_result(&client_context, result_request, &result_response).ok());
ROBOT_CHECK(
client.submit_job_result(&client_context, result_request, &result_response).ok());
}
}
}
Expand Down
8 changes: 5 additions & 3 deletions experimental/beacon_sim/correlated_beacon_potential.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ double compute_log_prob(const CorrelatedBeaconPotential &pot,
std::back_inserter(keys_to_keep));

ROBOT_CHECK(allow_partial_assignment || missing_keys.empty(),
"partial assignment specified when not enabled", assignment, missing_keys, pot.members);
"partial assignment specified when not enabled", assignment, missing_keys,
pot.members);

const int num_beacons_present =
std::count_if(keys_to_keep.begin(), keys_to_keep.end(),
Expand Down Expand Up @@ -209,8 +210,9 @@ CorrelatedBeaconPotential condition_on(const CorrelatedBeaconPotential &pot,
new_assignment = pot.conditioning->conditioned_members;
for (const auto &[id, value] : assignment) {
const auto &existing_conditioned = pot.conditioning->conditioned_members;
ROBOT_CHECK(!existing_conditioned.contains(id) || (existing_conditioned.at(id) == value),
"Inconsistent conditioning", existing_conditioned, assignment);
ROBOT_CHECK(
!existing_conditioned.contains(id) || (existing_conditioned.at(id) == value),
"Inconsistent conditioning", existing_conditioned, assignment);

new_assignment[id] = value;
}
Expand Down
2 changes: 1 addition & 1 deletion experimental/beacon_sim/ekf_slam.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ std::optional<int> find_beacon_matrix_idx_or_add(const int id, InOut<EkfSlamEsti

const int max_num_landmarks = (est->mean.rows() - ROBOT_STATE_DIM) / BEACON_DIM;
ROBOT_CHECK(static_cast<int>(est->beacon_ids.size()) < max_num_landmarks,
"Not enough capacity to add beacon to EKF, increase max_num_beacons in ekf_config");
"Not enough capacity to add beacon to EKF, increase max_num_beacons in ekf_config");

est->beacon_ids.push_back(id);
return find_beacon_matrix_idx(est->beacon_ids, id);
Expand Down
3 changes: 2 additions & 1 deletion experimental/beacon_sim/precision_matrix_potential.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ double compute_log_prob(const PrecisionMatrixPotential &pot,
std::back_inserter(keys_to_keep));

ROBOT_CHECK(allow_partial_assignment || missing_keys.empty(),
"partial assignment specified when not enabled", assignment, missing_keys, pot.members);
"partial assignment specified when not enabled", assignment, missing_keys,
pot.members);

const std::vector<int> to_marginalize = missing_keys;

Expand Down
4 changes: 2 additions & 2 deletions experimental/beacon_sim/run_experiment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ void run_experiment(const proto::ExperimentConfig &config, const std::filesystem

for (const auto &planner_config : config.planner_configs()) {
ROBOT_CHECK(planner_config.planner_config_oneof_case() !=
proto::PlannerConfig::PLANNER_CONFIG_ONEOF_NOT_SET);
proto::PlannerConfig::PLANNER_CONFIG_ONEOF_NOT_SET);
switch (planner_config.planner_config_oneof_case()) {
case proto::PlannerConfig::kLandmarkBrmConfig: {
results[planner_config.name()] = run_planner(
Expand All @@ -425,7 +425,7 @@ void run_experiment(const proto::ExperimentConfig &config, const std::filesystem
}
default: {
ROBOT_CHECK(false, "Unhandled Planner Config type",
planner_config.planner_config_oneof_case());
planner_config.planner_config_oneof_case());
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion experimental/learn_descriptors/symphony_lake_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace robot::experimental::learn_descriptors {
DataParser::DataParser(const std::filesystem::path &image_root_dir,
const std::vector<std::string> &survey_list) {
ROBOT_CHECK(std::filesystem::exists(image_root_dir), "Image root dir does not exist!",
image_root_dir);
image_root_dir);
surveys_.load(image_root_dir.string(), survey_list);
}
DataParser::~DataParser() {}
Expand Down

0 comments on commit aba7896

Please sign in to comment.