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

Use link names in temperature messages #320

Merged
Merged
Show file tree
Hide file tree
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
8 changes: 8 additions & 0 deletions include/ur_modern_driver/ros/rt_publisher.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ using namespace tf;

const std::string JOINTS[] = { "shoulder_pan_joint", "shoulder_lift_joint", "elbow_joint",
"wrist_1_joint", "wrist_2_joint", "wrist_3_joint" };
// links with origin in the joints configured above.
const std::string LINKS[] = { "shoulder_link", "upper_arm_link", "forearm_link",
"wrist_1_link", "wrist_2_link", "wrist_3_link" };
gavanderhoorn marked this conversation as resolved.
Show resolved Hide resolved

class RTPublisher : public URRTPacketConsumer
{
Expand All @@ -47,6 +50,7 @@ class RTPublisher : public URRTPacketConsumer
Publisher joint_temperature_pub_;
TransformBroadcaster transform_broadcaster_;
std::vector<std::string> joint_names_;
std::vector<std::string> link_names_;
std::string base_frame_;
std::string tool_frame_;
bool temp_only_;
Expand All @@ -73,6 +77,10 @@ class RTPublisher : public URRTPacketConsumer
{
joint_names_.push_back(joint_prefix + j);
}
for (auto const& link : LINKS)
{
link_names_.push_back(joint_prefix + link);
}
}

virtual bool consume(RTState_V1_6__7& state);
Expand Down
5 changes: 4 additions & 1 deletion src/ros/rt_publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ bool RTPublisher::publishTemperature(RTShared& packet, Time& t)
{
sensor_msgs::Temperature msg;
msg.header.stamp = t;
msg.header.frame_id = joint_names_[i];
// assumption: origins of the link frames are coincident with the origins
// of the joints. As the temperature sensors are assumed to be located in
// the joints, using the names of the link frames here should be acceptable.
msg.header.frame_id = link_names_[i];
fmauch marked this conversation as resolved.
Show resolved Hide resolved
msg.temperature = packet.motor_temperatures[i];

joint_temperature_pub_.publish(msg);
Expand Down