Skip to content
Open
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
17 changes: 9 additions & 8 deletions core/src/cost_terms.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*********************************************************************
/*********************************************************************
* Software License Agreement (BSD License)
*
* Copyright (c) 2020, Hamburg University
Expand Down Expand Up @@ -253,7 +253,7 @@ Clearance::Clearance(bool with_world, bool cumulative, std::string group_propert
, distance_to_cost{ [](double d) { return 1.0 / (d + 1e-5); } } {}

double Clearance::operator()(const SubTrajectory& s, std::string& comment) const {
static const std::string PREFIX{ "Clearance: " };
constexpr std::string_view PREFIX{ "Clearance: " };

collision_detection::DistanceRequest request;
request.type =
Expand Down Expand Up @@ -298,8 +298,8 @@ double Clearance::operator()(const SubTrajectory& s, std::string& comment) const
} };

auto collision_comment = [=](const auto& distance) {
return fmt::format(PREFIX + "allegedly valid solution collides between '{}' and '{}'", distance.link_names[0],
distance.link_names[1]);
return fmt::format("{}allegedly valid solution collides between '{}' and '{}'", PREFIX,
distance.link_names[0], distance.link_names[1]);
};

double distance{ 0.0 };
Expand All @@ -313,10 +313,10 @@ double Clearance::operator()(const SubTrajectory& s, std::string& comment) const
}
distance = distance_data.distance;
if (!cumulative)
comment = fmt::format(PREFIX + "distance {} between '{}' and '{}'", distance, distance_data.link_names[0],
distance_data.link_names[1]);
comment = fmt::format("{}distance {} between '{}' and '{}'", PREFIX, distance,
distance_data.link_names[0], distance_data.link_names[1]);
else
comment = fmt::format(PREFIX + "cumulative distance {}", distance);
comment = fmt::format("{}cumulative distance {}", PREFIX, distance);
} else { // check trajectory
for (size_t i = 0; i < s.trajectory()->getWayPointCount(); ++i) {
auto distance_data = check_distance(state, s.trajectory()->getWayPoint(i));
Expand All @@ -327,7 +327,8 @@ double Clearance::operator()(const SubTrajectory& s, std::string& comment) const
distance += distance_data.distance;
}
distance /= s.trajectory()->getWayPointCount();
comment = fmt::format(PREFIX + "average{} distance: {}", (cumulative ? " cumulative" : ""), distance);
comment = fmt::format("{}average{} distance: {}", PREFIX, (cumulative ? " cumulative" : ""),
distance);
}

return distance_to_cost(distance);
Expand Down
5 changes: 3 additions & 2 deletions core/src/stage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -909,8 +909,9 @@ bool Connecting::compatible(const InterfaceState& from_state, const InterfaceSta
const planning_scene::PlanningSceneConstPtr& from = from_state.scene();
const planning_scene::PlanningSceneConstPtr& to = to_state.scene();

auto false_with_debug = [](auto... args) {
RCLCPP_DEBUG_STREAM(rclcpp::get_logger("Connecting"), fmt::format(args...));
auto false_with_debug = [](const char* format_str, auto&&... args) {
RCLCPP_DEBUG_STREAM(rclcpp::get_logger("Connecting"),
fmt::format(fmt::runtime(format_str), std::forward<decltype(args)>(args)...));
return false;
};

Expand Down