Dive the BlueROV2 with ArduSub
Confirm that ArduSub in SITL is driving the simulated BlueROV2 (standard configuration, not “heavy”) in MANUAL mode, which means surge, yaw, sway and heave commands are provided via RC channels and ArduSub maps from commands in the body frame to individual thruster commands.
Prerequisites
Set up ArduPilot SITL, through the Iris smoke test.
Steps
All commands are issued within the drydock dev container.
The simulation
Start the ROV sim
source ~/maritime_ws/install/setup.bash
source ~/maritime_ws/thirdparty/setup-ardupilot.sh
gz sim -v4 -r $(ros2 pkg prefix --share bluerov2_gazebo)/worlds/bluerov2_sitl.sdf
If successful, you should see Gazebo sim start with the ROV spawned in a simple underwater environment.
The autopilot (SITL)
source ~/maritime_ws/install/setup.bash
source ~/maritime_ws/thirdparty/setup-ardupilot.sh
AP=$HOME/maritime_ws/thirdparty/ardupilot/Tools/autotest
sim_vehicle.py -v ArduSub -f gazebo-bluerov2 --model JSON --console -w \
--add-param-file=$AP/default_params/sub.parm \
--add-param-file=$(ros2 pkg prefix --share bluerov2_gazebo)/params/bluerov2_sitl.params
Note
Gazebo prints ArduPilot controller has reset once shortly after SITL
connects and then roughly once a minute. This is annoying, but not of concern. (The fix is open upstream as
ardupilot_gazebo#174.)
See troubleshooting notes in Set up ArduPilot SITL.
Verification - teleop via the autopilot
One axis at a time, at the MAVProxy prompt in the autopilot shell.
Forward surge…
mode manual
arm throttle
rc 5 1600
rc <channel> <microseconds> overrides one RC input. Channel 5 is surge, and the channel spans 1100 to 1900; 1500 is neutral.
Send rc all 1500 between checks.
The channel mapping is different from the usual ArduPilot one - of course it is.
ArduSub/Parameters.h overrides it for Sub.
RCMAP |
Channel |
Axis |
|---|---|---|
|
1 |
pitch |
|
2 |
roll |
|
3 |
heave |
|
4 |
yaw |
|
5 |
surge |
|
6 |
sway |
param show RCMAP* confirms.
Directions below are in the vehicle’s own frame, REP 103: x forward, y left, z up.
Command |
Axis |
Expected |
|---|---|---|
|
surge |
moves ahead, without turning or changing depth much |
|
surge |
moves astern |
|
sway |
crabs to starboard (its own right, -y). The sign flips because ArduPilot’s lateral axis is (fwd-right-down) FRD, positive to the right, while REP 103 is positive to the left: a positive lateral command is +y to ArduSub and -y here |
|
yaw |
turns to starboard, clockwise seen from above (negative yaw here). The sign flips for the same reason as sway. |
|
heave |
rises |
|
heave |
sinks |
|
roll |
rolls slightly to starboard (right side down); the two verticals push in opposite directions, and the vehicle’s own stability rights it when released |
|
— |
stops |
|
— |
ends the session |
The verification passes when each RC channel, commanded on its own, produces the motion described above. This is similar to the open-loop experiments without Ardu decribed in [parameters.md]
The sign convention can be confusing, because two coordinate conventions do not agree:
ArduPilot uses x forward, y right, z down - FRD, as in MAVLink’s
MAV_FRAME_BODY_FRD.ROS uses x forward, y left, z up - FLU, per REP 103.
The exmaple commands are a quarter of full stick, but are just exmples.
To see what the autopilot is commanding while you move the sticks, echo the thruster topics:
gz topic -e -t /bluerov2/thruster_1/cmd
gz topic -e -t /bluerov2/thruster_5/cmd
# etc.