How can urdf joints subscribe from a topic?

asked 2021-03-10 15:14:34 -0500

alexspi13 gravatar image

Hello. I have a real robot car and I want to publish data to a topic and these data subscribe from Rviz to get the visualization movement when I move my robot. Something like joint state publisher but in the subscription way. Any ideas? Thanks.

edit retag flag offensive close merge delete


Use same name for your published topic and the URDF for example if you are publishing on /right_wheel make sure you have right_wheel in your URDF as well. in addtion you also have to check for frame_id, make sure it does matches with your URDF

AmirSaman gravatar image AmirSaman  ( 2021-03-10 19:49:26 -0500 )edit

@alexspi13: could you please clarify what you want to achieve? Do you want to have the model in RViz mimic the motions of your real robot?

gvdhoorn gravatar image gvdhoorn  ( 2021-03-11 01:49:32 -0500 )edit
alexspi13 gravatar image alexspi13  ( 2021-03-11 13:52:42 -0500 )edit

For RViz to visualise the state of your robot, you'll have to add a Robot Model display and have something publish TF transformations which tell RViz where it should draw your model.

If it's really a "car", then I guess there aren't that many transforms (mostly the place of your vehicle relative to some origin).

I don't have a step-by-step guide for you I'm afraid. Do you already have a URDF model of your robot?

gvdhoorn gravatar image gvdhoorn  ( 2021-03-11 13:55:41 -0500 )edit

@gvdhoorn: Yes I have design a URDF robo model. I tried from rostopic pub /joint_states to my wheel joint but didn't publish the data. Now I'm trying to publish data from my GUI. I create a publisher to joint_states topic with these data:[0] = "joint_left_wheel_f";
left_wheel_front.position[0] = 3;
left_wheel_front.effort[0] = 10;
left_wheel_front.velocity[0] = 10;

Is this procedure correct?

alexspi13 gravatar image alexspi13  ( 2021-03-11 14:20:10 -0500 )edit