Ardusub simulation (SITL)

That was the issue. Its working now. I have one last question though. In order to get the sitl working with a custom frame will it be enough to update the Frame_Vectored.h file in ardupilot/libraries/SITL ?

Sorry about this, I’ll update the documentation to make it more explicit.

If you want to contribute with ArduSub and our new SITL environment, the best choice is to create a new file with your frame in this same repository, we’ll be happy to have more options to simulate ArduSub in SITL. I and @jwalser can continue this in personal message to help with this approach.

But, if you want only to test your model:

  1. Modify the Frame_Vectored.h.
  2. Add more two thrusters and channels in the BlueRov2 Gazebo model, like this one and more two channels here.
  3. and finallly some modification in SIM_Submarine.

Thanks. I will get back to you on gitter.

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!

@monabf Try rebuilding the ardupilot_gazebo package

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.

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

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.

1 Like

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. 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: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 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!

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: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 if that can help anyone.
Thanks again!

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

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!

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

5 Likes

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

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.

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?