💡
aColor-BlueRov2
  • aColor-BlueRov2 ROS implementation
  • Topside computer
    • Required configuration
    • File system and ROS architecture
    • Launch ROS implementation
    • ROS-MAVlink bridge
    • Controllers
      • Depth control
      • Heading control
      • Velocity control
      • Gamepad
    • Commander
    • Graphical User Interface (GUI)
      • GUI modification
    • Additional IMUs : client
  • Companion computer
    • Required configuration
    • Additional IMUs : server
  • ArduSub
    • ArduSub parameters
  • MAVlink message
    • Pymavlink
  • Configure new frame
    • Custom Ardusub 3.5
  • Bibliography
    • Bibliography
Powered by GitBook
On this page
  • ROS
  • Node
  • Topics
  • Depth estimation
  • PID controller
  • Saturation
  • Send depth target
  • Tune PID and set saturation

Was this helpful?

  1. Topside computer
  2. Controllers

Depth control

description of the file depth_controller.py

PreviousControllersNextHeading control

Last updated 5 years ago

Was this helpful?

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

In this script, the axis Z for the depth goes up. To reach 1m depth the input must be -1

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=−(p−p0)/(ρ∗g)depth = -(p - p0) / (ρ * 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]

In this script, the axis Z for the depth goes up. To reach 1m depth the input must be -1

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.

These values send are not saved and the controller will get its initial value. To change permanently the values of those parameters you must change it in the code, in the __init__ method.

Set_depth message

bool

enable_depth_ctrl

uint16

pwm_max

uint32

KI

uint32

KP

uint32

KD

See to know how enable_depth_ctrl is used

Commander