ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I had the same issue with my own URDF model and finally I could solve it. The robot_state_publisher needs basically only two information to run:

  1. A URDF model in XML format on the parameter server. The default parameter is: /robot_description
  2. A msg of the type sensor_msgs::JointState on the topic /joint_states

I found this information in the FAQ of tf

The important information I forgot first by sending out my /joint_state msg is the timestamp in the msg header! Without the time information the robot_state_publisher is not able to calculate the tf frames for the moving joints. Inside of the code this means the following for me:

// Setup the publisher for the /joint_states msg
ros::Publisher pub_js = nh.advertise<sensor_msgs::JointState>("/joint_states", 100);    
sensor_msgs::JointState msg;            // Create an object of the sensor_msgs::JointState

msg.name.push_back("My_Joint_Name");    // This must be the joint_name that is used inside of the URDF file
msg.position.push_back(0.0);            // Set a value for this joint

msg.header.stamp = ros::Time::now();    // Stamp this message with the actual time
pub_js.publish(msg);                    // Publish the message

I hope this will solve your problem as well!