# Ardusub simulation (SITL)

**URL:** <https://discuss.bluerobotics.com/t/ardusub-simulation-sitl/481>\
**Category:** ArduSub\
**Tags:** sitl, simulate\
**Created:** [September 19, 2016, 6:23pm UTC](https://discuss.bluerobotics.com/t/ardusub-simulation-sitl/481 "2016-09-19T18:23:43Z")\
**Posts on this page:** 17\
**Page:** 2

<div class="post-metadata">

**Author:** ![monabf](https://avatars.discourse-cdn.com/v4/letter/m/22d042/32.png) [@monabf](https://discuss.bluerobotics.com/u/monabf)\
**Post date:** [January 22, 2018, 10:12pm UTC](https://discuss.bluerobotics.com/t/ardusub-simulation-sitl/481/21 "2018-01-22T22:12:22Z")

</div>

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
  remotes/origin/add_link
  remotes/origin/dirty
  remotes/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!

---

<div class="post-metadata">

**Author:** ![jakkala-kalvik](https://avatars.discourse-cdn.com/v4/letter/j/aeb1de/32.png) [@jakkala-kalvik](https://discuss.bluerobotics.com/u/jakkala-kalvik)\
**Post date:** [January 22, 2018, 10:26pm UTC](https://discuss.bluerobotics.com/t/ardusub-simulation-sitl/481/22 "2018-01-22T22:26:40Z")

</div>

@monabf Try rebuilding the ardupilot\_gazebo package

---

<div class="post-metadata">

**Author:** ![patrickelectric](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/patrickelectric/32/2162_2.png) [@patrickelectric](https://discuss.bluerobotics.com/u/patrickelectric)\
**Post date:** [January 23, 2018, 12:34am UTC](https://discuss.bluerobotics.com/t/ardusub-simulation-sitl/481/23 "2018-01-23T00:34:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![monabf](https://avatars.discourse-cdn.com/v4/letter/m/22d042/32.png) [@monabf](https://discuss.bluerobotics.com/u/monabf)\
**Post date:** [January 23, 2018, 3:28pm UTC](https://discuss.bluerobotics.com/t/ardusub-simulation-sitl/481/24 "2018-01-23T15:28:37Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jakkala-kalvik](https://avatars.discourse-cdn.com/v4/letter/j/aeb1de/32.png) [@jakkala-kalvik](https://discuss.bluerobotics.com/u/jakkala-kalvik)\
**Post date:** [January 23, 2018, 6:16pm UTC](https://discuss.bluerobotics.com/t/ardusub-simulation-sitl/481/25 "2018-01-23T18:16:12Z")

</div>

Follow this tutorial to get the sitl first

```
http://ardupilot.org/dev/docs/setting-up-sitl-on-linux.html 

```

Then start sim\_vehicle.py from ardupilot/ArduSub

---

<div class="post-metadata">

**Author:** ![monabf](https://avatars.discourse-cdn.com/v4/letter/m/22d042/32.png) [@monabf](https://discuss.bluerobotics.com/u/monabf)\
**Post date:** [January 23, 2018, 7:08pm UTC](https://discuss.bluerobotics.com/t/ardusub-simulation-sitl/481/27 "2018-01-23T19:08:11Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jakkala-kalvik](https://avatars.discourse-cdn.com/v4/letter/j/aeb1de/32.png) [@jakkala-kalvik](https://discuss.bluerobotics.com/u/jakkala-kalvik)\
**Post date:** [January 23, 2018, 7:26pm UTC](https://discuss.bluerobotics.com/t/ardusub-simulation-sitl/481/28 "2018-01-23T19:26:42Z")

</div>

You can use mavros, I made this repo to control the ROV2 with mavros [GitHub - kdkalvik/bluerov-ros-pkg: A set of ROS package for the BlueROV and ArduSub compatible vehicles.](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.

---

<div class="post-metadata">

**Author:** ![monabf](https://avatars.discourse-cdn.com/v4/letter/m/22d042/32.png) [@monabf](https://discuss.bluerobotics.com/u/monabf)\
**Post date:** [January 23, 2018, 10:02pm UTC](https://discuss.bluerobotics.com/t/ardusub-simulation-sitl/481/29 "2018-01-23T22:02:06Z")

</div>

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:127.0.0.1:5760`, 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](http://docs.erlerobotics.com/simulation/vehicles/erle_copter/tutorial_1) 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!

---

<div class="post-metadata">

**Author:** ![jakkala-kalvik](https://avatars.discourse-cdn.com/v4/letter/j/aeb1de/32.png) [@jakkala-kalvik](https://discuss.bluerobotics.com/u/jakkala-kalvik)\
**Post date:** [January 23, 2018, 11:52pm UTC](https://discuss.bluerobotics.com/t/ardusub-simulation-sitl/481/30 "2018-01-23T23:52:02Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![monabf](https://avatars.discourse-cdn.com/v4/letter/m/22d042/32.png) [@monabf](https://discuss.bluerobotics.com/u/monabf)\
**Post date:** [January 24, 2018, 3:37pm UTC](https://discuss.bluerobotics.com/t/ardusub-simulation-sitl/481/31 "2018-01-24T15:37:58Z")

</div>

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:127.0.0.1:5760 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:127.0.0.1:5760

```

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](https://gist.github.com/monabf/bc04b7ab366f812c645bf0aa6f22c8de) if that can help anyone.  
Thanks again!

---

<div class="post-metadata">

**Author:** ![patrickelectric](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/patrickelectric/32/2162_2.png) [@patrickelectric](https://discuss.bluerobotics.com/u/patrickelectric)\
**Post date:** [January 24, 2018, 7:13pm UTC](https://discuss.bluerobotics.com/t/ardusub-simulation-sitl/481/32 "2018-01-24T19:13:20Z")

</div>

> [@monabf](#):
>
> MAV\> Waiting for heartbeat from tcp:127.0.0.1:5760

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

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

```

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

 ![Screenshot%20from%202018-01-24%2011-08-10](https://us1.discourse-cdn.com/flex019/uploads/bluerobotics/original/2X/f/f313894229dedee904df9f97141fa0bf09ed623b.png)

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

---

<div class="post-metadata">

**Author:** ![monabf](https://avatars.discourse-cdn.com/v4/letter/m/22d042/32.png) [@monabf](https://discuss.bluerobotics.com/u/monabf)\
**Post date:** [January 24, 2018, 7:40pm UTC](https://discuss.bluerobotics.com/t/ardusub-simulation-sitl/481/33 "2018-01-24T19:40:13Z")

</div>

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](https://gist.github.com/monabf/bc04b7ab366f812c645bf0aa6f22c8de) if that can help anyone in the future !

---

<div class="post-metadata">

**Author:** ![monabf](https://avatars.discourse-cdn.com/v4/letter/m/22d042/32.png) [@monabf](https://discuss.bluerobotics.com/u/monabf)\
**Post date:** [January 26, 2018, 2:51pm UTC](https://discuss.bluerobotics.com/t/ardusub-simulation-sitl/481/34 "2018-01-26T14:51:15Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![oga13](https://avatars.discourse-cdn.com/v4/letter/o/a698b9/32.png) [@oga13](https://discuss.bluerobotics.com/u/oga13)\
**Post date:** [August 22, 2018, 3:54am UTC](https://discuss.bluerobotics.com/t/ardusub-simulation-sitl/481/35 "2018-08-22T03:54:22Z")

</div>

Hi,  
Just wanted to share a work I did recently  
BlueROV SITL demo with DroneSimLab.

[![](https://us1.discourse-cdn.com/flex019/uploads/bluerobotics/original/2X/5/58a393a0bc9ad3c3428f03463bb80b2fe23a117a.jpeg "bluerov2 SITL with DroneSimLab") ](https://www.youtube.com/watch?v=zoSgZ6T8fT8)

---

<div class="post-metadata">

**Author:** ![jwalser](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/jwalser/32/2234_2.png) [@jwalser](https://discuss.bluerobotics.com/u/jwalser)\
**Post date:** [August 22, 2018, 2:59pm UTC](https://discuss.bluerobotics.com/t/ardusub-simulation-sitl/481/36 "2018-08-22T14:59:23Z")

</div>

> [@monabf](#):
>
> If I stay in manual mode I can send commands but nothing moves,

What commands are you sending?  
Please post the commands/entries and output so that we can determine the problem. Everything works fine here.

---

<div class="post-metadata">

**Author:** ![monabf](https://avatars.discourse-cdn.com/v4/letter/m/22d042/32.png) [@monabf](https://discuss.bluerobotics.com/u/monabf)\
**Post date:** [August 22, 2018, 11:37pm UTC](https://discuss.bluerobotics.com/t/ardusub-simulation-sitl/481/38 "2018-08-22T23:37:09Z")

</div>

That problem was a long time ago, I don’t remember what I did but it ended up working ok and I was able to use all modes in the simulations ! I think it was something like needing to arm in Manual mode and send some manual controls before going into another mode or something like that.

---

<div class="post-metadata">

**Author:** ![hakim](https://avatars.discourse-cdn.com/v4/letter/h/97f17d/32.png) [@hakim](https://discuss.bluerobotics.com/u/hakim)\
**Post date:** [July 18, 2022, 1:09pm UTC](https://discuss.bluerobotics.com/t/ardusub-simulation-sitl/481/39 "2022-07-18T13:09:25Z")

</div>

I have the same problem. The ROV was sinking when armed and set the mode to guided. How did you manage to solve this issue?

[Previous page](https://discuss.bluerobotics.com/t/ardusub-simulation-sitl/481.md?page=1)
