Velocity control
description of velocity_controller.py
Not working as controller because of difficulties to estimate velocity see here. The controller publishes only a constant pwm from the velocity target between [-400,400] plus 1500 to be in [-1100,1900] for thrusters.
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.
Yet if you enable the controller in AUTOMATIC mode, it will send a constant pwm equals to pwm_max - 50 where pwm_max is defined in Set_velocity message published on the topic /Settings/set_velocity
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.
The velocity target in a pwm between [-400,400] that will be added to 1500. There is no PD controller on velocity. The pwm sends is a constant pwm.
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.
These values sent 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_velocity_ctrl
uint16
pwm_max
uint32
KP
uint32
KD
Last updated
Was this helpful?