Skip to content

Commit 7f8f779

Browse files
author
youhei@jsk.imi.i.u-tokyo.ac.jp
committed
checking the existance all joints in required group on HrpsysJointTrajectoryBridge (ignore not existing joint)
1 parent 239cacb commit 7f8f779

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

hrpsys_ros_bridge/src/HrpsysJointTrajectoryBridge.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff 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++) {

0 commit comments

Comments
 (0)