ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

remapping with robot_state_publisher

asked 2012-05-30 23:01:07 -0600

ocli gravatar image

I am using the arm_navigation stack and can't seem to remap a published sensor_msgs/JointState topic through the robot_state_publisher generic launch file. The remapping and tf file is:

    <node pkg="robot_state_publisher" type="state_publisher" name="rob_st_pub" >
      <remap from="joint_states_tf" to="joint_states" />

The topic is published correctly (verified with rostopic echo) under "/joint_states_tf" through this node

#include <ros/ros.h>
#include <stdio.h>
#include <string>
#include <iostream>
#include <sensor_msgs/JointState.h>

int main(int argc, char **argv){
    ros::NodeHandle nh;
    ros::Publisher pub = nh.advertise<sensor_msgs::JointState>("joint_states_tf",1000);
    ros::Rate lr(10);

    sensor_msgs::JointState msg;"tip_joint");"wrist_roll_joint");"wrist_flex_joint");"wrist_roll_joint");"elbow_flex_joint");"shoulder_lift_joint");"shoulder_roll_joint");"base_joint");

    for (int i = 0; i < 8; i++){

        msg.header.stamp = ros::Time::now();

yet the output when using

rostopic echo /joint_states

is null and but the /tf topic is published correctly.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2012-05-31 00:11:10 -0600

dornhege gravatar image

updated 2012-05-31 00:11:42 -0600

You have it flipped. The remap says from what topic that is named in the binary to what topic in the ROS world it should be remapped.

If you either apply that remapping to you program launch or flip the remap parameters for the state publisher, it should work.

edit flag offensive delete link more


I wanted to remap from /joint_states_tf to /joint_states, not vice versa.

ocli gravatar image ocli  ( 2012-05-31 01:20:04 -0600 )edit

I think your understanding of remapping from/to is wrong. As you have set it up, you need to either remap the other way around or remap the other program. As you do it, it can't work.

dornhege gravatar image dornhege  ( 2012-05-31 01:32:47 -0600 )edit

I think that's very likely. I just switched them around and slowed the loop rate and it works, what is the purpose of robot state planner tutorial launch file where it remaps the non-existent publication from the /environment server then?

ocli gravatar image ocli  ( 2012-05-31 03:32:47 -0600 )edit

Are you referring to the example launch file in 2.2? That maps FROM joint_states, which is a topic of robot_state_publisher and thus correct.

dornhege gravatar image dornhege  ( 2012-05-31 03:50:16 -0600 )edit

Yes. Ah ok I got confused when looking at the rxgraph. Thankyou

ocli gravatar image ocli  ( 2012-05-31 04:23:31 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2012-05-30 23:01:07 -0600

Seen: 2,626 times

Last updated: May 31 '12