Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compare joint names, reject joint_state updates with differing names #506

Open
wants to merge 1 commit into
base: kinetic-devel
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,6 @@ bool JointTrajectoryInterface::calc_velocity(const motoman_msgs::DynamicJointsGr
return true;
}

robot_groups_[pt.group_number].get_joint_names();
for (size_t i = 0; i < robot_groups_[pt.group_number].get_joint_names().size(); ++i)
{
const std::string &jnt_name = robot_groups_[pt.group_number].get_joint_names()[i];
Expand Down Expand Up @@ -727,12 +726,29 @@ bool JointTrajectoryInterface::is_valid(const motoman_msgs::DynamicJointTrajecto
void JointTrajectoryInterface::jointStateCB(
const sensor_msgs::JointStateConstPtr &msg)
{
if (msg->name.size() != this->all_joint_names_.size())
return;

// compare all names, reject message if a name is not in both lists
for (size_t i=0; i < msg->name.size(); i++)
if (std::find(msg->name.begin(), msg->name.end(), this->all_joint_names_[i]) == msg->name.end())
return;

this->cur_joint_pos_ = *msg;
}

void JointTrajectoryInterface::jointStateCB(
const sensor_msgs::JointStateConstPtr &msg, int robot_id)
{
if (msg->name.size() != this->robot_groups_[robot_id].get_joint_names().size())
return;

// compare all names, reject message if a name is not in both lists
for (size_t i=0; i < msg->name.size(); i++)
if (std::find(msg->name.begin(), msg->name.end(), this->robot_groups_[robot_id].get_joint_names()[i])
== msg->name.end())
return;

this->cur_joint_pos_map_[robot_id] = *msg;
}

Expand Down