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

How to update joint state in Rviz

asked 2020-07-14 17:20:25 -0500

Chao Chen gravatar image

updated 2022-03-04 07:00:41 -0500

lucasw gravatar image

I have a server to publish the joint states of the robot. Now I need to update the joint states in Rviz based on the server’s data. What is the common way of doing it?

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2020-07-14 18:22:15 -0500

Geoff gravatar image

You should use the robot_state_publisher package's state_publisher node to transform your joint states into transforms. It will subscribe to the joint_states topic and publish a TF message when a joint changes position. You will also need to provide a URDF of your robot because the state_publisher node needs to know how the joints are structured in order to calculate the transforms from the joint angles.

These transforms can be easily displayed in rviz using the TF visualization.

edit flag offensive delete link more

answered 2020-07-14 17:36:01 -0500

bmgatten gravatar image

RVIZ should automatically reflect the joint state that's published. Have you checked to make sure that your fixed frame in rviz and the frame i.d. in the joint state message are correct?

edit flag offensive delete link more


I am new to ROS. I mean the server just sends the joints angle, not in sensor_msg/joint_state topic. I need to pack the information from the server and sent out again. Will this customized publisher conflicting with the existing default “joint state publisher” from ROS package?

Chao Chen gravatar image Chao Chen  ( 2020-07-14 17:43:22 -0500 )edit

I have limited experience with using joint state publisher but I recall there being interference between my custom sensor_msg/joint_state topic what the "joint state publisher" node was publishing. I would recommend removing the ROS package and using your own publisher which takes the joint angle and publishes it into a standard joint_state message.

bmgatten gravatar image bmgatten  ( 2020-07-14 17:46:40 -0500 )edit

Question Tools



Asked: 2020-07-14 17:20:25 -0500

Seen: 2,111 times

Last updated: Jul 14 '20