Heading control
description of the file heading_controller.py
The class Heading_controller implements a PD controller in order to follow the heading desired.
ROS
Node
heading_controller
Topics
ROS topics subscribed
Message
Description
/BlueRov2/imu/attitude
bluerov_ros_playground/Attitude
Yaw in [-Ï€,Ï€]rad
/Settings/set_heading
bluerov_ros_playground/Set_heading
Settings for the controller
/Settings/set_target
bluerov_ros_playground/Set_target
Yaw to follow
ROS topics published
Message
Description
/Command/heading
Uint16
Pwm send by the controller to the commander
Heading estimation
PD controller
The PD controller uses the difference between current yaw and the yaw desired, but also the derivative value to compute a command in the interval [-400,+400]. This command is added to 1500, the pwm neutral of thrusters.
To calculate the command the current yaw and the yaw desired are in [-pi,pi]rad range
Sawtooth
To deal with the 2 PI modulo for angles, difference between yaw desired and current yaw goes through this function sawtooth.
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 heading target
The heading 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 velocity controller to set their target
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_heading message published on the topic /Settings/set_heading.
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_heading message
bool
enable_heading_ctrl
uint16
pwm_max
uint32
KP
uint32
KD
Last updated
Was this helpful?