make cost operators const

This commit is contained in:
v4hn 2020-07-16 17:18:14 +02:00
parent 1f8feaaf0a
commit bbf7d415f6
2 changed files with 4 additions and 4 deletions

View File

@ -66,7 +66,7 @@ struct LinkMotion
{ {
LinkMotion(std::string link_name) : link_name(link_name) {} LinkMotion(std::string link_name) : link_name(link_name) {}
double operator()(const SubTrajectory&, std::string&); double operator()(const SubTrajectory&, std::string&) const;
std::string link_name; std::string link_name;
}; };
@ -85,7 +85,7 @@ struct Clearance
Interface::Direction interface = Interface::NONE) Interface::Direction interface = Interface::NONE)
: with_world(with_world), cumulative(cumulative), group_property(group_property), interface(interface) {} : with_world(with_world), cumulative(cumulative), group_property(group_property), interface(interface) {}
double operator()(const SubTrajectory& s, std::string& comment); double operator()(const SubTrajectory& s, std::string& comment) const;
bool with_world; bool with_world;
bool cumulative; bool cumulative;

View File

@ -64,7 +64,7 @@ double TrajectoryDuration(const SubTrajectory& s) {
return s.trajectory() ? s.trajectory()->getDuration() : 0.0; return s.trajectory() ? s.trajectory()->getDuration() : 0.0;
} }
double LinkMotion::operator()(const SubTrajectory& s, std::string& comment) { double LinkMotion::operator()(const SubTrajectory& s, std::string& comment) const {
const auto& traj{ s.trajectory() }; const auto& traj{ s.trajectory() };
if (traj == nullptr || traj->getWayPointCount() == 0) if (traj == nullptr || traj->getWayPointCount() == 0)
@ -87,7 +87,7 @@ double LinkMotion::operator()(const SubTrajectory& s, std::string& comment) {
return distance; return distance;
} }
double Clearance::operator()(const SubTrajectory& s, std::string& comment) { double Clearance::operator()(const SubTrajectory& s, std::string& comment) const {
const std::string PREFIX{ "Clearance: " }; const std::string PREFIX{ "Clearance: " };
collision_detection::DistanceRequest request; collision_detection::DistanceRequest request;