Gazebo | Ignition | Community
Ask Your Question

How to set wheel joint velocity?

asked 2018-11-07 04:47:27 -0500

niki gravatar image

Hi! I built my differential robot with urdf and I want to control it through cpp. My goal is to set velocity of each wheel joint of the two wheel joints 'manually'. in the github there are the files. Effort file can move the robot only straight. S how can I control the joint wheel velocity

image description image description

edit retag flag offensive close merge delete


Can you describe what you have tried? Have you also checked that your robot model has good collision and inertia values? And, I highly recommend following these tutorials to get started building a robot in Gazebo:

nkoenig gravatar imagenkoenig ( 2018-11-07 09:30:01 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2018-11-07 09:33:57 -0500

chapulina gravatar image

The tutorial on Setting Velocity on Joints and Links has a good overview of some of the options you have using C++.

edit flag offensive delete link more

answered 2018-11-07 15:05:14 -0500

Duckfrost gravatar image

updated 2018-11-07 15:16:39 -0500

I would like to complete in what @chapulina said with a hands on example. I created a two wheel robot and a plugin that implements two of the three methods explained.

Depending on what you want you can use the PID control or the simple one. PID are of course more realistic and perform much better in that sense, but you have the issues related to PIDs, specially gazebo getting really crazy if the values exceed what its physically possible.

If you just want something that moves, then you can use the NON PID option, which is directly moving the joints.

Also remember that if you only want to move a two wheeled robot, you always have the Differential Drive Option. But I understand that explaining how this is done opens the door to move any number of joints.

I created this super simple two wheeled robot: image description

I created a ModelPlugin, here you have the cpp code:


Here you have the model sdf using that plugin:


And here the world that we use:

Here I leave you also the GIT with all the code:

The ROSJECT with the whole project ready to use

And a VIDEO explaining a bit more in detail each element of the plugin.

Hope it helped.

edit flag offensive delete link more


hi thanks for the offered help! I followed your code and I enrolled in the robotignite to attend the tutorials. I try to test your code at my local gazebo but it does not work even though I cahnged the world file so the robot is on the floor at 0.031 and the static is zero (false). Moreover I would be pleased to see a specific tutorial about cpp plug in because I built a controller to go to a specific point in space. So for exaple the input will be x=5, y= 4 and the robot should go there.

niki gravatar imageniki ( 2018-11-20 10:20:29 -0500 )edit

thanks for your instructions. I have a SDF file with some mesh files(.dae file), then I upload mesh file to ROS development studio and follow your video to launch my robot model, but I am unable to implement it with the error of "Unable to load mesh", some model can be written in SDF file with rectangle and cylinder, but my robot model can only be implemented by importing mesh. Could you please give me some advice on the process of how to implement simulation with mesh in RDS? Thx in advance:)

AbnerNiu gravatar imageAbnerNiu ( 2018-12-04 15:56:24 -0500 )edit
Login/Signup to Answer

Question Tools


Asked: 2018-11-07 04:47:27 -0500

Seen: 4,079 times

Last updated: Nov 07 '18