The following Gazebo plugins are simple but provide a reasonable simulation of underwater motion for the BlueROV2. Following the ROS convention, all of the plugins work with ENU coordinate frames. All of the plugins assume that the surface of the water is at z=0.
The OrcaThrusterPlugin
applies the forces generated by one or more thrusters to the robot frame.
Unlike more complex (and accurate) simulations, the force is assumed to be linear from 0 to some maximum. Force
for each thruster is applied to the attachment point specified in the URDF file. Angular forces from the spinning
propellor are not modeled, nor is the affect of water moving through and around the frame, etc.
In the BlueROV2 the thrusters are driven by ESCs (Electronic Speed Controllers) that take pwm (Pulse Width Modulation)
values, so the input to OrcaThrusterPlugin
is a vector of pwm values that range from 1100 (maximum negative force)
through 1500 (no force) to 1900 (maximum positive force).
In theory the BlueRobotics R3 ESCs don't have a deadzone, so some force is generated for every pwm value except pwm=1500. In my field tests I found that there is a deadzone which varies by ESC and thruster, and the force generated is very small and nonlinear close to the deadzone. To keep things simple the plugin models a single deadzone value for all thrusters: inside the deadzone the force is 0, outside the force is linear from 0 to the maximum.
In summary:
if pwm > 1500 + dz:
force = pos_force * (pwm - 1500 - dz) / (400 - dz)
elif pwm < 1500 - dz:
force = neg_force * (pwm - 1500 + dz) / (400 - dz)
else:
force = 0
The thruster configuration is specified in the URDF file. For the BlueROV2 there are six thrusters:
- two vertical thrusters arranged side-by-side, these apply force in
linear.z
orangular.y
. The angular force is weaker than the buoyancy force, but it can be used to roll the vehicle a bit. - four horizontal thrusters arranged in a vectored configuration, these apply force in
linear.z
,linear.y
andangular.z
.
XML:
Parameter | Type | Default | Notes |
---|---|---|---|
base_link | string | base_link | Name of the base link |
thrust_dz_pwm | int | 35 | Deadzone pwm value |
Per-thruster XML:
Parameter | Type | Default | Notes |
---|---|---|---|
pos_force | double | 50 | Maximum positive force (pwm value is 1900), Newtons |
neg_force | double | 40 | Maximum negative force (pwm value is 1100), Newtons |
origin.xyz | Vector3d | 0 0 0 | Location of thruster relative to base link |
origin.rpy | Vector3d | 0 0 0 | Orientation of thruster relative to base link |
The OrcaBarometerPlugin
wraps the built-in Altimeter
sensor.
Total pressure below the surface is atmospheric pressure plus the weight of the column of water above the robot.
Gravity is 9.8 m/s^2, the Gazebo default.
The temperature is assumed to be 10C in the water and 20C above the surface.
XML:
Parameter | Type | Default | Notes |
---|---|---|---|
atmospheric_pressure | double | 101300 | Atmospheric pressure, Pascals |
baro_link_to_base_link_z | double | 0 | Distance from the baro_link to the base_link, m |
fluid_density | double | 997 | Fluid density, kg/m^3, around 997 for freshwater, 1029 for seawater |
variance | double | 40000 | Barometer variance, Pascals^2 |
The OrcaBuoyancyPlugin
is similar to the built-in BuoyancyPlugin
.
The height of the robot frame is used to gradually reduce the buoyancy as the robot lifts out of the water.
XML:
Parameter | Type | Default | Notes |
---|---|---|---|
base_link | string | base_link | Name of the base link |
center_of_volume | Vector3d | 0 0 0 | Buoyancy force is applied to the center of volume, relative to the base link |
fluid_density | double | 997 | Fluid density, kg/m^3, around 997 for freshwater, 1029 for seawater |
height | double | 0.25 | Height of the robot, m |
volume | double | 0.01 | Volume of the robot, m^3 |
The OrcaDragPlugin
is similar to the drag portion of the built-in LiftDragPlugin
.
XML:
Parameter | Type | Default | Notes |
---|---|---|---|
base_link | string | base_link | Name of the base link |
center_of_mass | Vector3d | 0 0 0 | Drag forces are applied to the center of mass, relative to the base link |
linear_drag | Vector3d | TODO | Linear drag coefficients, TODO units |
angular_drag | Vector3d | TODO | Angular drag coefficients, TODO units |