Depth control

description of the file depth_controller.py

The class Depth_Control implements a PID controller in order to reach the depth desired.

ROS

Node

depth_controller

Topics

ROS topics subscribed

Message

Description

/BlueRov2/bar30

bluerov_ros_playground/Bar30

Absolute pressure in hPa

/Settings/set_depth

bluerov_ros_playground/Set_depth

Settings for the controller

/Settings/set_target

bluerov_ros_playground/Set_target

Depth to reach, vertical axis goes up

ROS topics published

Message

Description

/Command/depth

Uint16

Pwm send by the controller to the commander

Depth estimation

To estimate current depth the controller gets the absolute pressure from the Bar30 sensor and computes it with hydrostatic equation.

depth=(pp0)/(ρg)depth = -(p - p0) / (ρ * g)

Designation

Meaning

Value

depth

current depth

m

p

pressure measured

Pa

p0

surface pressure

99 000Pa

ρ

water density

1000 kg/m³

g

gravitational acceleration

9.81 kg/m²

PID controller

The PID controller uses the difference between depth calculated and depth desired, but also the derivative and the integrate values to compute a command in the interval [-400,+400]. This command is added to 1500, the pwm neutral of thrusters.

Saturation

A saturation method is added on pwm output before the publication on the command topic in case of a will to limit thruster power.

Send depth target

The depth target is defined by the publication of a Set_target message on the topic /Settings/set_target. This message is shared with the heading and the velocity controller to set their target

Several methods exist to publish the message : the GUI, command line, script, ....

Set_target message :

Units

float64

depth_desired

m

float64

heading_desired

deg

float64

velocity_desired

pwm range[-400,400]

Tune PID and set saturation

PID coefficients and maximum pwm for saturation of the command can be modified in real time by the Set_depth message published on the topic /Settings/set_depth.

Set_depth message

bool

enable_depth_ctrl

uint16

pwm_max

uint32

KI

uint32

KP

uint32

KD

See Commander to know how enable_depth_ctrl is used

Last updated

Was this helpful?