Button Inputs in Sub¶
Unlike other vehicles, Sub has its own specialized button functionality. Other vehicles include hardware buttons as described in the Buttons hardware section.
Instead, Sub uses “joystick” buttons associated with the GCS or GCS attached Joystick. The GCS sends frequent button state updates via the MAVLink Manual Control protocol, which includes both motion-axis commands and button states.
Up to 32 buttons can be configured with a host of functions. In addition, by assigning a “shift” button function, each button can execute a “shifted” function, so up to 63 functions can be implemented.
Each button has two parameters:
BTNx_FUNCTION
BTNx_SFUNCTION
The possible values for the function or shifted function are:
Value |
Meaning |
Description |
0 |
Disabled |
Do nothing (button unused by the autopilot). |
1 |
shift |
Modifier to swap other buttons to the “shifted” functions. |
2 |
arm_toggle |
Swap the autopilot’s armed/disarmed state. |
3 |
arm |
Arm the autopilot. |
4 |
disarm |
Disarm the autopilot. |
5 |
mode_manual |
Change to MANUAL flight mode. |
6 |
mode_stabilize |
Change to STABILIZE flight mode. |
7 |
mode_depth_hold |
Change to ALT_HOLD flight mode. |
8 |
mode_poshold |
Change to POSHOLD flight mode. |
9 |
mode_auto |
Change to AUTO flight mode. |
10 |
mode_circle |
Change to CIRCLE flight mode. |
11 |
mode_guided |
Change to GUIDED flight mode. |
12 |
mode_acro |
Change to ACRO flight mode. |
13 |
mode_surftrak |
Change to SURFTRAK flight mode. |
21 |
mount_center |
Move the camera mount to its center orientation. |
22 |
mount_tilt_up |
Tilt (pitch) up the camera mount. |
23 |
mount_tilt_down |
Tilt (pitch) down the camera mount. |
24 |
camera_trigger |
Trigger the camera shutter (NOT IMPLEMENTED). |
25 |
camera_source_toggle |
Toggle between available camera sources (with connected video switch). |
26 |
mount_pan_right |
Pan (yaw) the camera mount to the right. |
27 |
mount_pan_left |
Pan (yaw) the camera mount to the left. |
31 |
lights1_cycle |
Step lights1 (once) brighter/dimmer as part of a cycle between the limits. |
32 |
lights1_brighter |
Step lights1 brighter by the configured step size, up to the output limit. |
33 |
lights1_dimmer |
Step lights1 dimmer by the configured step size, up to the output limit. |
34 |
lights2_cycle |
Step lights2 (once) brighter/dimmer as part of a cycle between the limits. |
35 |
lights2_brighter |
Step lights2 brighter by the configured step size, up to the output limit. |
36 |
lights2_dimmer |
Step lights2 dimmer by the configured step size, up to the output limit. |
41 |
gain_toggle |
Toggle pilot gain between 50% and 100%. |
42 |
gain_inc |
Increment pilot gain by the configured joystick gain step size. |
43 |
gain_dec |
Decrement pilot gain by the configured joystick gain step size. |
44 |
trim_roll_inc |
Increase the roll trim level. |
45 |
trim_roll_dec |
Decrease the roll trim level. |
46 |
trim_pitch_inc |
Increase the pitch trim level. |
47 |
trim_pitch_dec |
Decrease the pitch trim level. |
48 |
input_hold_set |
Toggle holding current joystick axis inputs (cruise control on/off). |
49 |
roll_pitch_toggle |
Toggle between roll/pitch and forward/lateral control on joystick input. |
51 |
relay_1_on |
Set the RELAY1_PIN output to ON. |
52 |
relay_1_off |
Set the RELAY1_PIN output to OFF. |
53 |
relay_1_toggle |
Toggle the RELAY1_PIN output between ON and OFF. |
54 |
relay_2_on |
Set the RELAY2_PIN output to ON. |
55 |
relay_2_off |
Set the RELAY2_PIN output to OFF. |
56 |
relay_2_toggle |
Toggle the RELAY2_PIN output between ON and OFF. |
57 |
relay_3_on |
Set the RELAY3_PIN output to ON. |
58 |
relay_3_off |
Set the RELAY3_PIN output to OFF. |
59 |
relay_3_toggle |
Toggle the RELAY3_PIN output between ON and OFF. |
61 |
servo_1_inc |
Increase actuator 1 (RC9/AUX1 on old firmware). |
62 |
servo_1_dec |
Decrease actuator 1 (RC9/AUX1 on old firmware). |
63 |
servo_1_min |
Set actuator 1 (RC9/AUX1 on old firmware) to its minimum value. |
64 |
servo_1_max |
Set actuator 1 (RC9/AUX1 on old firmware) to its maximum value. |
65 |
servo_1_center |
Set actuator 1 (RC9/AUX1 on old firmware) to its center value. |
66 |
servo_2_inc |
Increase actuator 2 (RC10/AUX2 on old firmware). |
67 |
servo_2_dec |
Decrease actuator 2 (RC10/AUX2 on old firmware). |
68 |
servo_2_min |
Set actuator 2 (RC10/AUX2 on old firmware) to its minimum value. |
69 |
servo_2_max |
Set actuator 2 (RC10/AUX2 on old firmware) to its maximum value. |
70 |
servo_2_center |
Set actuator 2 (RC10/AUX2 on old firmware) to its center value. |
71 |
servo_3_inc |
Increase actuator 3 (RC11/AUX3 on old firmware). |
72 |
servo_3_dec |
Decrease actuator 3 (RC11/AUX3 on old firmware). |
73 |
servo_3_min |
Set actuator 3 (RC11/AUX3 on old firmware) to its minimum value. |
74 |
servo_3_max |
Set actuator 3 (RC11/AUX3on old firmware) to its maximum value. |
75 |
servo_3_center |
Set actuator 3 (RC11/AUX3 on old firmware) to its center value. |
76 |
servo_1_min_momentary |
Set actuator 1 to its minimum value while held, then return to center. |
77 |
servo_1_max_momentary |
Set actuator 1 to its maximum value while held, then return to center. |
78 |
servo_1_min_toggle |
Toggle actuator 1 between its minimum and center values. |
79 |
servo_1_max_toggle |
Toggle actuator 1 between its maximum and center values. |
80 |
servo_2_min_momentary |
Set actuator 2 to its minimum value while held, then return to center. |
81 |
servo_2_max_momentary |
Set actuator 2 to its maximum value while held, then return to center. |
82 |
servo_2_min_toggle |
Toggle actuator 2 between its minimum and center values. |
83 |
servo_2_max_toggle |
Toggle actuator 2 between its maximum and center values. |
84 |
servo_3_min_momentary |
Set actuator 3 to its minimum value while held, then return to center. |
85 |
servo_3_max_momentary |
Set actuator 3 to its maximum value while held, then return to center. |
86 |
servo_3_min_toggle |
Toggle actuator 3 between its minimum and center values. |
87 |
servo_3_max_toggle |
Toggle actuator 3 between its maximum and center values. |
91 |
custom_1 |
Activate custom functionality 1 (if implemented). |
92 |
custom_2 |
Activate custom functionality 2 (if implemented). |
93 |
custom_3 |
Activate custom functionality 3 (if implemented). |
94 |
custom_4 |
Activate custom functionality 4 (if implemented). |
95 |
custom_5 |
Activate custom functionality 5 (if implemented). |
96 |
custom_6 |
Activate custom functionality 6 (if implemented). |
101 |
relay_4_on |
Set the RELAY4_PIN output to ON. |
102 |
relay_4_off |
Set the RELAY4_PIN output to OFF. |
103 |
relay_4_toggle |
Toggle the RELAY4_PIN output between ON and OFF. |
104 |
relay_1_momentary |
Set the RELAY1_PIN output to ON, while the button is held. |
105 |
relay_2_momentary |
Set the RELAY2_PIN output to ON, while the button is held. |
106 |
relay_3_momentary |
Set the RELAY3_PIN output to ON, while the button is held. |
107 |
relay_4_momentary |
Set the RELAY4_PIN output to ON, while the button is held. |
108 |
script_1 |
Register Lua script input 1 as pressed/held. |
109 |
script_2 |
Register Lua script input 2 as pressed/held. |
110 |
script_3 |
Register Lua script input 3 as pressed/held. |
111 |
script_4 |
Register Lua script input 4 as pressed/held. |
See Default Sub Hardware Configuration for the default assignments of button functions.