RC input and output
ArduSub is designed around two independent concepts of RC Input and RC Output. RC Input is an array of control channels representing pilot inputs like forward and yaw commands. RC Output is an array of channels representing the pulse widths to write to individual servo output pins. Although ArduSub does not support the use of RC receivers, the logic is the same and is applied to joystick inputs instead. Joystick input and RC Input are synonymous in ArduSub.
These are the default channel mappings for RC input:
|9||Lights 1 Level|
|10||Lights 2 Level|
On the Pixhawk, there are 8 main outputs and 6 auxiliary outputs. The main outputs are updated at 200Hz by default (configured via the RC_SPEED parameter), and the auxiliary outputs are always updated at 50Hz. It is important not to connect analog servos to the main outputs, because the very fast update rate can cause the servo to burn itself out.
|Pixhawk Label||Servo Channel|
The Pixhawk 6 'auxiliary' outputs can be configured as either general purpose input/output or PWM output. By default, aux outputs 5 and 6 (SERVO13 and SERVO14) are reserved as GPIO pins to be used for relays, and will not output a pwm signal for other functions. This is configured with the BRD_PWM_COUNT parameter at boot, which determines how many of the auxiliary outputs to configure as PWM outputs (default is 4).
|BRD_PWM_COUNT||Aux pin configuration|
An output must be configured as PWM via the BRD_PWM_COUNT parameter to operate a servo.
The servos can be operated via the mavlink command DO_SET_SERVO. This command can be used to set the output of any servo channel that is not configured as a motor output. This command can conflict with other functions operating on the servo channel like pan/tilt mounts or lights. In order to avoid conflicts, the corresponding SERVOn_FUNCTION parameter should be set to Disabled (0).
Up to three servos can also be operated via joystick button functions. The joystick button functions for *_servo_n will control the output on the Aux n pin (these cannot be remapped like the relay outputs).
|Joystick button function||Aux channel operated|
ArduSub supports control of up to 4 relays. An output must be configured as GPIO via the BRD_PWM_COUNT parameter to operate a relay. The output pin must also be selected for the corresponding RELAY_PIN parameter.
The relays can be operated via the mavlink command DO_SET_RELAY.
Up to three relays can also be operated via joystick button functions.