0
$\begingroup$

Rosanswers logo

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:

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

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::init(argc,argv,"state_publisher");
    ros::NodeHandle nh;
    ros::Publisher pub = nh.advertise<sensor_msgs::JointState>("joint_states_tf",1000);
    ros::Rate lr(10);

    sensor_msgs::JointState msg;
    msg.name.push_back("tip_joint");
    msg.name.push_back("wrist_roll_joint");
    msg.name.push_back("wrist_flex_joint");
    msg.name.push_back("wrist_roll_joint");
    msg.name.push_back("elbow_flex_joint");
    msg.name.push_back("shoulder_lift_joint");
    msg.name.push_back("shoulder_roll_joint");
    msg.name.push_back("base_joint");
    
    
    for (int i = 0; i < 8; i++){
        msg.position.push_back(0.0);
        msg.velocity.push_back(0.0);
        msg.effort.push_back(0.0);
    }

    while(ros::ok()){
        msg.header.stamp = ros::Time::now();
        pub.publish(msg);
        ros::spinOnce();
    }
}

yet the output when using

rostopic echo /joint_states

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


Originally posted by ocli on ROS Answers with karma: 215 on 2012-05-30

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by dornhege with karma: 31395 on 2012-05-31

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by ocli on 2012-05-31:
I wanted to remap from /joint_states_tf to /joint_states, not vice versa.

Comment by dornhege on 2012-05-31:
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.

Comment by ocli on 2012-05-31:
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?

Comment by dornhege on 2012-05-31:
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.

Comment by ocli on 2012-05-31:
Yes. Ah ok I got confused when looking at the rxgraph. Thankyou

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.