Skip to main content

Navassistant: Heading

info

AHRS Compass required. When not detected, the controller will act as simple passtrough.

Controller

The primary purpose of the controller is to maintain the heading of the vehicle steady.

Input

NAV_HEADING_CONTROLLER_ACTIVE takes an input register, PWM ranging from 1000 µs to 2000 µs. The controller is activated with a PWM signal above 1600 µs. When inactive, there is a passthrough from NAV_HEADING_CONTROLLER_STEERING_INPUT to NAV_HEADING_CONTROLLER_STEERING_OUTPUT. During activation, the actual heading is set as the target value.

NAV_HEADING_CONTROLLER_STEERING_INPUT takes an input register, PWM ranging from 1000 µs to 2000 µs. The steering command determines the intensity of the Z rotation of the vehicle.

Output

NAV_HEADING_CONTROLLER_STEERING_OUTPUT is a PWM value ranging from 1000 µs to 2000 µs. It is a command that is controlled by the integrated PID controller, unless overridden by the NAV_HEADING_CONTROLLER_STEERING_INPUT outside of its deadzone range NAV_HEADING_CONTROLLER_DEADZONE.

Functions

The controller has one customization register: NAV_HEADING_CONTROLLER_DEADZONE in µs in relation to the centered input value of 1500 µs. It determines when the steering value is overridden. By default, it is 10 µs.

When outside the deadzone, the target heading value is updated until the PWM value reenters the deadzone.

The controller has three PID values that can be set: PID_STEERING_KP, PID_STEERING_KI, PID_STEERING_KD.

  • Proportional gain: PID_STEERING_KP = 3.5
  • Integral gain: PID_STEERING_KI = 0.08
  • Derivative gain: PID_STEERING_KD = 0.004

The PID_STEERING_KP gain determines the intensity of the steering command. The larger (heavier) the vehicle, the higher the value should be.

USV Studio

In the USV Studio it is possible to configure the controller by dragging in the "Auto heading" component. Below a minimal configuration example.

The deadzone value has to be changed in the registers view, by default it is set to 10 µs.

USV Studio logic nodes

Registers

Register ValuesFunction
NAV_HEADING_CONTROLLER_ACTIVERegister addressEnables the controller
NAV_HEADING_CONTROLLER_DEADZONEPWM value in µsDeadzone of the input
NAV_HEADING_CONTROLLER_STEERING_INPUTRegister addressPWM input steering
NAV_HEADING_CONTROLLER_STEERING_OUTPUTPWM value in µsPWM output steering
PID_STEERING_KPDecimalProportional gain
PID_STEERING_KIDecimalIntegral gain
PID_STEERING_KDDecimalDerivative gain