remapping with robot_state_publisher
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.