Skip to main content

pamoja_mavlink/dialect/
enums.rs

1//! A useful subset of the common-dialect enumerations, as named constants.
2//!
3//! MAVLink enum fields ride on the wire as plain integers, so the typed messages store
4//! them as integers and these constants give the common values readable names. They are
5//! grouped by enum; only the values a ground station and an autopilot reach for most often
6//! are included, and any other value a field carries is still valid.
7
8#![allow(missing_docs)]
9
10/// `MAV_TYPE`: the kind of vehicle or component a [`Heartbeat`](super::Heartbeat) describes.
11pub mod mav_type {
12    pub const GENERIC: u8 = 0;
13    pub const FIXED_WING: u8 = 1;
14    pub const QUADROTOR: u8 = 2;
15    pub const COAXIAL: u8 = 3;
16    pub const HELICOPTER: u8 = 4;
17    pub const ANTENNA_TRACKER: u8 = 5;
18    pub const GCS: u8 = 6;
19    pub const HEXAROTOR: u8 = 13;
20    pub const OCTOROTOR: u8 = 14;
21    pub const SUBMARINE: u8 = 12;
22    pub const GROUND_ROVER: u8 = 10;
23    pub const SURFACE_BOAT: u8 = 11;
24    pub const ONBOARD_CONTROLLER: u8 = 18;
25}
26
27/// `MAV_AUTOPILOT`: which autopilot stack a [`Heartbeat`](super::Heartbeat) comes from.
28pub mod mav_autopilot {
29    pub const GENERIC: u8 = 0;
30    pub const ARDUPILOTMEGA: u8 = 3;
31    pub const PX4: u8 = 12;
32    pub const INVALID: u8 = 8;
33}
34
35/// `MAV_STATE`: the system status carried by a [`Heartbeat`](super::Heartbeat).
36pub mod mav_state {
37    pub const UNINIT: u8 = 0;
38    pub const BOOT: u8 = 1;
39    pub const CALIBRATING: u8 = 2;
40    pub const STANDBY: u8 = 3;
41    pub const ACTIVE: u8 = 4;
42    pub const CRITICAL: u8 = 5;
43    pub const EMERGENCY: u8 = 6;
44    pub const POWEROFF: u8 = 7;
45    pub const FLIGHT_TERMINATION: u8 = 8;
46}
47
48/// `MAV_MODE_FLAG`: bits of the base mode field of a [`Heartbeat`](super::Heartbeat).
49pub mod mav_mode_flag {
50    pub const CUSTOM_MODE_ENABLED: u8 = 1;
51    pub const TEST_ENABLED: u8 = 2;
52    pub const AUTO_ENABLED: u8 = 4;
53    pub const GUIDED_ENABLED: u8 = 8;
54    pub const STABILIZE_ENABLED: u8 = 16;
55    pub const HIL_ENABLED: u8 = 32;
56    pub const MANUAL_INPUT_ENABLED: u8 = 64;
57    pub const SAFETY_ARMED: u8 = 128;
58}
59
60/// `MAV_CMD`: command ids for [`CommandLong`](super::CommandLong) and [`CommandInt`](super::CommandInt).
61pub mod mav_cmd {
62    pub const NAV_WAYPOINT: u16 = 16;
63    pub const NAV_LOITER_UNLIM: u16 = 17;
64    pub const NAV_RETURN_TO_LAUNCH: u16 = 20;
65    pub const NAV_LAND: u16 = 21;
66    pub const NAV_TAKEOFF: u16 = 22;
67    pub const DO_SET_MODE: u16 = 176;
68    pub const DO_SET_HOME: u16 = 179;
69    pub const DO_SET_SERVO: u16 = 183;
70    pub const MISSION_START: u16 = 300;
71    pub const COMPONENT_ARM_DISARM: u16 = 400;
72    pub const SET_MESSAGE_INTERVAL: u16 = 511;
73    pub const REQUEST_MESSAGE: u16 = 512;
74}
75
76/// `MAV_RESULT`: the outcome a [`CommandAck`](super::CommandAck) reports.
77pub mod mav_result {
78    pub const ACCEPTED: u8 = 0;
79    pub const TEMPORARILY_REJECTED: u8 = 1;
80    pub const DENIED: u8 = 2;
81    pub const UNSUPPORTED: u8 = 3;
82    pub const FAILED: u8 = 4;
83    pub const IN_PROGRESS: u8 = 5;
84    pub const CANCELED: u8 = 6;
85}
86
87/// `MAV_MISSION_RESULT`: the outcome a [`MissionAck`](super::MissionAck) reports.
88pub mod mav_mission_result {
89    pub const ACCEPTED: u8 = 0;
90    pub const ERROR: u8 = 1;
91    pub const UNSUPPORTED_FRAME: u8 = 2;
92    pub const UNSUPPORTED: u8 = 3;
93    pub const NO_SPACE: u8 = 4;
94    pub const INVALID: u8 = 5;
95    pub const INVALID_PARAM1: u8 = 6;
96    pub const INVALID_PARAM2: u8 = 7;
97    pub const INVALID_PARAM3: u8 = 8;
98    pub const INVALID_PARAM4: u8 = 9;
99    pub const INVALID_PARAM5_X: u8 = 10;
100    pub const INVALID_PARAM6_Y: u8 = 11;
101    pub const INVALID_PARAM7: u8 = 12;
102    pub const INVALID_SEQUENCE: u8 = 13;
103    pub const DENIED: u8 = 14;
104    pub const OPERATION_CANCELLED: u8 = 15;
105}
106
107/// `MAV_FRAME`: the coordinate frame of a mission item or position target.
108pub mod mav_frame {
109    pub const GLOBAL: u8 = 0;
110    pub const LOCAL_NED: u8 = 1;
111    pub const MISSION: u8 = 2;
112    pub const GLOBAL_RELATIVE_ALT: u8 = 3;
113    pub const GLOBAL_INT: u8 = 5;
114    pub const GLOBAL_RELATIVE_ALT_INT: u8 = 6;
115}
116
117/// `MAV_MISSION_TYPE`: which plan a mission transfer carries, in the `mission_type` field of
118/// the MISSION_* messages.
119pub mod mav_mission_type {
120    pub const MISSION: u8 = 0;
121    pub const FENCE: u8 = 1;
122    pub const RALLY: u8 = 2;
123    pub const ALL: u8 = 255;
124}
125
126/// `POSITION_TARGET_TYPEMASK`: the bits of the `type_mask` field of
127/// [`SetPositionTargetLocalNed`](super::SetPositionTargetLocalNed) and
128/// [`SetPositionTargetGlobalInt`](super::SetPositionTargetGlobalInt).
129///
130/// A set bit tells the vehicle to ignore that dimension of the setpoint, so a position-only
131/// setpoint sets the velocity, acceleration, yaw, and yaw-rate ignore bits. `FORCE_SET`
132/// reinterprets the acceleration fields as a force setpoint.
133pub mod position_target_typemask {
134    pub const X_IGNORE: u16 = 1;
135    pub const Y_IGNORE: u16 = 2;
136    pub const Z_IGNORE: u16 = 4;
137    pub const VX_IGNORE: u16 = 8;
138    pub const VY_IGNORE: u16 = 16;
139    pub const VZ_IGNORE: u16 = 32;
140    pub const AX_IGNORE: u16 = 64;
141    pub const AY_IGNORE: u16 = 128;
142    pub const AZ_IGNORE: u16 = 256;
143    pub const FORCE_SET: u16 = 512;
144    pub const YAW_IGNORE: u16 = 1024;
145    pub const YAW_RATE_IGNORE: u16 = 2048;
146}