Robotics StackExchange | Archived questions

ROS GAZEBO CUSTOM ROBOT

it's a simple and straightforward query, how can i make a custom robot in gazebo simulation? for example all i will have is 4 wheel and a camera, no other sensors, maybe Bluetooth for joypad control.

I wanted to know the process, if anyone can guide me though any direction.

ps: i'm new to ros gazebo

Asked by ridwan on 2020-07-07 12:44:21 UTC

Comments

Answers

Hi @ridwan,

The answer for your question is a bit long.

What you want is to generate a custom robot_description that can be used in the Gazebo simulator. For this you will need to start learning about what a robot_description is and how to generate one that can be used in simulation. For this first step you can start learning about the URDF, "Unified Robot Description Format" that is basically a specific format to describe how your robot looks like. With respect this topic, you should know that Gazebo works with its own description format, that is SDF and that the URDF can be translatable to the native Gazebo format. With the URDF you will be able to genereate all the links corresponding to your robot body and all the joints that will help you to control it and define how each link is joined and behaves. There is a nice tutorial about using URDF in Gazebo here and a huge set of ROS tutorials that works on this here.

Furthermore, when dealing with URDF you will realise that there is too much code and your description can be a mess, for this issue, ROS has a handy XML format named Xacro that allows you to generate a URDF description from a set of macros. For instance, if you have four wheels, instead of using 4 URDF wheels descriptors, you can use only one Xacro macro defining a wheel and instantiate 4 times the wheel to keep the code clean and organized. There is another nice tutorial about this topic here.

Once you have your robot_description you will need to decide how to control your simulated robot. There are several approachs, here I comment two:

  1. You can use a Model plugin. Since you mentioned your robot has 4 wheels, you can implement your own plugin with the proper kinematics or use the Skid Steering Drive plugin from Gazebo that is already implemented.
  2. Another approach is based on using ROS control. For which you will need to set up proper transmissions and PID gains for effort/speed/position controllers. You can check this tutorial about Gazebo interactions with ROS control here.

So there you have it, hope this can help you with your tasks.

Regards.

Asked by Weasfas on 2020-07-08 09:22:20 UTC

Comments

Thanks a lot for giving me response. I will start working on it( studying it). I will update it here when i make progress

Asked by ridwan on 2020-07-08 11:47:03 UTC

hi @Weasfas, I made the model using xacro, now i want to control it using my own set of controls, like i want to control wheels with different value, with Skid Steering Drive, can i do it?

Asked by ridwan on 2020-07-12 04:07:36 UTC

Hi @ridwan,

Of course, you jut need to include the plugin like this in your xacro, And when launched Gazebo will start the plugin.

Asked by Weasfas on 2020-07-12 04:58:48 UTC

@Weasfas, I plugin this:

  <plugin name="skid_steer_drive_controller" filename="libgazebo_ros_skid_steer_drive.so">

<updateRate>100.0</updateRate>
<robotNamespace>/</robotNamespace>
<leftFrontJoint>joint_left_wheel_front</leftFrontJoint>
<rightFrontJoint>joint_right_front_wheel</rightFrontJoint>
<leftRearJoint>joint_left_wheel</leftRearJoint>
<rightRearJoint>joint_right_wheel</rightRearJoint>
<wheelSeparation>0.4</wheelSeparation>
<wheelDiameter>0.2</wheelDiameter>
<robotBaseFrame>link_chassis</robotBaseFrame>
<torque>20</torque>
<topicName>cmd_vel</topicName>
<broadcastTF>false</broadcastTF>

then i can use cmd_vel topic to send linear and angular velocity, and it works like magic thanks to you.

What meant was, how can i control each wheel differently? for example front and back left wheel velocity .5, and right wheel velocity .2

Asked by ridwan on 2020-07-12 05:22:14 UTC

Ah, sure,

To control each wheel independently you will need to implement your own model plugin with 4 different topics to control each wheel, or you can try the ROS control approach I mentioned giving 4 transmision to each wheel with velocity controllers.

Asked by Weasfas on 2020-07-12 09:10:04 UTC

@Weasfas
do u have any examples of transmission, doesn't matter if it is in two wheel? I tired use it but failed to do so.

Asked by ridwan on 2020-07-12 16:40:56 UTC

Yes!,

For instance you can check how this is done in the Summit XL robot that I think it is a similar platform. The robot_description is in here and the wheel/transmission definition here. Then all ROS control things are here,

Asked by Weasfas on 2020-07-13 04:12:18 UTC