File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -275,6 +275,19 @@ onJointTrajectory(trajectory_msgs::JointTrajectory trajectory) {
275275 duration.length (trajectory.points .size ()) ;
276276
277277 std::vector<std::string> joint_names = trajectory.joint_names ;
278+ if (joint_names.size () < joint_list.size ()) {
279+ ROS_ERROR_STREAM (" [" << parent->getInstanceName () << " ] @onJointTrajectoryAction / Error : "
280+ << " required joint_names.size() = " << joint_names.size ()
281+ << " < joint_list.size() = " << joint_list.size () );
282+ return ;
283+ }
284+ for (unsigned int i = 0 ; i < joint_list.size (); i++) {
285+ if (count (joint_names.begin (), joint_names.end (), joint_list[i]) != 1 ) {
286+ ROS_ERROR_STREAM (" [" << parent->getInstanceName () << " ] @onJointTrajectoryAction / Error : "
287+ << " joint : " << joint_list[i] << " did not exist in the required trajectory." );
288+ return ;
289+ }
290+ }
278291
279292 ROS_INFO_STREAM (" [" << parent->getInstanceName () << " ] @onJointTrajectoryAction (" << this ->groupname << " ) : trajectory.points.size() " << trajectory.points .size ());
280293 for (unsigned int i = 0 ; i < trajectory.points .size (); i++) {
You can’t perform that action at this time.
0 commit comments