Skip to content

Commit

Permalink
Merge pull request #1121 from Naoki-Hiraoka/PR-jointname
Browse files Browse the repository at this point in the history
[HrpsysSeqStateROSBridge.cpp] avoid segmentation fault when unkown joint name is given to /fullbody_controller/follow_joint_trajectory_action/goal
  • Loading branch information
k-okada authored Jun 9, 2022
2 parents ee21bf5 + ae1800b commit 07f7e19
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion hrpsys_ros_bridge/src/HrpsysJointTrajectoryBridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,9 @@ void HrpsysJointTrajectoryBridge::jointTrajectoryActionObj::onJointTrajectory(
trajectory_msgs::JointTrajectoryPoint point = trajectory.points[i];
for (unsigned int j = 0; j < joint_names.size(); j++)
{
parent->body->link(joint_names[j])->q = point.positions[j];
hrp::Link* l = parent->body->link(joint_names[j]);
if(l) l->q = point.positions[j];
else ROS_WARN_STREAM_ONCE("[" << parent->getInstanceName() << "] @onJointTrajectoryAction (" << this->groupname << ") : joint named " << joint_names[j] << " is not found. Skipping ...");
}

parent->body->calcForwardKinematics();
Expand Down
4 changes: 3 additions & 1 deletion hrpsys_ros_bridge/src/HrpsysSeqStateROSBridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@ void HrpsysSeqStateROSBridge::onJointTrajectory(trajectory_msgs::JointTrajectory

trajectory_msgs::JointTrajectoryPoint point = trajectory.points[i];
for (unsigned int j=0; j < trajectory.joint_names.size(); j++ ) {
body->link(joint_names[j])->q = point.positions[j];
hrp::Link* l = body->link(joint_names[j]);
if(l) l->q = point.positions[j];
else ROS_WARN_STREAM_ONCE("[" << getInstanceName() << "] @onJointTrajectoryAction : joint named " << joint_names[j] << " is not found. Skipping ...");
}

body->calcForwardKinematics();
Expand Down

0 comments on commit 07f7e19

Please sign in to comment.