Differential drive plugin

I have a few too many questions. I hope to break it down with the ones that may answer the rest but bear with me.

  1. In the “ROS Control Course”, under Untit 3, I noticed that the gazebo plugin in written seperatly in a .gazebo file unlike in “URDF for robot modelling course” where it was added in the “.urdf” itself. Is there a reason to create a separate file?

My conjecture is that the seperate file “.gazebo” can help us define other controller or sensor plugins, but I feel like that it can be also done in the same “.urdf” file.

  1. How to add a sensor plugin to the robot? I already made a sensor model in the urdf file. How do I add the function of the sensor (aka sensor plugin) to use its data?

  2. Can we have two differential drive plugins used at the same time? To paint a picture, if we have a square robot with 4 wheels parallel to the sides, and the user wants to use each pair of wheels at different situations, does this mean the user needs to define two differential drive plugins or just add a different transmission name for all wheels.

Thank You for taking time to answer

Hello @mamojiz97,

  1. In the “ROS Control Course”, under Unit 3, I noticed that the gazebo plugin in written seperatly in a .gazebo file unlike in “URDF for robot modelling course” where it was added in the “.urdf” itself. Is there a reason to create a separate file?

Your observation are correct. When modeling a robot sometimes the gazebo plugin in written in a .gazebo file and sometime it is added in an .urdf file. The reason for creating a separate .gazebo file for Gazebo plugins is to keep the URDF file focused on describing the robot’s structure and visual appearance while separating simulation-specific details into a dedicated file. This separation helps maintain a clear distinction between the robot’s core description and the additional features required for simulation purposes. Also, when using complementary methods, you can easily implement conditional loading of the robot model for different use cases for instance real hardware or simulation.

but I feel like that it can be also done in the same “.urdf” file.

Correct, you can put Gazebo plugin in the same URDF file if you want, placing then in a different file is just a different approach. At the end where you put your gazebo tags for plugins depends on your requirements and preferences.

  1. How to add a sensor plugin to the robot? I already made a sensor model in the urdf file. How do I add the function of the sensor (aka sensor plugin) to use its data?

I think you mean to say that you made a visual representation of the sensor model as a geometry object or mesh and put it the urdf file and now you want to add the functionality of the sensor in Gazebo, right? To add a sensor plugin you need to add a element inside the element of your URDF file. Here is an example of how these tags are structured (example is for adding a camera sensor plugin):


<sensor name="my_camera" type="camera">
  <!-- Visual representation of the sensor -->
  <visual>
    ...
  </visual>

  <!-- Plugin definition -->
  <plugin name="my_camera_plugin" filename="libgazebo_ros_camera.so">
    ...
  </plugin>
</sensor>

The details are described in the URDF for Robot Modeling Course, Unit 3: Using URDF for Gazebo, Section “2.5 Adding Sensors”.

No, if your robot has two left and right wheels of each side that are driven together the skid steer plugin is more appropriate. The skid steer plugin takes into account the differential speeds between the left and right wheels to calculate the robot’s overall motion and control.

Hope this helps,

Roberto

1 Like

HI @rzegers

Thank You for the prompt reply.

Clearly understood your explanation and will work on it.

Regarding the differential drive plugin, I am guessing I couldn’t explain the picture correctly. Skid Steering Plugin as you mentioned would be for a robot that has two wheels on the left and two wheels on the right, making the pair of wheels parallel to the other pair.
The robot I described has wheels on each side of a square chassis and would look like a plus configuration, the wheels naturally being omni wheels so that two wheels acts as (dummy)ball casters when the robot is moving in one direction.
The aim would be to use the wheels parallel to each other for one direction (x-direction) and the other two parallel wheels for a direction perpendicular (y-direction). This is just a method to eliminate rotation of the robot for turns.

Now, would one have to define differential plugin for the two pairs separately?
Hope that’s clear.

Hello @mamojiz97,

I think understand now. Using two differential drive plugins is probably not what you want. By having two differential drive plugins you will have two different cmd_vel topics and two different odom topics and non of these will give you the correct odom reading. Ideally you only want one cmd_vel topic and one odom topic what reflects how the robot has moved.

I have not personally seen or used a plugin that does what you need. A quick Google search did not yield any relevant results, but that does not mean such a plugin does not exist. It may just require more extensive research to find it. Alternatively, you could also consider creating your own custom Gazebo plugin, if no existing plugin meets your requirements.

What I found so far are Gazebo plugins for 3-Wheeled Omni directional robots:

Regards,

Roberto

1 Like