Simulating multiple robots in Gazebo through MATLAB/Simulink

I am new to matlab/simulink and gazebo and am looking to set up a multiple robot gazebo environment. The examples provided in the website go through the multiple robot simulations (in warehouse environment) in simulink, but the simulations were not on Gazebo.
Any help would be highly appreciated.. Thank you

Answers (2)

Hi,
You can use gazebo co-simulation to get the desired Implementation. This document explains how to setup gazebo co-sim. This example shows how to simulate a Differential Drive Robot in Gazebo via Simulink
You can refer to this document for the functions and examples related to gazebo co-sim.
Hope this helps !!

5 Comments

These include examples for just one robot. Would you recommend adding two models within one simulink window to get multiple robots?
Also, would each robot have a different ip address? If so, how would I be able to have two ip addresses within one virtual machine?
No, you do not need 2 ip addresses. You will be having different topics for each robot. You can publish on each of the topic to get the desired results. It won't be a problem adding more than 1 robot to same gazebo world and simulating it from same simulink model.
For eg - robot1/left_wheel and robot2/left_wheel. Applying torque on first will move the first robot and on second will move the second robot.
Hello everyone!
I tried to use 6 robots in one single simulink sheet as @Amrtanshu Raj suggested but unfortunately only one robot moves (all can move if simulated alone so I don't think the problem is in my code). I can read the the poses of all the robots ( except for the moving robot, they remain in their initial position...) therefore I suppose the problem is in the actuation commands. I am using the same torque commands and wheel speed and pose measurements of the example Control a Differential Drive Robot in Gazebo with Simulink (see the attached figs of the general scheme and the one relative to a single robot).
Has anyone managed to run a simulation with multiple robots using this simulink gazebo co-simulation?
Any help would be highly appreciated.. Thank you!
P.S. Attached you can also find the gazebo world thet I use to spawn the robots.
Hi, quick question: how do you add more than 1 robot to the gazebo empty world in the VMWare (virtual machine for gazebo)?
Thank you!

Sign in to comment.

Hi Antonio,
There is command overriding issue associated with few apply command in multiple robot scenario. We worked on this issue in new releases but this problem exist in older release.
There is workaround that you can do,
1] You have added models <r1> <r2> and so on. This is fine. But, you kept link and joint names same for all models.
e.g. <r1> has <link name='chassis'> and <r2> also has <link name='chassis'>
2] Instead of same link name, if you keep link names different, then there will not be overriding issue.
e.g. <r1> can have <link name='chassisR1'> and <r2> can have <link name='chassisR2'>
This should apply for each joint and link, such that link and joint names should be unique.
With this way, you can use apply/set command for multiple robots. Let me know, if this issue still exist.
Thanks

Products

Release

R2020b

Asked:

on 24 Sep 2020

Commented:

on 19 May 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!