Rosanswers logo

What is the difference between joint_state_publisher and robot_state_publisher? I understand that I get robot state publisher from the URDF but the joint state? What if i want real data not fake?

Originally posted by marawy_alsakaf on ROS Answers with karma: 101 on 2017-11-06

Post score: 8

Original comments

Comment by jayess on 2017-11-06:
What do you mean

if i want real data not fake


Comment by marawy_alsakaf on 2017-11-06:
i mean if i want joint state from real robot not for simulation


1 Answer 1


Rosanswers logo

From the robot_state_publisher wiki:

robot_state_publisher uses the URDF specified by the parameter robot_description and the joint positions from the topic joint_states to calculate the forward kinematics of the robot and publish the results via tf.

From the joint_state_publisher wiki:

This package publishes sensor_msgs/JointState messages for a robot. The package reads the robot_description parameter, finds all of the non-fixed joints and publishes a JointState message with all those joints defined.

Can be used in conjunction with the robot_state_publisher node to also publish transforms for all joint states.

Basically, the robot_state_publisher publishes the tf transforms of your robot based on its URDF file. You can also publish the joint states using the joint_state_publisher or do it yourself. Either way, the robot_state_publisher uses this information to calculate the forward kinematics of your robot.


If you want to publish your own sensor_msgs/JointState messages then take a look at this tutorial.

Originally posted by jayess with karma: 6155 on 2017-11-06

This answer was ACCEPTED on the original site

Post score: 19

Original comments

Comment by marawy_alsakaf on 2017-11-06:
ok so i should now publish my jointstate (as in the tutorial) but for robot state i did not need to write any node, i called the robot state publisher in my launch file with URDF and it worked am i right ?

Comment by matthewmarkey on 2020-05-21:
I have used both the joint_state_publisher and robot_state_publisher in my demo_gazebo.launch file shown here...

I am publishing to joint_states from multiple sources, but I am unsure of how to rectify the situation. The current Gazebo output can be seen here.

With my rostopic info joint_states:

homefolder@ubuntu:~$ rostopic info joint_states
Type: sensor_msgs/JointState

 * /joint_state_publisher (http://ubuntu:41201/)
 * /gazebo (http://ubuntu:34151/)

 * /move_group (http://ubuntu:39291/)
 * /joint_state_publisher (http://ubuntu:41201/)

I am really lost on what I am doing wrong.

Comment by jayess on 2020-05-21:
@matthewmarkey you should ask a new question. Comments aren't the place to ask a new question

Comment by matthewmarkey on 2020-05-21:
Ok, I have done this. Do you have a minute to give some advice? @jayess


Comment by pitosalas on 2021-04-04:
Is it correct then that if the URDF does not define any joints that can move then one doesn't ever need to launch launch_state_publisher?


Your Answer

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