@@ -64,16 +64,16 @@ bool JointInterpolationPlanner::plan(const planning_scene::PlanningSceneConstPtr
6464 const moveit::core::RobotState& to_state = to->getCurrentState ();
6565 for (const moveit::core::JointModel* jm : from_state.getRobotModel ()->getActiveJointModels ())
6666 d = std::max (d, jm->getDistanceFactor () * from_state.distance (to_state, jm));
67- if (d < 1e-6 )
68- return true ; // return empty result trajectory: no motion needed
6967
7068 result = std::make_shared<robot_trajectory::RobotTrajectory>(from->getRobotModel (), jmg);
7169
7270 // add first point
7371 result->addSuffixWayPoint (from->getCurrentState (), 0.0 );
72+ if (from->isStateColliding (from_state, jmg->getName ()))
73+ return false ;
7474
7575 moveit::core::RobotState waypoint (from_state);
76- double delta = props.get <double >(" max_step" ) / d;
76+ double delta = d < 1e-6 ? 1.0 : props.get <double >(" max_step" ) / d;
7777 for (double t = delta; t < 1.0 ; t += delta) {
7878 from_state.interpolate (to_state, t, waypoint);
7979 result->addSuffixWayPoint (waypoint, t);
@@ -83,7 +83,9 @@ bool JointInterpolationPlanner::plan(const planning_scene::PlanningSceneConstPtr
8383 }
8484
8585 // add goal point
86- result->addSuffixWayPoint (to->getCurrentState (), 1.0 );
86+ result->addSuffixWayPoint (to_state, 1.0 );
87+ if (from->isStateColliding (to_state, jmg->getName ()))
88+ return false ;
8789
8890 // add timing, TODO: use a generic method to add timing via plugins
8991 trajectory_processing::IterativeParabolicTimeParameterization timing;
0 commit comments