Ask Your Question

How to view the state of joints in rviz after using ros_control?

asked 2018-04-03 06:17:26 -0600

stefanvan gravatar image

updated 2018-04-05 10:28:48 -0600

After I used ros_control, I could clearly observe the joint state change in gazebo. Then how to observe the corresponding changes of joints' states in rviz? image description

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-04-03 13:59:31 -0600

Assuming your controller YAML file includes a joint_state_controller/JointStateController plugin, then the joint states should be available over a standard /robot_name/joint_states topic (carrying a message of type sensor_msgs/JointState). This combined with a /robot_descriptionparameter and a robot_state_publisher node should be all that is required to view the simulated pose of the robot in rviz.

Note that this is covered in detail in the ros_control Gazebo Tutorial. Notice they have they joint_state_controller/JointStateController in the YAML file, they start the robot_state_publisher in the rrbot_control.launch file, and they load the URDF onto the parameter server in the rrbot_world.launch file. Finally, note there is a section called "Connect Rviz to Gazebo Simulation" that details how to setup rviz.

edit flag offensive delete link more


@jarvisschultz When was the /robot_name/joint_states topic created?

stefanvan gravatar image stefanvan  ( 2018-04-05 07:46:41 -0600 )edit

Even though, IMO, this is a terrible name, that's what the joint_state_controller/JointStateController plugin does. See the description on its official wiki page:

jarvisschultz gravatar image jarvisschultz  ( 2018-04-05 09:48:58 -0600 )edit

Sir, the wiki just shows some information about joint_state_controller/JointStateController.

stefanvan gravatar image stefanvan  ( 2018-04-05 09:52:49 -0600 )edit

I installed the RRbot mentioned on this page. During the process of using RRbot, I observed the current topic list via rostopic list and found out that there was a /joint_states topic after starting robot_state_publisher node

stefanvan gravatar image stefanvan  ( 2018-04-05 10:00:46 -0600 )edit

or joint_state_publisher node. When I launched rrbot_world.launch, rrbot_control.launch and rrbot_rviz.launch simultaneously, there was a /joint_states topic and a /rrbot/joint_states topic due to the use of a <remap> tag in rrbot_control.launch.

stefanvan gravatar image stefanvan  ( 2018-04-05 10:05:55 -0600 )edit

I uploaded a picture in the content of the question. The content of the picture is the graph of what's going on in the system, which is obtained by rqt_graph. I am now confused about the meaning of /joint_states and /rrbot/joint_states.

stefanvan gravatar image stefanvan  ( 2018-04-05 10:29:02 -0600 )edit

The first line on the linked wiki page under Package summary says "Controller to publish joint states."

jarvisschultz gravatar image jarvisschultz  ( 2018-04-05 15:05:01 -0600 )edit

I'm confused as to what your actual question is. With a joint_state_controller/JointStateController plugin loaded, Gazebo should publish joint states information (the name of this topic is remappable). The robot_state_publisher needs to subscribe to that joint state info, and be able to read...

jarvisschultz gravatar image jarvisschultz  ( 2018-04-05 15:06:14 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2018-04-03 06:17:26 -0600

Seen: 686 times

Last updated: Apr 05 '18