Home        Store        Docs        Blog

Ardusub simulation (SITL)


Hi @patrickelectric,
I have the same error as @jakkala-kalvik :

[Err] [ArduPilotPlugin.cc:538] [BlueRov2] Please specify a jointName, where the control channel is attached.
[Err] [ArduPilotPlugin.cc:547] [BlueRov2] Couldn't find specified joint []. This plugin will not run.

When running gazebo --verbose worlds/ur.world -u even though I did git clone -b add_link https://github.com/patrickelectric/ardupilot_gazebo when cloning the ardupilot_gazebo package.

git branch -a gives

* add_link
  remotes/origin/HEAD -> origin/master

Any idea what could be wrong? We are supposed to run sitl from another terminal right? Do we need to install anything beside the documentation you gave to run it?
Thanks for your help!

(jakkala kalvik) #22

@monabf Try rebuilding the ardupilot_gazebo package

(Patrick José Pereira) #23

You are not using the add_link branch, please compile and reinstall the package.
Check where the plugin is after the install and from where gazebo is loading it.


I was using the add_link branch, but hadn’t copied the .so files made by ardupilot_gazebo from /usr/lib/x86_64-linux-gnu/gazebo-7.0/plugins to /usr/lib/x86_64-linux-gnu/gazebo-7/plugins after switching to that branch. Now I don’t have the Gazebo error anymore. If @patrickelectric wants it at some point I’ve written down more in-detail documentation on how to install the three plugins.

When I run

cd ~/bluerov_simulation/ardupilot_gazebo
source ~/.bashrc
sim_vehicle.py -f gazebo-bluerov2 -I 0 -j4 -D -L RATBeach --console

from another terminal, I get the error: sim_vehicle.py: command not found. Is there anything else I needed to install to run SITL, apart from the ardupilot_gazebo package ? I’ve built the bluerov_ros_playground package in a catkin workspace, the other two plugins separately outside of it.

(jakkala kalvik) #25

Follow this tutorial to get the sitl first


Then start sim_vehicle.py from ardupilot/ArduSub


Thanks a lot, I installed SITL and now it’s all running. I wrote a precise tutorial if anyone’s interested.

From this point can I set things up to work with ROS ? Otherwise how can I run scripts to communicate with the vehicle ? I was using ArduCopter with the Erle-Robotics tutorial before and I could rosrun scripts that would use the gazebo and mavros topics to set vehicle mode, send it some waypoints etc; it would be great if I could do that here.

(jakkala kalvik) #28

You can use mavros, I made this repo to control the ROV2 with mavros https://github.com/kdkalvik/bluerov-ros-pkg or you can just start qgroundcontrol which will connect to the sitl automatically and move the rover as if its the real thing.


Thanks for your help. I installed your package next to bluerov_ros_playground in my catkin workspace.

However I don’t really know what to do next. I was thinking roslaunch a launch from bluerov_ros_playground which includes your rover apm.launch file? Would you happen to have an example of a script you launch to control the rover, and which folder do you launch it from? Are there any other packages you installed in this workspace/project, like mavros for example?

Also, I think I am stuck at MAV> Waiting for heartbeat from tcp:, sometimes param show or other Mavproxy commands will work but most of the time they won’t.
Sorry for all the questions, I was using ArduCopter with the Erle-Robotics simulations before and I’m trying to recreate something similar in which I could use ROS to control the vehicle in Gazebo and get data from it!

(jakkala kalvik) #30

The waiting thing will stop when you start gazebo and start the simulation. And for my package run

roslaunch rover apm.launch

this will start mavros and then run

roslaunch rover teleop.launch 

This will let you control the rover with a xbox controller but it was mostly just to check if mavros was working properly. If you want to program the rover just launch apm.launch and will see all the mavros topics you will need.(rostopic list)


Thank you so much for your help!

I now have Gazebo, SITL and mavros running, I’ll be able to program the rover using the mavros ropics. However it feels like SITL and Gazebo are not connecting. The SITL terminal still says waiting for heartbeat and does not react to commands, even when Gazebo is up and running. SITL terminal output with Gazebo open in another terminal:

Connect tcp: source_system=255
Failed to load module: No module named adsb. Use 'set moddebug 3' in the MAVProxy console to enable traceback
Loaded module console
Log Directory: 
Telemetry log: mav.tlog
MAV> Waiting for heartbeat from tcp:

Is there any way to know why it is not connecting, any way to see what address Gazebo has for connection? I am using the add_link branch of ardupilot_gazebo like @patrickelectric suggested.

Btw, all steps I ran are provided here if that can help anyone.
Thanks again!

(Patrick José Pereira) #32

This message only appears when SITL is not able to connect with gazebo, after hitting play in gazebo you’ll see:

MAV> MANUAL> Received 792 parameters
Saved 792 parameters to mav.parm

And the console start to show some information, like this one:

If you want to debug gazebo to search for any problem, add --verbose:
gazebo worlds/underwater.world -u --verbose

ArduSub + SITL simulations

Thanks for your help, I did actually just need to hit the play button in Gazebo. Sorry about that, until now I’ve always launched it from ros and never had to manually start playing it ^^
Thank you very much for your help, I’ve updated the tutorial if that can help anyone in the future !


Hi, sorry for all my questions but I have a problem with making the vehicle move. In manual mode I can send manual control to initialize it, I can arm it, but I can’t move it. If I stay in manual mode I can send commands but nothing moves, and if I switch to any other mode the vehicle dives to the bottom. It feels like the thrusters never start. Could you maybe tell me precisely what I should send to mavros for the vehicle to be ready to go, the equivalent of arming + taking off in ArduCopter ?

Thanks for your help!