Skip to content

Commit 2e9a223

Browse files
authored
MoveRelative: handle equal min/max distance (#593)
When min_distance == max_distance > 0.0, the minimal distance might be missed due to numerical errors. To avoid this, deactivate the minimal distance check and run the full distance as given by max_distance.
1 parent 8d2baf2 commit 2e9a223

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

core/src/stages/move_relative.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,11 @@ bool MoveRelative::compute(const InterfaceState& state, planning_scene::Planning
185185

186186
double max_distance = props.get<double>("max_distance");
187187
double min_distance = props.get<double>("min_distance");
188+
189+
// if min_distance == max_distance, resort to moving full distance (negative min_distance)
190+
if (max_distance > 0.0 && std::fabs(max_distance - min_distance) < std::numeric_limits<double>::epsilon())
191+
min_distance = -1.0;
192+
188193
const auto& path_constraints = props.get<moveit_msgs::Constraints>("path_constraints");
189194

190195
robot_trajectory::RobotTrajectoryPtr robot_trajectory;

0 commit comments

Comments
 (0)