Velocity control

description of velocity_controller.py

The class Velocity_controller had the aim to implement a PD controller in order to reach the velocity desired but the aim was not reach.

ROS

Node

velocity_controller

Topics

ROS topics subscribed

Message

Description

/imu/imu_raw

sensors_data/imu

X axis acceleration

/Settings/set_velocity

bluerov_ros_playground/Set_velocity

Settings for the controller

/Settings/set_target

bluerov_ros_playground/Set_target

velocity to reach,

ROS topics published

Message

Description

/Command/velocity

Uint16

Pwm send by the controller to the commander

Velocity estimation

To estimate current velocity only from acceleration, it is needed to integrate acceleration values once. However, raw IMU data are noisy and even after the use of filters in the Imu data publisher, errors remain. A drift is then observed over time on the velocity estimation. This script cannot be use as a velocity controller yet.

PD controller

The PD controller use the difference between velocity calculated and velocity desired, but also the derivative and the integrate value to compute a command in the interval [-400,+400]. This command is add to 1500, the pwm neutral of thrusters.

Saturation

A saturation method is added on pwm output before the publication on the command topic in order to limit thruster power.

Send velocity target

The velocity target is defined by the publication of a Set_target message on the topic /Settings/set_target. This message is shared with the depth and the heading 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 PD and set saturation

PD coefficients and maximum pwm for saturation of the command can be modified in real time by the Set_velocity message published on the topic /Settings/set_velocity.

Set_depth message

bool

enable_velocity_ctrl

uint16

pwm_max

uint32

KP

uint32

KD

See Commander to know how enable_velocity_ctrl is used

Last updated

Was this helpful?