Navassistant: Heading
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.
Registers
Register | Values | Function |
NAV_HEADING_CONTROLLER_ACTIVE | Register address | Enables the controller |
NAV_HEADING_CONTROLLER_DEADZONE | PWM value in µs | Deadzone of the input |
NAV_HEADING_CONTROLLER_STEERING_INPUT | Register address | PWM input steering |
NAV_HEADING_CONTROLLER_STEERING_OUTPUT | PWM value in µs | PWM output steering |
PID_STEERING_KP | Decimal | Proportional gain |
PID_STEERING_KI | Decimal | Integral gain |
PID_STEERING_KD | Decimal | Derivative gain |