💡
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
  • Heading estimation
  • PD controller
  • Sawtooth
  • Saturation
  • Send heading target
  • Tune PD and set saturation

Was this helpful?

  1. Topside computer
  2. Controllers

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

The heading targeted must be in [0, 360]deg range where 0 is North, 180 is South

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

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]

The heading targeted must be in [0, 360]deg range where 0 and 360 is North, 180 is South

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

PreviousDepth controlNextVelocity control

Last updated 5 years ago

Was this helpful?

See to know how enable_heading_ctrl is used

Commander