diff --git a/pkg/dialects/all/dialect.go b/pkg/dialects/all/dialect.go index 69aa197da..ab3c408be 100644 --- a/pkg/dialects/all/dialect.go +++ b/pkg/dialects/all/dialect.go @@ -229,6 +229,9 @@ var dial = &dialect.Dialect{ &MessageCurrentEventSequence{}, &MessageRequestEvent{}, &MessageResponseEventError{}, + &MessageAvailableModes{}, + &MessageCurrentMode{}, + &MessageAvailableModesMonitor{}, &MessageIlluminatorStatus{}, &MessageCanfdFrame{}, &MessageCanFilterModify{}, @@ -366,9 +369,6 @@ var dial = &dialect.Dialect{ &MessageGroupStart{}, &MessageGroupEnd{}, &MessageRadioRcChannels{}, - &MessageAvailableModes{}, - &MessageCurrentMode{}, - &MessageAvailableModesMonitor{}, &MessageGnssIntegrity{}, &MessageTargetAbsolute{}, &MessageTargetRelative{}, diff --git a/pkg/dialects/all/enum_mav_cmd.go b/pkg/dialects/all/enum_mav_cmd.go index b0c4159f0..85210411c 100644 --- a/pkg/dialects/all/enum_mav_cmd.go +++ b/pkg/dialects/all/enum_mav_cmd.go @@ -203,6 +203,10 @@ const ( MAV_CMD_OVERRIDE_GOTO MAV_CMD = 252 // Mission command to set a Camera Auto Mount Pivoting Oblique Survey (Replaces CAM_TRIGG_DIST for this purpose). The camera is triggered each time this distance is exceeded, then the mount moves to the next position. Params 4~6 set-up the angle limits and number of positions for oblique survey, where mount-enabled vehicles automatically roll the camera between shots to emulate an oblique camera setup (providing an increased HFOV). This command can also be used to set the shutter integration time for the camera. MAV_CMD_OBLIQUE_SURVEY MAV_CMD = 260 + // Enable the specified standard MAVLink mode. + // If the specified mode is not supported, the vehicle should ACK with MAV_RESULT_FAILED. + // See https://mavlink.io/en/services/standard_modes.html + MAV_CMD_DO_SET_STANDARD_MODE MAV_CMD = 262 // start running a mission MAV_CMD_MISSION_START MAV_CMD = 300 // Actuator testing command. This is similar to MAV_CMD_DO_MOTOR_TEST but operates on the level of output functions, i.e. it is possible to test Motor1 independent from which output it is configured on. Autopilots typically refuse this command while armed. @@ -482,9 +486,6 @@ const ( // The system doing the upgrade will report progress using the normal command protocol sequence for a long running operation. // Command protocol information: https://mavlink.io/en/services/command.html. MAV_CMD_DO_UPGRADE MAV_CMD = 247 - // Enable the specified standard MAVLink mode. - // If the mode is not supported the vehicle should ACK with MAV_RESULT_FAILED. - MAV_CMD_DO_SET_STANDARD_MODE MAV_CMD = 262 // Allows setting an AT S command of an SiK radio. MAV_CMD_SET_AT_S_PARAM MAV_CMD = 550 // Set system and component id. @@ -626,6 +627,7 @@ var labels_MAV_CMD = map[MAV_CMD]string{ MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN: "MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN", MAV_CMD_OVERRIDE_GOTO: "MAV_CMD_OVERRIDE_GOTO", MAV_CMD_OBLIQUE_SURVEY: "MAV_CMD_OBLIQUE_SURVEY", + MAV_CMD_DO_SET_STANDARD_MODE: "MAV_CMD_DO_SET_STANDARD_MODE", MAV_CMD_MISSION_START: "MAV_CMD_MISSION_START", MAV_CMD_ACTUATOR_TEST: "MAV_CMD_ACTUATOR_TEST", MAV_CMD_CONFIGURE_ACTUATOR: "MAV_CMD_CONFIGURE_ACTUATOR", @@ -747,7 +749,6 @@ var labels_MAV_CMD = map[MAV_CMD]string{ MAV_CMD_PAYLOAD_CONTROL: "MAV_CMD_PAYLOAD_CONTROL", MAV_CMD_DO_FIGURE_EIGHT: "MAV_CMD_DO_FIGURE_EIGHT", MAV_CMD_DO_UPGRADE: "MAV_CMD_DO_UPGRADE", - MAV_CMD_DO_SET_STANDARD_MODE: "MAV_CMD_DO_SET_STANDARD_MODE", MAV_CMD_SET_AT_S_PARAM: "MAV_CMD_SET_AT_S_PARAM", MAV_CMD_DO_SET_SYS_CMP_ID: "MAV_CMD_DO_SET_SYS_CMP_ID", MAV_CMD_ODID_SET_EMERGENCY: "MAV_CMD_ODID_SET_EMERGENCY", @@ -846,6 +847,7 @@ var values_MAV_CMD = map[string]MAV_CMD{ "MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN": MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN, "MAV_CMD_OVERRIDE_GOTO": MAV_CMD_OVERRIDE_GOTO, "MAV_CMD_OBLIQUE_SURVEY": MAV_CMD_OBLIQUE_SURVEY, + "MAV_CMD_DO_SET_STANDARD_MODE": MAV_CMD_DO_SET_STANDARD_MODE, "MAV_CMD_MISSION_START": MAV_CMD_MISSION_START, "MAV_CMD_ACTUATOR_TEST": MAV_CMD_ACTUATOR_TEST, "MAV_CMD_CONFIGURE_ACTUATOR": MAV_CMD_CONFIGURE_ACTUATOR, @@ -967,7 +969,6 @@ var values_MAV_CMD = map[string]MAV_CMD{ "MAV_CMD_PAYLOAD_CONTROL": MAV_CMD_PAYLOAD_CONTROL, "MAV_CMD_DO_FIGURE_EIGHT": MAV_CMD_DO_FIGURE_EIGHT, "MAV_CMD_DO_UPGRADE": MAV_CMD_DO_UPGRADE, - "MAV_CMD_DO_SET_STANDARD_MODE": MAV_CMD_DO_SET_STANDARD_MODE, "MAV_CMD_SET_AT_S_PARAM": MAV_CMD_SET_AT_S_PARAM, "MAV_CMD_DO_SET_SYS_CMP_ID": MAV_CMD_DO_SET_SYS_CMP_ID, "MAV_CMD_ODID_SET_EMERGENCY": MAV_CMD_ODID_SET_EMERGENCY, diff --git a/pkg/dialects/all/enum_mav_mode_property.go b/pkg/dialects/all/enum_mav_mode_property.go index 9a7cc9084..f2f497819 100644 --- a/pkg/dialects/all/enum_mav_mode_property.go +++ b/pkg/dialects/all/enum_mav_mode_property.go @@ -3,18 +3,18 @@ package all import ( - "github.com/bluenviron/gomavlib/v3/pkg/dialects/development" + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" ) // Mode properties. -type MAV_MODE_PROPERTY = development.MAV_MODE_PROPERTY +type MAV_MODE_PROPERTY = common.MAV_MODE_PROPERTY const ( // If set, this mode is an advanced mode. // For example a rate-controlled manual mode might be advanced, whereas a position-controlled manual mode is not. // A GCS can optionally use this flag to configure the UI for its intended users. - MAV_MODE_PROPERTY_ADVANCED MAV_MODE_PROPERTY = development.MAV_MODE_PROPERTY_ADVANCED + MAV_MODE_PROPERTY_ADVANCED MAV_MODE_PROPERTY = common.MAV_MODE_PROPERTY_ADVANCED // If set, this mode should not be added to the list of selectable modes. // The mode might still be selected by the FC directly (for example as part of a failsafe). - MAV_MODE_PROPERTY_NOT_USER_SELECTABLE MAV_MODE_PROPERTY = development.MAV_MODE_PROPERTY_NOT_USER_SELECTABLE + MAV_MODE_PROPERTY_NOT_USER_SELECTABLE MAV_MODE_PROPERTY = common.MAV_MODE_PROPERTY_NOT_USER_SELECTABLE ) diff --git a/pkg/dialects/all/enum_mav_standard_mode.go b/pkg/dialects/all/enum_mav_standard_mode.go index 9ff7a0226..b0b28b4d1 100644 --- a/pkg/dialects/all/enum_mav_standard_mode.go +++ b/pkg/dialects/all/enum_mav_standard_mode.go @@ -3,18 +3,20 @@ package all import ( - "github.com/bluenviron/gomavlib/v3/pkg/dialects/development" + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" ) // Standard modes with a well understood meaning across flight stacks and vehicle types. // For example, most flight stack have the concept of a "return" or "RTL" mode that takes a vehicle to safety, even though the precise mechanics of this mode may differ. -// Modes may be set using MAV_CMD_DO_SET_STANDARD_MODE. -type MAV_STANDARD_MODE = development.MAV_STANDARD_MODE +// The modes supported by a flight stack can be queried using AVAILABLE_MODES and set using MAV_CMD_DO_SET_STANDARD_MODE. +// The current mode is streamed in CURRENT_MODE. +// See https://mavlink.io/en/services/standard_modes.html +type MAV_STANDARD_MODE = common.MAV_STANDARD_MODE const ( // Non standard mode. // This may be used when reporting the mode if the current flight mode is not a standard mode. - MAV_STANDARD_MODE_NON_STANDARD MAV_STANDARD_MODE = development.MAV_STANDARD_MODE_NON_STANDARD + MAV_STANDARD_MODE_NON_STANDARD MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_NON_STANDARD // Position mode (manual). // Position-controlled and stabilized manual mode. // When sticks are released vehicles return to their level-flight orientation and hold both position and altitude against wind and external forces. @@ -23,7 +25,7 @@ const ( // Hybrid MC/FW ("VTOL") vehicles first transition to multicopter mode (if needed) but otherwise behave in the same way as MC vehicles. // Fixed-wing (FW) vehicles must not support this mode. // Other vehicle types must not support this mode (this may be revisited through the PR process). - MAV_STANDARD_MODE_POSITION_HOLD MAV_STANDARD_MODE = development.MAV_STANDARD_MODE_POSITION_HOLD + MAV_STANDARD_MODE_POSITION_HOLD MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_POSITION_HOLD // Orbit (manual). // Position-controlled and stabilized manual mode. // The vehicle circles around a fixed setpoint in the horizontal plane at a particular radius, altitude, and direction. @@ -32,7 +34,7 @@ const ( // MC and FW vehicles may support this mode. // Hybrid MC/FW ("VTOL") vehicles may support this mode in MC/FW or both modes; if the mode is not supported by the current configuration the vehicle should transition to the supported configuration. // Other vehicle types must not support this mode (this may be revisited through the PR process). - MAV_STANDARD_MODE_ORBIT MAV_STANDARD_MODE = development.MAV_STANDARD_MODE_ORBIT + MAV_STANDARD_MODE_ORBIT MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_ORBIT // Cruise mode (manual). // Position-controlled and stabilized manual mode. // When sticks are released vehicles return to their level-flight orientation and hold their original track against wind and external forces. @@ -40,7 +42,7 @@ const ( // Hybrid MC/FW ("VTOL") vehicles first transition to FW mode (if needed) but otherwise behave in the same way as MC vehicles. // Multicopter (MC) vehicles must not support this mode. // Other vehicle types must not support this mode (this may be revisited through the PR process). - MAV_STANDARD_MODE_CRUISE MAV_STANDARD_MODE = development.MAV_STANDARD_MODE_CRUISE + MAV_STANDARD_MODE_CRUISE MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_CRUISE // Altitude hold (manual). // Altitude-controlled and stabilized manual mode. // When sticks are released vehicles return to their level-flight orientation and hold their altitude. @@ -48,23 +50,23 @@ const ( // FW vehicles continue with current heading, but may be moved off-track by wind. // Hybrid MC/FW ("VTOL") vehicles behave according to their current configuration/mode (FW or MC). // Other vehicle types must not support this mode (this may be revisited through the PR process). - MAV_STANDARD_MODE_ALTITUDE_HOLD MAV_STANDARD_MODE = development.MAV_STANDARD_MODE_ALTITUDE_HOLD + MAV_STANDARD_MODE_ALTITUDE_HOLD MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_ALTITUDE_HOLD // Safe recovery mode (auto). // Automatic mode that takes vehicle to a predefined safe location via a safe flight path, and may also automatically land the vehicle. // This mode is more commonly referred to as RTL and/or or Smart RTL. // The precise return location, flight path, and landing behaviour depend on vehicle configuration and type. // For example, the vehicle might return to the home/launch location, a rally point, or the start of a mission landing, it might follow a direct path, mission path, or breadcrumb path, and land using a mission landing pattern or some other kind of descent. - MAV_STANDARD_MODE_SAFE_RECOVERY MAV_STANDARD_MODE = development.MAV_STANDARD_MODE_SAFE_RECOVERY + MAV_STANDARD_MODE_SAFE_RECOVERY MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_SAFE_RECOVERY // Mission mode (automatic). // Automatic mode that executes MAVLink missions. // Missions are executed from the current waypoint as soon as the mode is enabled. - MAV_STANDARD_MODE_MISSION MAV_STANDARD_MODE = development.MAV_STANDARD_MODE_MISSION + MAV_STANDARD_MODE_MISSION MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_MISSION // Land mode (auto). // Automatic mode that lands the vehicle at the current location. // The precise landing behaviour depends on vehicle configuration and type. - MAV_STANDARD_MODE_LAND MAV_STANDARD_MODE = development.MAV_STANDARD_MODE_LAND + MAV_STANDARD_MODE_LAND MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_LAND // Takeoff mode (auto). // Automatic takeoff mode. // The precise takeoff behaviour depends on vehicle configuration and type. - MAV_STANDARD_MODE_TAKEOFF MAV_STANDARD_MODE = development.MAV_STANDARD_MODE_TAKEOFF + MAV_STANDARD_MODE_TAKEOFF MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_TAKEOFF ) diff --git a/pkg/dialects/all/message_available_modes.go b/pkg/dialects/all/message_available_modes.go index 5c6cf2cf0..c5bff2317 100644 --- a/pkg/dialects/all/message_available_modes.go +++ b/pkg/dialects/all/message_available_modes.go @@ -3,12 +3,14 @@ package all import ( - "github.com/bluenviron/gomavlib/v3/pkg/dialects/development" + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" ) -// Get information about a particular flight modes. -// The message can be enumerated or requested for a particular mode using MAV_CMD_REQUEST_MESSAGE. +// Information about a flight mode. +// The message can be enumerated to get information for all modes, or requested for a particular mode, using MAV_CMD_REQUEST_MESSAGE. // Specify 0 in param2 to request that the message is emitted for all available modes or the specific index for just one mode. // The modes must be available/settable for the current vehicle/frame type. -// Each modes should only be emitted once (even if it is both standard and custom). -type MessageAvailableModes = development.MessageAvailableModes +// Each mode should only be emitted once (even if it is both standard and custom). +// Note that the current mode should be emitted in CURRENT_MODE, and that if the mode list can change then AVAILABLE_MODES_MONITOR must be emitted on first change and subsequently streamed. +// See https://mavlink.io/en/services/standard_modes.html +type MessageAvailableModes = common.MessageAvailableModes diff --git a/pkg/dialects/all/message_available_modes_monitor.go b/pkg/dialects/all/message_available_modes_monitor.go index a8478cdc2..05ed5048e 100644 --- a/pkg/dialects/all/message_available_modes_monitor.go +++ b/pkg/dialects/all/message_available_modes_monitor.go @@ -3,10 +3,11 @@ package all import ( - "github.com/bluenviron/gomavlib/v3/pkg/dialects/development" + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" ) // A change to the sequence number indicates that the set of AVAILABLE_MODES has changed. // A receiver must re-request all available modes whenever the sequence number changes. // This is only emitted after the first change and should then be broadcast at low rate (nominally 0.3 Hz) and on change. -type MessageAvailableModesMonitor = development.MessageAvailableModesMonitor +// See https://mavlink.io/en/services/standard_modes.html +type MessageAvailableModesMonitor = common.MessageAvailableModesMonitor diff --git a/pkg/dialects/all/message_current_mode.go b/pkg/dialects/all/message_current_mode.go index 81b6428dd..5d607ca86 100644 --- a/pkg/dialects/all/message_current_mode.go +++ b/pkg/dialects/all/message_current_mode.go @@ -3,10 +3,11 @@ package all import ( - "github.com/bluenviron/gomavlib/v3/pkg/dialects/development" + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" ) // Get the current mode. // This should be emitted on any mode change, and broadcast at low rate (nominally 0.5 Hz). // It may be requested using MAV_CMD_REQUEST_MESSAGE. -type MessageCurrentMode = development.MessageCurrentMode +// See https://mavlink.io/en/services/standard_modes.html +type MessageCurrentMode = common.MessageCurrentMode diff --git a/pkg/dialects/ardupilotmega/dialect.go b/pkg/dialects/ardupilotmega/dialect.go index eff38e159..cd321c463 100644 --- a/pkg/dialects/ardupilotmega/dialect.go +++ b/pkg/dialects/ardupilotmega/dialect.go @@ -229,6 +229,9 @@ var dial = &dialect.Dialect{ &MessageCurrentEventSequence{}, &MessageRequestEvent{}, &MessageResponseEventError{}, + &MessageAvailableModes{}, + &MessageCurrentMode{}, + &MessageAvailableModesMonitor{}, &MessageIlluminatorStatus{}, &MessageCanfdFrame{}, &MessageCanFilterModify{}, diff --git a/pkg/dialects/ardupilotmega/enum_mav_cmd.go b/pkg/dialects/ardupilotmega/enum_mav_cmd.go index 653ec0db8..f876fc89f 100644 --- a/pkg/dialects/ardupilotmega/enum_mav_cmd.go +++ b/pkg/dialects/ardupilotmega/enum_mav_cmd.go @@ -203,6 +203,10 @@ const ( MAV_CMD_OVERRIDE_GOTO MAV_CMD = 252 // Mission command to set a Camera Auto Mount Pivoting Oblique Survey (Replaces CAM_TRIGG_DIST for this purpose). The camera is triggered each time this distance is exceeded, then the mount moves to the next position. Params 4~6 set-up the angle limits and number of positions for oblique survey, where mount-enabled vehicles automatically roll the camera between shots to emulate an oblique camera setup (providing an increased HFOV). This command can also be used to set the shutter integration time for the camera. MAV_CMD_OBLIQUE_SURVEY MAV_CMD = 260 + // Enable the specified standard MAVLink mode. + // If the specified mode is not supported, the vehicle should ACK with MAV_RESULT_FAILED. + // See https://mavlink.io/en/services/standard_modes.html + MAV_CMD_DO_SET_STANDARD_MODE MAV_CMD = 262 // start running a mission MAV_CMD_MISSION_START MAV_CMD = 300 // Actuator testing command. This is similar to MAV_CMD_DO_MOTOR_TEST but operates on the level of output functions, i.e. it is possible to test Motor1 independent from which output it is configured on. Autopilots typically refuse this command while armed. @@ -550,6 +554,7 @@ var labels_MAV_CMD = map[MAV_CMD]string{ MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN: "MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN", MAV_CMD_OVERRIDE_GOTO: "MAV_CMD_OVERRIDE_GOTO", MAV_CMD_OBLIQUE_SURVEY: "MAV_CMD_OBLIQUE_SURVEY", + MAV_CMD_DO_SET_STANDARD_MODE: "MAV_CMD_DO_SET_STANDARD_MODE", MAV_CMD_MISSION_START: "MAV_CMD_MISSION_START", MAV_CMD_ACTUATOR_TEST: "MAV_CMD_ACTUATOR_TEST", MAV_CMD_CONFIGURE_ACTUATOR: "MAV_CMD_CONFIGURE_ACTUATOR", @@ -750,6 +755,7 @@ var values_MAV_CMD = map[string]MAV_CMD{ "MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN": MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN, "MAV_CMD_OVERRIDE_GOTO": MAV_CMD_OVERRIDE_GOTO, "MAV_CMD_OBLIQUE_SURVEY": MAV_CMD_OBLIQUE_SURVEY, + "MAV_CMD_DO_SET_STANDARD_MODE": MAV_CMD_DO_SET_STANDARD_MODE, "MAV_CMD_MISSION_START": MAV_CMD_MISSION_START, "MAV_CMD_ACTUATOR_TEST": MAV_CMD_ACTUATOR_TEST, "MAV_CMD_CONFIGURE_ACTUATOR": MAV_CMD_CONFIGURE_ACTUATOR, diff --git a/pkg/dialects/ardupilotmega/enum_mav_mode_property.go b/pkg/dialects/ardupilotmega/enum_mav_mode_property.go new file mode 100644 index 000000000..0379a36e0 --- /dev/null +++ b/pkg/dialects/ardupilotmega/enum_mav_mode_property.go @@ -0,0 +1,20 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll,dupl,gocritic +package ardupilotmega + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// Mode properties. +type MAV_MODE_PROPERTY = common.MAV_MODE_PROPERTY + +const ( + // If set, this mode is an advanced mode. + // For example a rate-controlled manual mode might be advanced, whereas a position-controlled manual mode is not. + // A GCS can optionally use this flag to configure the UI for its intended users. + MAV_MODE_PROPERTY_ADVANCED MAV_MODE_PROPERTY = common.MAV_MODE_PROPERTY_ADVANCED + // If set, this mode should not be added to the list of selectable modes. + // The mode might still be selected by the FC directly (for example as part of a failsafe). + MAV_MODE_PROPERTY_NOT_USER_SELECTABLE MAV_MODE_PROPERTY = common.MAV_MODE_PROPERTY_NOT_USER_SELECTABLE +) diff --git a/pkg/dialects/ardupilotmega/enum_mav_standard_mode.go b/pkg/dialects/ardupilotmega/enum_mav_standard_mode.go new file mode 100644 index 000000000..b1a39f338 --- /dev/null +++ b/pkg/dialects/ardupilotmega/enum_mav_standard_mode.go @@ -0,0 +1,72 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll,dupl,gocritic +package ardupilotmega + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// Standard modes with a well understood meaning across flight stacks and vehicle types. +// For example, most flight stack have the concept of a "return" or "RTL" mode that takes a vehicle to safety, even though the precise mechanics of this mode may differ. +// The modes supported by a flight stack can be queried using AVAILABLE_MODES and set using MAV_CMD_DO_SET_STANDARD_MODE. +// The current mode is streamed in CURRENT_MODE. +// See https://mavlink.io/en/services/standard_modes.html +type MAV_STANDARD_MODE = common.MAV_STANDARD_MODE + +const ( + // Non standard mode. + // This may be used when reporting the mode if the current flight mode is not a standard mode. + MAV_STANDARD_MODE_NON_STANDARD MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_NON_STANDARD + // Position mode (manual). + // Position-controlled and stabilized manual mode. + // When sticks are released vehicles return to their level-flight orientation and hold both position and altitude against wind and external forces. + // This mode can only be set by vehicles that can hold a fixed position. + // Multicopter (MC) vehicles actively brake and hold both position and altitude against wind and external forces. + // Hybrid MC/FW ("VTOL") vehicles first transition to multicopter mode (if needed) but otherwise behave in the same way as MC vehicles. + // Fixed-wing (FW) vehicles must not support this mode. + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_POSITION_HOLD MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_POSITION_HOLD + // Orbit (manual). + // Position-controlled and stabilized manual mode. + // The vehicle circles around a fixed setpoint in the horizontal plane at a particular radius, altitude, and direction. + // Flight stacks may further allow manual control over the setpoint position, radius, direction, speed, and/or altitude of the circle, but this is not mandated. + // Flight stacks may support the [MAV_CMD_DO_ORBIT](https://mavlink.io/en/messages/common.html#MAV_CMD_DO_ORBIT) for changing the orbit parameters. + // MC and FW vehicles may support this mode. + // Hybrid MC/FW ("VTOL") vehicles may support this mode in MC/FW or both modes; if the mode is not supported by the current configuration the vehicle should transition to the supported configuration. + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_ORBIT MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_ORBIT + // Cruise mode (manual). + // Position-controlled and stabilized manual mode. + // When sticks are released vehicles return to their level-flight orientation and hold their original track against wind and external forces. + // Fixed-wing (FW) vehicles level orientation and maintain current track and altitude against wind and external forces. + // Hybrid MC/FW ("VTOL") vehicles first transition to FW mode (if needed) but otherwise behave in the same way as MC vehicles. + // Multicopter (MC) vehicles must not support this mode. + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_CRUISE MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_CRUISE + // Altitude hold (manual). + // Altitude-controlled and stabilized manual mode. + // When sticks are released vehicles return to their level-flight orientation and hold their altitude. + // MC vehicles continue with existing momentum and may move with wind (or other external forces). + // FW vehicles continue with current heading, but may be moved off-track by wind. + // Hybrid MC/FW ("VTOL") vehicles behave according to their current configuration/mode (FW or MC). + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_ALTITUDE_HOLD MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_ALTITUDE_HOLD + // Safe recovery mode (auto). + // Automatic mode that takes vehicle to a predefined safe location via a safe flight path, and may also automatically land the vehicle. + // This mode is more commonly referred to as RTL and/or or Smart RTL. + // The precise return location, flight path, and landing behaviour depend on vehicle configuration and type. + // For example, the vehicle might return to the home/launch location, a rally point, or the start of a mission landing, it might follow a direct path, mission path, or breadcrumb path, and land using a mission landing pattern or some other kind of descent. + MAV_STANDARD_MODE_SAFE_RECOVERY MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_SAFE_RECOVERY + // Mission mode (automatic). + // Automatic mode that executes MAVLink missions. + // Missions are executed from the current waypoint as soon as the mode is enabled. + MAV_STANDARD_MODE_MISSION MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_MISSION + // Land mode (auto). + // Automatic mode that lands the vehicle at the current location. + // The precise landing behaviour depends on vehicle configuration and type. + MAV_STANDARD_MODE_LAND MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_LAND + // Takeoff mode (auto). + // Automatic takeoff mode. + // The precise takeoff behaviour depends on vehicle configuration and type. + MAV_STANDARD_MODE_TAKEOFF MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_TAKEOFF +) diff --git a/pkg/dialects/ardupilotmega/message_available_modes.go b/pkg/dialects/ardupilotmega/message_available_modes.go new file mode 100644 index 000000000..8350ed436 --- /dev/null +++ b/pkg/dialects/ardupilotmega/message_available_modes.go @@ -0,0 +1,16 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll +package ardupilotmega + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// Information about a flight mode. +// The message can be enumerated to get information for all modes, or requested for a particular mode, using MAV_CMD_REQUEST_MESSAGE. +// Specify 0 in param2 to request that the message is emitted for all available modes or the specific index for just one mode. +// The modes must be available/settable for the current vehicle/frame type. +// Each mode should only be emitted once (even if it is both standard and custom). +// Note that the current mode should be emitted in CURRENT_MODE, and that if the mode list can change then AVAILABLE_MODES_MONITOR must be emitted on first change and subsequently streamed. +// See https://mavlink.io/en/services/standard_modes.html +type MessageAvailableModes = common.MessageAvailableModes diff --git a/pkg/dialects/ardupilotmega/message_available_modes_monitor.go b/pkg/dialects/ardupilotmega/message_available_modes_monitor.go new file mode 100644 index 000000000..1bbc86d51 --- /dev/null +++ b/pkg/dialects/ardupilotmega/message_available_modes_monitor.go @@ -0,0 +1,13 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll +package ardupilotmega + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// A change to the sequence number indicates that the set of AVAILABLE_MODES has changed. +// A receiver must re-request all available modes whenever the sequence number changes. +// This is only emitted after the first change and should then be broadcast at low rate (nominally 0.3 Hz) and on change. +// See https://mavlink.io/en/services/standard_modes.html +type MessageAvailableModesMonitor = common.MessageAvailableModesMonitor diff --git a/pkg/dialects/ardupilotmega/message_current_mode.go b/pkg/dialects/ardupilotmega/message_current_mode.go new file mode 100644 index 000000000..4fba947fa --- /dev/null +++ b/pkg/dialects/ardupilotmega/message_current_mode.go @@ -0,0 +1,13 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll +package ardupilotmega + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// Get the current mode. +// This should be emitted on any mode change, and broadcast at low rate (nominally 0.5 Hz). +// It may be requested using MAV_CMD_REQUEST_MESSAGE. +// See https://mavlink.io/en/services/standard_modes.html +type MessageCurrentMode = common.MessageCurrentMode diff --git a/pkg/dialects/asluav/dialect.go b/pkg/dialects/asluav/dialect.go index 768ac2055..82fadb803 100644 --- a/pkg/dialects/asluav/dialect.go +++ b/pkg/dialects/asluav/dialect.go @@ -229,6 +229,9 @@ var dial = &dialect.Dialect{ &MessageCurrentEventSequence{}, &MessageRequestEvent{}, &MessageResponseEventError{}, + &MessageAvailableModes{}, + &MessageCurrentMode{}, + &MessageAvailableModesMonitor{}, &MessageIlluminatorStatus{}, &MessageCanfdFrame{}, &MessageCanFilterModify{}, diff --git a/pkg/dialects/asluav/enum_mav_cmd.go b/pkg/dialects/asluav/enum_mav_cmd.go index 8316ab3bb..dabeb6436 100644 --- a/pkg/dialects/asluav/enum_mav_cmd.go +++ b/pkg/dialects/asluav/enum_mav_cmd.go @@ -203,6 +203,10 @@ const ( MAV_CMD_OVERRIDE_GOTO MAV_CMD = 252 // Mission command to set a Camera Auto Mount Pivoting Oblique Survey (Replaces CAM_TRIGG_DIST for this purpose). The camera is triggered each time this distance is exceeded, then the mount moves to the next position. Params 4~6 set-up the angle limits and number of positions for oblique survey, where mount-enabled vehicles automatically roll the camera between shots to emulate an oblique camera setup (providing an increased HFOV). This command can also be used to set the shutter integration time for the camera. MAV_CMD_OBLIQUE_SURVEY MAV_CMD = 260 + // Enable the specified standard MAVLink mode. + // If the specified mode is not supported, the vehicle should ACK with MAV_RESULT_FAILED. + // See https://mavlink.io/en/services/standard_modes.html + MAV_CMD_DO_SET_STANDARD_MODE MAV_CMD = 262 // start running a mission MAV_CMD_MISSION_START MAV_CMD = 300 // Actuator testing command. This is similar to MAV_CMD_DO_MOTOR_TEST but operates on the level of output functions, i.e. it is possible to test Motor1 independent from which output it is configured on. Autopilots typically refuse this command while armed. @@ -487,6 +491,7 @@ var labels_MAV_CMD = map[MAV_CMD]string{ MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN: "MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN", MAV_CMD_OVERRIDE_GOTO: "MAV_CMD_OVERRIDE_GOTO", MAV_CMD_OBLIQUE_SURVEY: "MAV_CMD_OBLIQUE_SURVEY", + MAV_CMD_DO_SET_STANDARD_MODE: "MAV_CMD_DO_SET_STANDARD_MODE", MAV_CMD_MISSION_START: "MAV_CMD_MISSION_START", MAV_CMD_ACTUATOR_TEST: "MAV_CMD_ACTUATOR_TEST", MAV_CMD_CONFIGURE_ACTUATOR: "MAV_CMD_CONFIGURE_ACTUATOR", @@ -656,6 +661,7 @@ var values_MAV_CMD = map[string]MAV_CMD{ "MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN": MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN, "MAV_CMD_OVERRIDE_GOTO": MAV_CMD_OVERRIDE_GOTO, "MAV_CMD_OBLIQUE_SURVEY": MAV_CMD_OBLIQUE_SURVEY, + "MAV_CMD_DO_SET_STANDARD_MODE": MAV_CMD_DO_SET_STANDARD_MODE, "MAV_CMD_MISSION_START": MAV_CMD_MISSION_START, "MAV_CMD_ACTUATOR_TEST": MAV_CMD_ACTUATOR_TEST, "MAV_CMD_CONFIGURE_ACTUATOR": MAV_CMD_CONFIGURE_ACTUATOR, diff --git a/pkg/dialects/asluav/enum_mav_mode_property.go b/pkg/dialects/asluav/enum_mav_mode_property.go new file mode 100644 index 000000000..fc4cf9af7 --- /dev/null +++ b/pkg/dialects/asluav/enum_mav_mode_property.go @@ -0,0 +1,20 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll,dupl,gocritic +package asluav + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// Mode properties. +type MAV_MODE_PROPERTY = common.MAV_MODE_PROPERTY + +const ( + // If set, this mode is an advanced mode. + // For example a rate-controlled manual mode might be advanced, whereas a position-controlled manual mode is not. + // A GCS can optionally use this flag to configure the UI for its intended users. + MAV_MODE_PROPERTY_ADVANCED MAV_MODE_PROPERTY = common.MAV_MODE_PROPERTY_ADVANCED + // If set, this mode should not be added to the list of selectable modes. + // The mode might still be selected by the FC directly (for example as part of a failsafe). + MAV_MODE_PROPERTY_NOT_USER_SELECTABLE MAV_MODE_PROPERTY = common.MAV_MODE_PROPERTY_NOT_USER_SELECTABLE +) diff --git a/pkg/dialects/asluav/enum_mav_standard_mode.go b/pkg/dialects/asluav/enum_mav_standard_mode.go new file mode 100644 index 000000000..837c41eb9 --- /dev/null +++ b/pkg/dialects/asluav/enum_mav_standard_mode.go @@ -0,0 +1,72 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll,dupl,gocritic +package asluav + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// Standard modes with a well understood meaning across flight stacks and vehicle types. +// For example, most flight stack have the concept of a "return" or "RTL" mode that takes a vehicle to safety, even though the precise mechanics of this mode may differ. +// The modes supported by a flight stack can be queried using AVAILABLE_MODES and set using MAV_CMD_DO_SET_STANDARD_MODE. +// The current mode is streamed in CURRENT_MODE. +// See https://mavlink.io/en/services/standard_modes.html +type MAV_STANDARD_MODE = common.MAV_STANDARD_MODE + +const ( + // Non standard mode. + // This may be used when reporting the mode if the current flight mode is not a standard mode. + MAV_STANDARD_MODE_NON_STANDARD MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_NON_STANDARD + // Position mode (manual). + // Position-controlled and stabilized manual mode. + // When sticks are released vehicles return to their level-flight orientation and hold both position and altitude against wind and external forces. + // This mode can only be set by vehicles that can hold a fixed position. + // Multicopter (MC) vehicles actively brake and hold both position and altitude against wind and external forces. + // Hybrid MC/FW ("VTOL") vehicles first transition to multicopter mode (if needed) but otherwise behave in the same way as MC vehicles. + // Fixed-wing (FW) vehicles must not support this mode. + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_POSITION_HOLD MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_POSITION_HOLD + // Orbit (manual). + // Position-controlled and stabilized manual mode. + // The vehicle circles around a fixed setpoint in the horizontal plane at a particular radius, altitude, and direction. + // Flight stacks may further allow manual control over the setpoint position, radius, direction, speed, and/or altitude of the circle, but this is not mandated. + // Flight stacks may support the [MAV_CMD_DO_ORBIT](https://mavlink.io/en/messages/common.html#MAV_CMD_DO_ORBIT) for changing the orbit parameters. + // MC and FW vehicles may support this mode. + // Hybrid MC/FW ("VTOL") vehicles may support this mode in MC/FW or both modes; if the mode is not supported by the current configuration the vehicle should transition to the supported configuration. + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_ORBIT MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_ORBIT + // Cruise mode (manual). + // Position-controlled and stabilized manual mode. + // When sticks are released vehicles return to their level-flight orientation and hold their original track against wind and external forces. + // Fixed-wing (FW) vehicles level orientation and maintain current track and altitude against wind and external forces. + // Hybrid MC/FW ("VTOL") vehicles first transition to FW mode (if needed) but otherwise behave in the same way as MC vehicles. + // Multicopter (MC) vehicles must not support this mode. + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_CRUISE MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_CRUISE + // Altitude hold (manual). + // Altitude-controlled and stabilized manual mode. + // When sticks are released vehicles return to their level-flight orientation and hold their altitude. + // MC vehicles continue with existing momentum and may move with wind (or other external forces). + // FW vehicles continue with current heading, but may be moved off-track by wind. + // Hybrid MC/FW ("VTOL") vehicles behave according to their current configuration/mode (FW or MC). + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_ALTITUDE_HOLD MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_ALTITUDE_HOLD + // Safe recovery mode (auto). + // Automatic mode that takes vehicle to a predefined safe location via a safe flight path, and may also automatically land the vehicle. + // This mode is more commonly referred to as RTL and/or or Smart RTL. + // The precise return location, flight path, and landing behaviour depend on vehicle configuration and type. + // For example, the vehicle might return to the home/launch location, a rally point, or the start of a mission landing, it might follow a direct path, mission path, or breadcrumb path, and land using a mission landing pattern or some other kind of descent. + MAV_STANDARD_MODE_SAFE_RECOVERY MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_SAFE_RECOVERY + // Mission mode (automatic). + // Automatic mode that executes MAVLink missions. + // Missions are executed from the current waypoint as soon as the mode is enabled. + MAV_STANDARD_MODE_MISSION MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_MISSION + // Land mode (auto). + // Automatic mode that lands the vehicle at the current location. + // The precise landing behaviour depends on vehicle configuration and type. + MAV_STANDARD_MODE_LAND MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_LAND + // Takeoff mode (auto). + // Automatic takeoff mode. + // The precise takeoff behaviour depends on vehicle configuration and type. + MAV_STANDARD_MODE_TAKEOFF MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_TAKEOFF +) diff --git a/pkg/dialects/asluav/message_available_modes.go b/pkg/dialects/asluav/message_available_modes.go new file mode 100644 index 000000000..72671937d --- /dev/null +++ b/pkg/dialects/asluav/message_available_modes.go @@ -0,0 +1,16 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll +package asluav + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// Information about a flight mode. +// The message can be enumerated to get information for all modes, or requested for a particular mode, using MAV_CMD_REQUEST_MESSAGE. +// Specify 0 in param2 to request that the message is emitted for all available modes or the specific index for just one mode. +// The modes must be available/settable for the current vehicle/frame type. +// Each mode should only be emitted once (even if it is both standard and custom). +// Note that the current mode should be emitted in CURRENT_MODE, and that if the mode list can change then AVAILABLE_MODES_MONITOR must be emitted on first change and subsequently streamed. +// See https://mavlink.io/en/services/standard_modes.html +type MessageAvailableModes = common.MessageAvailableModes diff --git a/pkg/dialects/asluav/message_available_modes_monitor.go b/pkg/dialects/asluav/message_available_modes_monitor.go new file mode 100644 index 000000000..77feacfe2 --- /dev/null +++ b/pkg/dialects/asluav/message_available_modes_monitor.go @@ -0,0 +1,13 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll +package asluav + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// A change to the sequence number indicates that the set of AVAILABLE_MODES has changed. +// A receiver must re-request all available modes whenever the sequence number changes. +// This is only emitted after the first change and should then be broadcast at low rate (nominally 0.3 Hz) and on change. +// See https://mavlink.io/en/services/standard_modes.html +type MessageAvailableModesMonitor = common.MessageAvailableModesMonitor diff --git a/pkg/dialects/asluav/message_current_mode.go b/pkg/dialects/asluav/message_current_mode.go new file mode 100644 index 000000000..af6215daf --- /dev/null +++ b/pkg/dialects/asluav/message_current_mode.go @@ -0,0 +1,13 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll +package asluav + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// Get the current mode. +// This should be emitted on any mode change, and broadcast at low rate (nominally 0.5 Hz). +// It may be requested using MAV_CMD_REQUEST_MESSAGE. +// See https://mavlink.io/en/services/standard_modes.html +type MessageCurrentMode = common.MessageCurrentMode diff --git a/pkg/dialects/avssuas/dialect.go b/pkg/dialects/avssuas/dialect.go index 3e921af2a..44d00b063 100644 --- a/pkg/dialects/avssuas/dialect.go +++ b/pkg/dialects/avssuas/dialect.go @@ -229,6 +229,9 @@ var dial = &dialect.Dialect{ &MessageCurrentEventSequence{}, &MessageRequestEvent{}, &MessageResponseEventError{}, + &MessageAvailableModes{}, + &MessageCurrentMode{}, + &MessageAvailableModesMonitor{}, &MessageIlluminatorStatus{}, &MessageCanfdFrame{}, &MessageCanFilterModify{}, diff --git a/pkg/dialects/avssuas/enum_mav_cmd.go b/pkg/dialects/avssuas/enum_mav_cmd.go index ee9701358..834c0a02c 100644 --- a/pkg/dialects/avssuas/enum_mav_cmd.go +++ b/pkg/dialects/avssuas/enum_mav_cmd.go @@ -203,6 +203,10 @@ const ( MAV_CMD_OVERRIDE_GOTO MAV_CMD = 252 // Mission command to set a Camera Auto Mount Pivoting Oblique Survey (Replaces CAM_TRIGG_DIST for this purpose). The camera is triggered each time this distance is exceeded, then the mount moves to the next position. Params 4~6 set-up the angle limits and number of positions for oblique survey, where mount-enabled vehicles automatically roll the camera between shots to emulate an oblique camera setup (providing an increased HFOV). This command can also be used to set the shutter integration time for the camera. MAV_CMD_OBLIQUE_SURVEY MAV_CMD = 260 + // Enable the specified standard MAVLink mode. + // If the specified mode is not supported, the vehicle should ACK with MAV_RESULT_FAILED. + // See https://mavlink.io/en/services/standard_modes.html + MAV_CMD_DO_SET_STANDARD_MODE MAV_CMD = 262 // start running a mission MAV_CMD_MISSION_START MAV_CMD = 300 // Actuator testing command. This is similar to MAV_CMD_DO_MOTOR_TEST but operates on the level of output functions, i.e. it is possible to test Motor1 independent from which output it is configured on. Autopilots typically refuse this command while armed. @@ -497,6 +501,7 @@ var labels_MAV_CMD = map[MAV_CMD]string{ MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN: "MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN", MAV_CMD_OVERRIDE_GOTO: "MAV_CMD_OVERRIDE_GOTO", MAV_CMD_OBLIQUE_SURVEY: "MAV_CMD_OBLIQUE_SURVEY", + MAV_CMD_DO_SET_STANDARD_MODE: "MAV_CMD_DO_SET_STANDARD_MODE", MAV_CMD_MISSION_START: "MAV_CMD_MISSION_START", MAV_CMD_ACTUATOR_TEST: "MAV_CMD_ACTUATOR_TEST", MAV_CMD_CONFIGURE_ACTUATOR: "MAV_CMD_CONFIGURE_ACTUATOR", @@ -671,6 +676,7 @@ var values_MAV_CMD = map[string]MAV_CMD{ "MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN": MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN, "MAV_CMD_OVERRIDE_GOTO": MAV_CMD_OVERRIDE_GOTO, "MAV_CMD_OBLIQUE_SURVEY": MAV_CMD_OBLIQUE_SURVEY, + "MAV_CMD_DO_SET_STANDARD_MODE": MAV_CMD_DO_SET_STANDARD_MODE, "MAV_CMD_MISSION_START": MAV_CMD_MISSION_START, "MAV_CMD_ACTUATOR_TEST": MAV_CMD_ACTUATOR_TEST, "MAV_CMD_CONFIGURE_ACTUATOR": MAV_CMD_CONFIGURE_ACTUATOR, diff --git a/pkg/dialects/avssuas/enum_mav_mode_property.go b/pkg/dialects/avssuas/enum_mav_mode_property.go new file mode 100644 index 000000000..95d0f9b62 --- /dev/null +++ b/pkg/dialects/avssuas/enum_mav_mode_property.go @@ -0,0 +1,20 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll,dupl,gocritic +package avssuas + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// Mode properties. +type MAV_MODE_PROPERTY = common.MAV_MODE_PROPERTY + +const ( + // If set, this mode is an advanced mode. + // For example a rate-controlled manual mode might be advanced, whereas a position-controlled manual mode is not. + // A GCS can optionally use this flag to configure the UI for its intended users. + MAV_MODE_PROPERTY_ADVANCED MAV_MODE_PROPERTY = common.MAV_MODE_PROPERTY_ADVANCED + // If set, this mode should not be added to the list of selectable modes. + // The mode might still be selected by the FC directly (for example as part of a failsafe). + MAV_MODE_PROPERTY_NOT_USER_SELECTABLE MAV_MODE_PROPERTY = common.MAV_MODE_PROPERTY_NOT_USER_SELECTABLE +) diff --git a/pkg/dialects/avssuas/enum_mav_standard_mode.go b/pkg/dialects/avssuas/enum_mav_standard_mode.go new file mode 100644 index 000000000..5dc684bb1 --- /dev/null +++ b/pkg/dialects/avssuas/enum_mav_standard_mode.go @@ -0,0 +1,72 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll,dupl,gocritic +package avssuas + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// Standard modes with a well understood meaning across flight stacks and vehicle types. +// For example, most flight stack have the concept of a "return" or "RTL" mode that takes a vehicle to safety, even though the precise mechanics of this mode may differ. +// The modes supported by a flight stack can be queried using AVAILABLE_MODES and set using MAV_CMD_DO_SET_STANDARD_MODE. +// The current mode is streamed in CURRENT_MODE. +// See https://mavlink.io/en/services/standard_modes.html +type MAV_STANDARD_MODE = common.MAV_STANDARD_MODE + +const ( + // Non standard mode. + // This may be used when reporting the mode if the current flight mode is not a standard mode. + MAV_STANDARD_MODE_NON_STANDARD MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_NON_STANDARD + // Position mode (manual). + // Position-controlled and stabilized manual mode. + // When sticks are released vehicles return to their level-flight orientation and hold both position and altitude against wind and external forces. + // This mode can only be set by vehicles that can hold a fixed position. + // Multicopter (MC) vehicles actively brake and hold both position and altitude against wind and external forces. + // Hybrid MC/FW ("VTOL") vehicles first transition to multicopter mode (if needed) but otherwise behave in the same way as MC vehicles. + // Fixed-wing (FW) vehicles must not support this mode. + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_POSITION_HOLD MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_POSITION_HOLD + // Orbit (manual). + // Position-controlled and stabilized manual mode. + // The vehicle circles around a fixed setpoint in the horizontal plane at a particular radius, altitude, and direction. + // Flight stacks may further allow manual control over the setpoint position, radius, direction, speed, and/or altitude of the circle, but this is not mandated. + // Flight stacks may support the [MAV_CMD_DO_ORBIT](https://mavlink.io/en/messages/common.html#MAV_CMD_DO_ORBIT) for changing the orbit parameters. + // MC and FW vehicles may support this mode. + // Hybrid MC/FW ("VTOL") vehicles may support this mode in MC/FW or both modes; if the mode is not supported by the current configuration the vehicle should transition to the supported configuration. + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_ORBIT MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_ORBIT + // Cruise mode (manual). + // Position-controlled and stabilized manual mode. + // When sticks are released vehicles return to their level-flight orientation and hold their original track against wind and external forces. + // Fixed-wing (FW) vehicles level orientation and maintain current track and altitude against wind and external forces. + // Hybrid MC/FW ("VTOL") vehicles first transition to FW mode (if needed) but otherwise behave in the same way as MC vehicles. + // Multicopter (MC) vehicles must not support this mode. + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_CRUISE MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_CRUISE + // Altitude hold (manual). + // Altitude-controlled and stabilized manual mode. + // When sticks are released vehicles return to their level-flight orientation and hold their altitude. + // MC vehicles continue with existing momentum and may move with wind (or other external forces). + // FW vehicles continue with current heading, but may be moved off-track by wind. + // Hybrid MC/FW ("VTOL") vehicles behave according to their current configuration/mode (FW or MC). + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_ALTITUDE_HOLD MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_ALTITUDE_HOLD + // Safe recovery mode (auto). + // Automatic mode that takes vehicle to a predefined safe location via a safe flight path, and may also automatically land the vehicle. + // This mode is more commonly referred to as RTL and/or or Smart RTL. + // The precise return location, flight path, and landing behaviour depend on vehicle configuration and type. + // For example, the vehicle might return to the home/launch location, a rally point, or the start of a mission landing, it might follow a direct path, mission path, or breadcrumb path, and land using a mission landing pattern or some other kind of descent. + MAV_STANDARD_MODE_SAFE_RECOVERY MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_SAFE_RECOVERY + // Mission mode (automatic). + // Automatic mode that executes MAVLink missions. + // Missions are executed from the current waypoint as soon as the mode is enabled. + MAV_STANDARD_MODE_MISSION MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_MISSION + // Land mode (auto). + // Automatic mode that lands the vehicle at the current location. + // The precise landing behaviour depends on vehicle configuration and type. + MAV_STANDARD_MODE_LAND MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_LAND + // Takeoff mode (auto). + // Automatic takeoff mode. + // The precise takeoff behaviour depends on vehicle configuration and type. + MAV_STANDARD_MODE_TAKEOFF MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_TAKEOFF +) diff --git a/pkg/dialects/avssuas/message_available_modes.go b/pkg/dialects/avssuas/message_available_modes.go new file mode 100644 index 000000000..56beb8dae --- /dev/null +++ b/pkg/dialects/avssuas/message_available_modes.go @@ -0,0 +1,16 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll +package avssuas + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// Information about a flight mode. +// The message can be enumerated to get information for all modes, or requested for a particular mode, using MAV_CMD_REQUEST_MESSAGE. +// Specify 0 in param2 to request that the message is emitted for all available modes or the specific index for just one mode. +// The modes must be available/settable for the current vehicle/frame type. +// Each mode should only be emitted once (even if it is both standard and custom). +// Note that the current mode should be emitted in CURRENT_MODE, and that if the mode list can change then AVAILABLE_MODES_MONITOR must be emitted on first change and subsequently streamed. +// See https://mavlink.io/en/services/standard_modes.html +type MessageAvailableModes = common.MessageAvailableModes diff --git a/pkg/dialects/avssuas/message_available_modes_monitor.go b/pkg/dialects/avssuas/message_available_modes_monitor.go new file mode 100644 index 000000000..b6e968478 --- /dev/null +++ b/pkg/dialects/avssuas/message_available_modes_monitor.go @@ -0,0 +1,13 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll +package avssuas + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// A change to the sequence number indicates that the set of AVAILABLE_MODES has changed. +// A receiver must re-request all available modes whenever the sequence number changes. +// This is only emitted after the first change and should then be broadcast at low rate (nominally 0.3 Hz) and on change. +// See https://mavlink.io/en/services/standard_modes.html +type MessageAvailableModesMonitor = common.MessageAvailableModesMonitor diff --git a/pkg/dialects/avssuas/message_current_mode.go b/pkg/dialects/avssuas/message_current_mode.go new file mode 100644 index 000000000..57bc1cba7 --- /dev/null +++ b/pkg/dialects/avssuas/message_current_mode.go @@ -0,0 +1,13 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll +package avssuas + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// Get the current mode. +// This should be emitted on any mode change, and broadcast at low rate (nominally 0.5 Hz). +// It may be requested using MAV_CMD_REQUEST_MESSAGE. +// See https://mavlink.io/en/services/standard_modes.html +type MessageCurrentMode = common.MessageCurrentMode diff --git a/pkg/dialects/common/dialect.go b/pkg/dialects/common/dialect.go index 32cdcf54b..68e261a54 100644 --- a/pkg/dialects/common/dialect.go +++ b/pkg/dialects/common/dialect.go @@ -229,6 +229,9 @@ var dial = &dialect.Dialect{ &MessageCurrentEventSequence{}, &MessageRequestEvent{}, &MessageResponseEventError{}, + &MessageAvailableModes{}, + &MessageCurrentMode{}, + &MessageAvailableModesMonitor{}, &MessageIlluminatorStatus{}, &MessageCanfdFrame{}, &MessageCanFilterModify{}, diff --git a/pkg/dialects/common/enum_mav_cmd.go b/pkg/dialects/common/enum_mav_cmd.go index 222ad6733..d80659f61 100644 --- a/pkg/dialects/common/enum_mav_cmd.go +++ b/pkg/dialects/common/enum_mav_cmd.go @@ -203,6 +203,10 @@ const ( MAV_CMD_OVERRIDE_GOTO MAV_CMD = 252 // Mission command to set a Camera Auto Mount Pivoting Oblique Survey (Replaces CAM_TRIGG_DIST for this purpose). The camera is triggered each time this distance is exceeded, then the mount moves to the next position. Params 4~6 set-up the angle limits and number of positions for oblique survey, where mount-enabled vehicles automatically roll the camera between shots to emulate an oblique camera setup (providing an increased HFOV). This command can also be used to set the shutter integration time for the camera. MAV_CMD_OBLIQUE_SURVEY MAV_CMD = 260 + // Enable the specified standard MAVLink mode. + // If the specified mode is not supported, the vehicle should ACK with MAV_RESULT_FAILED. + // See https://mavlink.io/en/services/standard_modes.html + MAV_CMD_DO_SET_STANDARD_MODE MAV_CMD = 262 // start running a mission MAV_CMD_MISSION_START MAV_CMD = 300 // Actuator testing command. This is similar to MAV_CMD_DO_MOTOR_TEST but operates on the level of output functions, i.e. it is possible to test Motor1 independent from which output it is configured on. Autopilots typically refuse this command while armed. @@ -483,6 +487,7 @@ var labels_MAV_CMD = map[MAV_CMD]string{ MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN: "MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN", MAV_CMD_OVERRIDE_GOTO: "MAV_CMD_OVERRIDE_GOTO", MAV_CMD_OBLIQUE_SURVEY: "MAV_CMD_OBLIQUE_SURVEY", + MAV_CMD_DO_SET_STANDARD_MODE: "MAV_CMD_DO_SET_STANDARD_MODE", MAV_CMD_MISSION_START: "MAV_CMD_MISSION_START", MAV_CMD_ACTUATOR_TEST: "MAV_CMD_ACTUATOR_TEST", MAV_CMD_CONFIGURE_ACTUATOR: "MAV_CMD_CONFIGURE_ACTUATOR", @@ -650,6 +655,7 @@ var values_MAV_CMD = map[string]MAV_CMD{ "MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN": MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN, "MAV_CMD_OVERRIDE_GOTO": MAV_CMD_OVERRIDE_GOTO, "MAV_CMD_OBLIQUE_SURVEY": MAV_CMD_OBLIQUE_SURVEY, + "MAV_CMD_DO_SET_STANDARD_MODE": MAV_CMD_DO_SET_STANDARD_MODE, "MAV_CMD_MISSION_START": MAV_CMD_MISSION_START, "MAV_CMD_ACTUATOR_TEST": MAV_CMD_ACTUATOR_TEST, "MAV_CMD_CONFIGURE_ACTUATOR": MAV_CMD_CONFIGURE_ACTUATOR, diff --git a/pkg/dialects/common/enum_mav_mode_property.go b/pkg/dialects/common/enum_mav_mode_property.go new file mode 100644 index 000000000..9edd091e4 --- /dev/null +++ b/pkg/dialects/common/enum_mav_mode_property.go @@ -0,0 +1,70 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll,dupl,gocritic +package common + +import ( + "fmt" + "strconv" + "strings" +) + +// Mode properties. +type MAV_MODE_PROPERTY uint64 + +const ( + // If set, this mode is an advanced mode. + // For example a rate-controlled manual mode might be advanced, whereas a position-controlled manual mode is not. + // A GCS can optionally use this flag to configure the UI for its intended users. + MAV_MODE_PROPERTY_ADVANCED MAV_MODE_PROPERTY = 1 + // If set, this mode should not be added to the list of selectable modes. + // The mode might still be selected by the FC directly (for example as part of a failsafe). + MAV_MODE_PROPERTY_NOT_USER_SELECTABLE MAV_MODE_PROPERTY = 2 +) + +var labels_MAV_MODE_PROPERTY = map[MAV_MODE_PROPERTY]string{ + MAV_MODE_PROPERTY_ADVANCED: "MAV_MODE_PROPERTY_ADVANCED", + MAV_MODE_PROPERTY_NOT_USER_SELECTABLE: "MAV_MODE_PROPERTY_NOT_USER_SELECTABLE", +} + +var values_MAV_MODE_PROPERTY = map[string]MAV_MODE_PROPERTY{ + "MAV_MODE_PROPERTY_ADVANCED": MAV_MODE_PROPERTY_ADVANCED, + "MAV_MODE_PROPERTY_NOT_USER_SELECTABLE": MAV_MODE_PROPERTY_NOT_USER_SELECTABLE, +} + +// MarshalText implements the encoding.TextMarshaler interface. +func (e MAV_MODE_PROPERTY) MarshalText() ([]byte, error) { + if e == 0 { + return []byte("0"), nil + } + var names []string + for i := 0; i < 2; i++ { + mask := MAV_MODE_PROPERTY(1 << i) + if e&mask == mask { + names = append(names, labels_MAV_MODE_PROPERTY[mask]) + } + } + return []byte(strings.Join(names, " | ")), nil +} + +// UnmarshalText implements the encoding.TextUnmarshaler interface. +func (e *MAV_MODE_PROPERTY) UnmarshalText(text []byte) error { + labels := strings.Split(string(text), " | ") + var mask MAV_MODE_PROPERTY + for _, label := range labels { + if value, ok := values_MAV_MODE_PROPERTY[label]; ok { + mask |= value + } else if value, err := strconv.Atoi(label); err == nil { + mask |= MAV_MODE_PROPERTY(value) + } else { + return fmt.Errorf("invalid label '%s'", label) + } + } + *e = mask + return nil +} + +// String implements the fmt.Stringer interface. +func (e MAV_MODE_PROPERTY) String() string { + val, _ := e.MarshalText() + return string(val) +} diff --git a/pkg/dialects/development/enum_mav_mode_property_test.go b/pkg/dialects/common/enum_mav_mode_property_test.go similarity index 91% rename from pkg/dialects/development/enum_mav_mode_property_test.go rename to pkg/dialects/common/enum_mav_mode_property_test.go index 26f8ab348..08a62a129 100644 --- a/pkg/dialects/development/enum_mav_mode_property_test.go +++ b/pkg/dialects/common/enum_mav_mode_property_test.go @@ -1,6 +1,6 @@ //autogenerated:yes //nolint:revive,govet,errcheck -package development +package common import ( "testing" diff --git a/pkg/dialects/common/enum_mav_standard_mode.go b/pkg/dialects/common/enum_mav_standard_mode.go new file mode 100644 index 000000000..d0a50a8b1 --- /dev/null +++ b/pkg/dialects/common/enum_mav_standard_mode.go @@ -0,0 +1,123 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll,dupl,gocritic +package common + +import ( + "fmt" + "strconv" +) + +// Standard modes with a well understood meaning across flight stacks and vehicle types. +// For example, most flight stack have the concept of a "return" or "RTL" mode that takes a vehicle to safety, even though the precise mechanics of this mode may differ. +// The modes supported by a flight stack can be queried using AVAILABLE_MODES and set using MAV_CMD_DO_SET_STANDARD_MODE. +// The current mode is streamed in CURRENT_MODE. +// See https://mavlink.io/en/services/standard_modes.html +type MAV_STANDARD_MODE uint64 + +const ( + // Non standard mode. + // This may be used when reporting the mode if the current flight mode is not a standard mode. + MAV_STANDARD_MODE_NON_STANDARD MAV_STANDARD_MODE = 0 + // Position mode (manual). + // Position-controlled and stabilized manual mode. + // When sticks are released vehicles return to their level-flight orientation and hold both position and altitude against wind and external forces. + // This mode can only be set by vehicles that can hold a fixed position. + // Multicopter (MC) vehicles actively brake and hold both position and altitude against wind and external forces. + // Hybrid MC/FW ("VTOL") vehicles first transition to multicopter mode (if needed) but otherwise behave in the same way as MC vehicles. + // Fixed-wing (FW) vehicles must not support this mode. + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_POSITION_HOLD MAV_STANDARD_MODE = 1 + // Orbit (manual). + // Position-controlled and stabilized manual mode. + // The vehicle circles around a fixed setpoint in the horizontal plane at a particular radius, altitude, and direction. + // Flight stacks may further allow manual control over the setpoint position, radius, direction, speed, and/or altitude of the circle, but this is not mandated. + // Flight stacks may support the [MAV_CMD_DO_ORBIT](https://mavlink.io/en/messages/common.html#MAV_CMD_DO_ORBIT) for changing the orbit parameters. + // MC and FW vehicles may support this mode. + // Hybrid MC/FW ("VTOL") vehicles may support this mode in MC/FW or both modes; if the mode is not supported by the current configuration the vehicle should transition to the supported configuration. + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_ORBIT MAV_STANDARD_MODE = 2 + // Cruise mode (manual). + // Position-controlled and stabilized manual mode. + // When sticks are released vehicles return to their level-flight orientation and hold their original track against wind and external forces. + // Fixed-wing (FW) vehicles level orientation and maintain current track and altitude against wind and external forces. + // Hybrid MC/FW ("VTOL") vehicles first transition to FW mode (if needed) but otherwise behave in the same way as MC vehicles. + // Multicopter (MC) vehicles must not support this mode. + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_CRUISE MAV_STANDARD_MODE = 3 + // Altitude hold (manual). + // Altitude-controlled and stabilized manual mode. + // When sticks are released vehicles return to their level-flight orientation and hold their altitude. + // MC vehicles continue with existing momentum and may move with wind (or other external forces). + // FW vehicles continue with current heading, but may be moved off-track by wind. + // Hybrid MC/FW ("VTOL") vehicles behave according to their current configuration/mode (FW or MC). + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_ALTITUDE_HOLD MAV_STANDARD_MODE = 4 + // Safe recovery mode (auto). + // Automatic mode that takes vehicle to a predefined safe location via a safe flight path, and may also automatically land the vehicle. + // This mode is more commonly referred to as RTL and/or or Smart RTL. + // The precise return location, flight path, and landing behaviour depend on vehicle configuration and type. + // For example, the vehicle might return to the home/launch location, a rally point, or the start of a mission landing, it might follow a direct path, mission path, or breadcrumb path, and land using a mission landing pattern or some other kind of descent. + MAV_STANDARD_MODE_SAFE_RECOVERY MAV_STANDARD_MODE = 5 + // Mission mode (automatic). + // Automatic mode that executes MAVLink missions. + // Missions are executed from the current waypoint as soon as the mode is enabled. + MAV_STANDARD_MODE_MISSION MAV_STANDARD_MODE = 6 + // Land mode (auto). + // Automatic mode that lands the vehicle at the current location. + // The precise landing behaviour depends on vehicle configuration and type. + MAV_STANDARD_MODE_LAND MAV_STANDARD_MODE = 7 + // Takeoff mode (auto). + // Automatic takeoff mode. + // The precise takeoff behaviour depends on vehicle configuration and type. + MAV_STANDARD_MODE_TAKEOFF MAV_STANDARD_MODE = 8 +) + +var labels_MAV_STANDARD_MODE = map[MAV_STANDARD_MODE]string{ + MAV_STANDARD_MODE_NON_STANDARD: "MAV_STANDARD_MODE_NON_STANDARD", + MAV_STANDARD_MODE_POSITION_HOLD: "MAV_STANDARD_MODE_POSITION_HOLD", + MAV_STANDARD_MODE_ORBIT: "MAV_STANDARD_MODE_ORBIT", + MAV_STANDARD_MODE_CRUISE: "MAV_STANDARD_MODE_CRUISE", + MAV_STANDARD_MODE_ALTITUDE_HOLD: "MAV_STANDARD_MODE_ALTITUDE_HOLD", + MAV_STANDARD_MODE_SAFE_RECOVERY: "MAV_STANDARD_MODE_SAFE_RECOVERY", + MAV_STANDARD_MODE_MISSION: "MAV_STANDARD_MODE_MISSION", + MAV_STANDARD_MODE_LAND: "MAV_STANDARD_MODE_LAND", + MAV_STANDARD_MODE_TAKEOFF: "MAV_STANDARD_MODE_TAKEOFF", +} + +var values_MAV_STANDARD_MODE = map[string]MAV_STANDARD_MODE{ + "MAV_STANDARD_MODE_NON_STANDARD": MAV_STANDARD_MODE_NON_STANDARD, + "MAV_STANDARD_MODE_POSITION_HOLD": MAV_STANDARD_MODE_POSITION_HOLD, + "MAV_STANDARD_MODE_ORBIT": MAV_STANDARD_MODE_ORBIT, + "MAV_STANDARD_MODE_CRUISE": MAV_STANDARD_MODE_CRUISE, + "MAV_STANDARD_MODE_ALTITUDE_HOLD": MAV_STANDARD_MODE_ALTITUDE_HOLD, + "MAV_STANDARD_MODE_SAFE_RECOVERY": MAV_STANDARD_MODE_SAFE_RECOVERY, + "MAV_STANDARD_MODE_MISSION": MAV_STANDARD_MODE_MISSION, + "MAV_STANDARD_MODE_LAND": MAV_STANDARD_MODE_LAND, + "MAV_STANDARD_MODE_TAKEOFF": MAV_STANDARD_MODE_TAKEOFF, +} + +// MarshalText implements the encoding.TextMarshaler interface. +func (e MAV_STANDARD_MODE) MarshalText() ([]byte, error) { + if name, ok := labels_MAV_STANDARD_MODE[e]; ok { + return []byte(name), nil + } + return []byte(strconv.Itoa(int(e))), nil +} + +// UnmarshalText implements the encoding.TextUnmarshaler interface. +func (e *MAV_STANDARD_MODE) UnmarshalText(text []byte) error { + if value, ok := values_MAV_STANDARD_MODE[string(text)]; ok { + *e = value + } else if value, err := strconv.Atoi(string(text)); err == nil { + *e = MAV_STANDARD_MODE(value) + } else { + return fmt.Errorf("invalid label '%s'", text) + } + return nil +} + +// String implements the fmt.Stringer interface. +func (e MAV_STANDARD_MODE) String() string { + val, _ := e.MarshalText() + return string(val) +} diff --git a/pkg/dialects/development/enum_mav_standard_mode_test.go b/pkg/dialects/common/enum_mav_standard_mode_test.go similarity index 91% rename from pkg/dialects/development/enum_mav_standard_mode_test.go rename to pkg/dialects/common/enum_mav_standard_mode_test.go index 0483e40ab..b6b048639 100644 --- a/pkg/dialects/development/enum_mav_standard_mode_test.go +++ b/pkg/dialects/common/enum_mav_standard_mode_test.go @@ -1,6 +1,6 @@ //autogenerated:yes //nolint:revive,govet,errcheck -package development +package common import ( "testing" diff --git a/pkg/dialects/common/message_available_modes.go b/pkg/dialects/common/message_available_modes.go new file mode 100644 index 000000000..719cad611 --- /dev/null +++ b/pkg/dialects/common/message_available_modes.go @@ -0,0 +1,30 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll +package common + +// Information about a flight mode. +// The message can be enumerated to get information for all modes, or requested for a particular mode, using MAV_CMD_REQUEST_MESSAGE. +// Specify 0 in param2 to request that the message is emitted for all available modes or the specific index for just one mode. +// The modes must be available/settable for the current vehicle/frame type. +// Each mode should only be emitted once (even if it is both standard and custom). +// Note that the current mode should be emitted in CURRENT_MODE, and that if the mode list can change then AVAILABLE_MODES_MONITOR must be emitted on first change and subsequently streamed. +// See https://mavlink.io/en/services/standard_modes.html +type MessageAvailableModes struct { + // The total number of available modes for the current vehicle type. + NumberModes uint8 + // The current mode index within number_modes, indexed from 1. The index is not guaranteed to be persistent, and may change between reboots or if the set of modes change. + ModeIndex uint8 + // Standard mode. + StandardMode MAV_STANDARD_MODE `mavenum:"uint8"` + // A bitfield for use for autopilot-specific flags + CustomMode uint32 + // Mode properties. + Properties MAV_MODE_PROPERTY `mavenum:"uint32"` + // Name of custom mode, with null termination character. Should be omitted for standard modes. + ModeName string `mavlen:"35"` +} + +// GetID implements the message.Message interface. +func (*MessageAvailableModes) GetID() uint32 { + return 435 +} diff --git a/pkg/dialects/common/message_available_modes_monitor.go b/pkg/dialects/common/message_available_modes_monitor.go new file mode 100644 index 000000000..8b7881304 --- /dev/null +++ b/pkg/dialects/common/message_available_modes_monitor.go @@ -0,0 +1,17 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll +package common + +// A change to the sequence number indicates that the set of AVAILABLE_MODES has changed. +// A receiver must re-request all available modes whenever the sequence number changes. +// This is only emitted after the first change and should then be broadcast at low rate (nominally 0.3 Hz) and on change. +// See https://mavlink.io/en/services/standard_modes.html +type MessageAvailableModesMonitor struct { + // Sequence number. The value iterates sequentially whenever AVAILABLE_MODES changes (e.g. support for a new mode is added/removed dynamically). + Seq uint8 +} + +// GetID implements the message.Message interface. +func (*MessageAvailableModesMonitor) GetID() uint32 { + return 437 +} diff --git a/pkg/dialects/common/message_current_mode.go b/pkg/dialects/common/message_current_mode.go new file mode 100644 index 000000000..6fbaada36 --- /dev/null +++ b/pkg/dialects/common/message_current_mode.go @@ -0,0 +1,21 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll +package common + +// Get the current mode. +// This should be emitted on any mode change, and broadcast at low rate (nominally 0.5 Hz). +// It may be requested using MAV_CMD_REQUEST_MESSAGE. +// See https://mavlink.io/en/services/standard_modes.html +type MessageCurrentMode struct { + // Standard mode. + StandardMode MAV_STANDARD_MODE `mavenum:"uint8"` + // A bitfield for use for autopilot-specific flags + CustomMode uint32 + // The custom_mode of the mode that was last commanded by the user (for example, with MAV_CMD_DO_SET_STANDARD_MODE, MAV_CMD_DO_SET_MODE or via RC). This should usually be the same as custom_mode. It will be different if the vehicle is unable to enter the intended mode, or has left that mode due to a failsafe condition. 0 indicates the intended custom mode is unknown/not supplied + IntendedCustomMode uint32 +} + +// GetID implements the message.Message interface. +func (*MessageCurrentMode) GetID() uint32 { + return 436 +} diff --git a/pkg/dialects/cubepilot/dialect.go b/pkg/dialects/cubepilot/dialect.go index 8953a5bb6..95ef75d16 100644 --- a/pkg/dialects/cubepilot/dialect.go +++ b/pkg/dialects/cubepilot/dialect.go @@ -229,6 +229,9 @@ var dial = &dialect.Dialect{ &MessageCurrentEventSequence{}, &MessageRequestEvent{}, &MessageResponseEventError{}, + &MessageAvailableModes{}, + &MessageCurrentMode{}, + &MessageAvailableModesMonitor{}, &MessageIlluminatorStatus{}, &MessageCanfdFrame{}, &MessageCanFilterModify{}, diff --git a/pkg/dialects/cubepilot/enum_mav_cmd.go b/pkg/dialects/cubepilot/enum_mav_cmd.go index 4e63d97ba..fcd3a0f3b 100644 --- a/pkg/dialects/cubepilot/enum_mav_cmd.go +++ b/pkg/dialects/cubepilot/enum_mav_cmd.go @@ -202,6 +202,10 @@ const ( MAV_CMD_OVERRIDE_GOTO MAV_CMD = common.MAV_CMD_OVERRIDE_GOTO // Mission command to set a Camera Auto Mount Pivoting Oblique Survey (Replaces CAM_TRIGG_DIST for this purpose). The camera is triggered each time this distance is exceeded, then the mount moves to the next position. Params 4~6 set-up the angle limits and number of positions for oblique survey, where mount-enabled vehicles automatically roll the camera between shots to emulate an oblique camera setup (providing an increased HFOV). This command can also be used to set the shutter integration time for the camera. MAV_CMD_OBLIQUE_SURVEY MAV_CMD = common.MAV_CMD_OBLIQUE_SURVEY + // Enable the specified standard MAVLink mode. + // If the specified mode is not supported, the vehicle should ACK with MAV_RESULT_FAILED. + // See https://mavlink.io/en/services/standard_modes.html + MAV_CMD_DO_SET_STANDARD_MODE MAV_CMD = common.MAV_CMD_DO_SET_STANDARD_MODE // start running a mission MAV_CMD_MISSION_START MAV_CMD = common.MAV_CMD_MISSION_START // Actuator testing command. This is similar to MAV_CMD_DO_MOTOR_TEST but operates on the level of output functions, i.e. it is possible to test Motor1 independent from which output it is configured on. Autopilots typically refuse this command while armed. diff --git a/pkg/dialects/cubepilot/enum_mav_mode_property.go b/pkg/dialects/cubepilot/enum_mav_mode_property.go new file mode 100644 index 000000000..256e6b48d --- /dev/null +++ b/pkg/dialects/cubepilot/enum_mav_mode_property.go @@ -0,0 +1,20 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll,dupl,gocritic +package cubepilot + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// Mode properties. +type MAV_MODE_PROPERTY = common.MAV_MODE_PROPERTY + +const ( + // If set, this mode is an advanced mode. + // For example a rate-controlled manual mode might be advanced, whereas a position-controlled manual mode is not. + // A GCS can optionally use this flag to configure the UI for its intended users. + MAV_MODE_PROPERTY_ADVANCED MAV_MODE_PROPERTY = common.MAV_MODE_PROPERTY_ADVANCED + // If set, this mode should not be added to the list of selectable modes. + // The mode might still be selected by the FC directly (for example as part of a failsafe). + MAV_MODE_PROPERTY_NOT_USER_SELECTABLE MAV_MODE_PROPERTY = common.MAV_MODE_PROPERTY_NOT_USER_SELECTABLE +) diff --git a/pkg/dialects/cubepilot/enum_mav_standard_mode.go b/pkg/dialects/cubepilot/enum_mav_standard_mode.go new file mode 100644 index 000000000..df0279407 --- /dev/null +++ b/pkg/dialects/cubepilot/enum_mav_standard_mode.go @@ -0,0 +1,72 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll,dupl,gocritic +package cubepilot + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// Standard modes with a well understood meaning across flight stacks and vehicle types. +// For example, most flight stack have the concept of a "return" or "RTL" mode that takes a vehicle to safety, even though the precise mechanics of this mode may differ. +// The modes supported by a flight stack can be queried using AVAILABLE_MODES and set using MAV_CMD_DO_SET_STANDARD_MODE. +// The current mode is streamed in CURRENT_MODE. +// See https://mavlink.io/en/services/standard_modes.html +type MAV_STANDARD_MODE = common.MAV_STANDARD_MODE + +const ( + // Non standard mode. + // This may be used when reporting the mode if the current flight mode is not a standard mode. + MAV_STANDARD_MODE_NON_STANDARD MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_NON_STANDARD + // Position mode (manual). + // Position-controlled and stabilized manual mode. + // When sticks are released vehicles return to their level-flight orientation and hold both position and altitude against wind and external forces. + // This mode can only be set by vehicles that can hold a fixed position. + // Multicopter (MC) vehicles actively brake and hold both position and altitude against wind and external forces. + // Hybrid MC/FW ("VTOL") vehicles first transition to multicopter mode (if needed) but otherwise behave in the same way as MC vehicles. + // Fixed-wing (FW) vehicles must not support this mode. + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_POSITION_HOLD MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_POSITION_HOLD + // Orbit (manual). + // Position-controlled and stabilized manual mode. + // The vehicle circles around a fixed setpoint in the horizontal plane at a particular radius, altitude, and direction. + // Flight stacks may further allow manual control over the setpoint position, radius, direction, speed, and/or altitude of the circle, but this is not mandated. + // Flight stacks may support the [MAV_CMD_DO_ORBIT](https://mavlink.io/en/messages/common.html#MAV_CMD_DO_ORBIT) for changing the orbit parameters. + // MC and FW vehicles may support this mode. + // Hybrid MC/FW ("VTOL") vehicles may support this mode in MC/FW or both modes; if the mode is not supported by the current configuration the vehicle should transition to the supported configuration. + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_ORBIT MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_ORBIT + // Cruise mode (manual). + // Position-controlled and stabilized manual mode. + // When sticks are released vehicles return to their level-flight orientation and hold their original track against wind and external forces. + // Fixed-wing (FW) vehicles level orientation and maintain current track and altitude against wind and external forces. + // Hybrid MC/FW ("VTOL") vehicles first transition to FW mode (if needed) but otherwise behave in the same way as MC vehicles. + // Multicopter (MC) vehicles must not support this mode. + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_CRUISE MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_CRUISE + // Altitude hold (manual). + // Altitude-controlled and stabilized manual mode. + // When sticks are released vehicles return to their level-flight orientation and hold their altitude. + // MC vehicles continue with existing momentum and may move with wind (or other external forces). + // FW vehicles continue with current heading, but may be moved off-track by wind. + // Hybrid MC/FW ("VTOL") vehicles behave according to their current configuration/mode (FW or MC). + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_ALTITUDE_HOLD MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_ALTITUDE_HOLD + // Safe recovery mode (auto). + // Automatic mode that takes vehicle to a predefined safe location via a safe flight path, and may also automatically land the vehicle. + // This mode is more commonly referred to as RTL and/or or Smart RTL. + // The precise return location, flight path, and landing behaviour depend on vehicle configuration and type. + // For example, the vehicle might return to the home/launch location, a rally point, or the start of a mission landing, it might follow a direct path, mission path, or breadcrumb path, and land using a mission landing pattern or some other kind of descent. + MAV_STANDARD_MODE_SAFE_RECOVERY MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_SAFE_RECOVERY + // Mission mode (automatic). + // Automatic mode that executes MAVLink missions. + // Missions are executed from the current waypoint as soon as the mode is enabled. + MAV_STANDARD_MODE_MISSION MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_MISSION + // Land mode (auto). + // Automatic mode that lands the vehicle at the current location. + // The precise landing behaviour depends on vehicle configuration and type. + MAV_STANDARD_MODE_LAND MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_LAND + // Takeoff mode (auto). + // Automatic takeoff mode. + // The precise takeoff behaviour depends on vehicle configuration and type. + MAV_STANDARD_MODE_TAKEOFF MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_TAKEOFF +) diff --git a/pkg/dialects/cubepilot/message_available_modes.go b/pkg/dialects/cubepilot/message_available_modes.go new file mode 100644 index 000000000..149c07172 --- /dev/null +++ b/pkg/dialects/cubepilot/message_available_modes.go @@ -0,0 +1,16 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll +package cubepilot + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// Information about a flight mode. +// The message can be enumerated to get information for all modes, or requested for a particular mode, using MAV_CMD_REQUEST_MESSAGE. +// Specify 0 in param2 to request that the message is emitted for all available modes or the specific index for just one mode. +// The modes must be available/settable for the current vehicle/frame type. +// Each mode should only be emitted once (even if it is both standard and custom). +// Note that the current mode should be emitted in CURRENT_MODE, and that if the mode list can change then AVAILABLE_MODES_MONITOR must be emitted on first change and subsequently streamed. +// See https://mavlink.io/en/services/standard_modes.html +type MessageAvailableModes = common.MessageAvailableModes diff --git a/pkg/dialects/cubepilot/message_available_modes_monitor.go b/pkg/dialects/cubepilot/message_available_modes_monitor.go new file mode 100644 index 000000000..9b97d5646 --- /dev/null +++ b/pkg/dialects/cubepilot/message_available_modes_monitor.go @@ -0,0 +1,13 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll +package cubepilot + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// A change to the sequence number indicates that the set of AVAILABLE_MODES has changed. +// A receiver must re-request all available modes whenever the sequence number changes. +// This is only emitted after the first change and should then be broadcast at low rate (nominally 0.3 Hz) and on change. +// See https://mavlink.io/en/services/standard_modes.html +type MessageAvailableModesMonitor = common.MessageAvailableModesMonitor diff --git a/pkg/dialects/cubepilot/message_current_mode.go b/pkg/dialects/cubepilot/message_current_mode.go new file mode 100644 index 000000000..3befc9e00 --- /dev/null +++ b/pkg/dialects/cubepilot/message_current_mode.go @@ -0,0 +1,13 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll +package cubepilot + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// Get the current mode. +// This should be emitted on any mode change, and broadcast at low rate (nominally 0.5 Hz). +// It may be requested using MAV_CMD_REQUEST_MESSAGE. +// See https://mavlink.io/en/services/standard_modes.html +type MessageCurrentMode = common.MessageCurrentMode diff --git a/pkg/dialects/development/dialect.go b/pkg/dialects/development/dialect.go index 02670a6af..59ac7a48b 100644 --- a/pkg/dialects/development/dialect.go +++ b/pkg/dialects/development/dialect.go @@ -229,6 +229,9 @@ var dial = &dialect.Dialect{ &MessageCurrentEventSequence{}, &MessageRequestEvent{}, &MessageResponseEventError{}, + &MessageAvailableModes{}, + &MessageCurrentMode{}, + &MessageAvailableModesMonitor{}, &MessageIlluminatorStatus{}, &MessageCanfdFrame{}, &MessageCanFilterModify{}, @@ -253,9 +256,6 @@ var dial = &dialect.Dialect{ &MessageGroupStart{}, &MessageGroupEnd{}, &MessageRadioRcChannels{}, - &MessageAvailableModes{}, - &MessageCurrentMode{}, - &MessageAvailableModesMonitor{}, &MessageGnssIntegrity{}, &MessageTargetAbsolute{}, &MessageTargetRelative{}, diff --git a/pkg/dialects/development/enum_mav_cmd.go b/pkg/dialects/development/enum_mav_cmd.go index aebc43103..9e5d04512 100644 --- a/pkg/dialects/development/enum_mav_cmd.go +++ b/pkg/dialects/development/enum_mav_cmd.go @@ -203,6 +203,10 @@ const ( MAV_CMD_OVERRIDE_GOTO MAV_CMD = 252 // Mission command to set a Camera Auto Mount Pivoting Oblique Survey (Replaces CAM_TRIGG_DIST for this purpose). The camera is triggered each time this distance is exceeded, then the mount moves to the next position. Params 4~6 set-up the angle limits and number of positions for oblique survey, where mount-enabled vehicles automatically roll the camera between shots to emulate an oblique camera setup (providing an increased HFOV). This command can also be used to set the shutter integration time for the camera. MAV_CMD_OBLIQUE_SURVEY MAV_CMD = 260 + // Enable the specified standard MAVLink mode. + // If the specified mode is not supported, the vehicle should ACK with MAV_RESULT_FAILED. + // See https://mavlink.io/en/services/standard_modes.html + MAV_CMD_DO_SET_STANDARD_MODE MAV_CMD = 262 // start running a mission MAV_CMD_MISSION_START MAV_CMD = 300 // Actuator testing command. This is similar to MAV_CMD_DO_MOTOR_TEST but operates on the level of output functions, i.e. it is possible to test Motor1 independent from which output it is configured on. Autopilots typically refuse this command while armed. @@ -411,9 +415,6 @@ const ( // The system doing the upgrade will report progress using the normal command protocol sequence for a long running operation. // Command protocol information: https://mavlink.io/en/services/command.html. MAV_CMD_DO_UPGRADE MAV_CMD = 247 - // Enable the specified standard MAVLink mode. - // If the mode is not supported the vehicle should ACK with MAV_RESULT_FAILED. - MAV_CMD_DO_SET_STANDARD_MODE MAV_CMD = 262 // Allows setting an AT S command of an SiK radio. MAV_CMD_SET_AT_S_PARAM MAV_CMD = 550 // Set system and component id. @@ -535,6 +536,7 @@ var labels_MAV_CMD = map[MAV_CMD]string{ MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN: "MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN", MAV_CMD_OVERRIDE_GOTO: "MAV_CMD_OVERRIDE_GOTO", MAV_CMD_OBLIQUE_SURVEY: "MAV_CMD_OBLIQUE_SURVEY", + MAV_CMD_DO_SET_STANDARD_MODE: "MAV_CMD_DO_SET_STANDARD_MODE", MAV_CMD_MISSION_START: "MAV_CMD_MISSION_START", MAV_CMD_ACTUATOR_TEST: "MAV_CMD_ACTUATOR_TEST", MAV_CMD_CONFIGURE_ACTUATOR: "MAV_CMD_CONFIGURE_ACTUATOR", @@ -621,7 +623,6 @@ var labels_MAV_CMD = map[MAV_CMD]string{ MAV_CMD_CAN_FORWARD: "MAV_CMD_CAN_FORWARD", MAV_CMD_DO_FIGURE_EIGHT: "MAV_CMD_DO_FIGURE_EIGHT", MAV_CMD_DO_UPGRADE: "MAV_CMD_DO_UPGRADE", - MAV_CMD_DO_SET_STANDARD_MODE: "MAV_CMD_DO_SET_STANDARD_MODE", MAV_CMD_SET_AT_S_PARAM: "MAV_CMD_SET_AT_S_PARAM", MAV_CMD_DO_SET_SYS_CMP_ID: "MAV_CMD_DO_SET_SYS_CMP_ID", MAV_CMD_ODID_SET_EMERGENCY: "MAV_CMD_ODID_SET_EMERGENCY", @@ -710,6 +711,7 @@ var values_MAV_CMD = map[string]MAV_CMD{ "MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN": MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN, "MAV_CMD_OVERRIDE_GOTO": MAV_CMD_OVERRIDE_GOTO, "MAV_CMD_OBLIQUE_SURVEY": MAV_CMD_OBLIQUE_SURVEY, + "MAV_CMD_DO_SET_STANDARD_MODE": MAV_CMD_DO_SET_STANDARD_MODE, "MAV_CMD_MISSION_START": MAV_CMD_MISSION_START, "MAV_CMD_ACTUATOR_TEST": MAV_CMD_ACTUATOR_TEST, "MAV_CMD_CONFIGURE_ACTUATOR": MAV_CMD_CONFIGURE_ACTUATOR, @@ -796,7 +798,6 @@ var values_MAV_CMD = map[string]MAV_CMD{ "MAV_CMD_CAN_FORWARD": MAV_CMD_CAN_FORWARD, "MAV_CMD_DO_FIGURE_EIGHT": MAV_CMD_DO_FIGURE_EIGHT, "MAV_CMD_DO_UPGRADE": MAV_CMD_DO_UPGRADE, - "MAV_CMD_DO_SET_STANDARD_MODE": MAV_CMD_DO_SET_STANDARD_MODE, "MAV_CMD_SET_AT_S_PARAM": MAV_CMD_SET_AT_S_PARAM, "MAV_CMD_DO_SET_SYS_CMP_ID": MAV_CMD_DO_SET_SYS_CMP_ID, "MAV_CMD_ODID_SET_EMERGENCY": MAV_CMD_ODID_SET_EMERGENCY, diff --git a/pkg/dialects/development/enum_mav_mode_property.go b/pkg/dialects/development/enum_mav_mode_property.go index eba88d99e..f9fda4baf 100644 --- a/pkg/dialects/development/enum_mav_mode_property.go +++ b/pkg/dialects/development/enum_mav_mode_property.go @@ -3,68 +3,18 @@ package development import ( - "fmt" - "strconv" - "strings" + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" ) // Mode properties. -type MAV_MODE_PROPERTY uint64 +type MAV_MODE_PROPERTY = common.MAV_MODE_PROPERTY const ( // If set, this mode is an advanced mode. // For example a rate-controlled manual mode might be advanced, whereas a position-controlled manual mode is not. // A GCS can optionally use this flag to configure the UI for its intended users. - MAV_MODE_PROPERTY_ADVANCED MAV_MODE_PROPERTY = 1 + MAV_MODE_PROPERTY_ADVANCED MAV_MODE_PROPERTY = common.MAV_MODE_PROPERTY_ADVANCED // If set, this mode should not be added to the list of selectable modes. // The mode might still be selected by the FC directly (for example as part of a failsafe). - MAV_MODE_PROPERTY_NOT_USER_SELECTABLE MAV_MODE_PROPERTY = 2 + MAV_MODE_PROPERTY_NOT_USER_SELECTABLE MAV_MODE_PROPERTY = common.MAV_MODE_PROPERTY_NOT_USER_SELECTABLE ) - -var labels_MAV_MODE_PROPERTY = map[MAV_MODE_PROPERTY]string{ - MAV_MODE_PROPERTY_ADVANCED: "MAV_MODE_PROPERTY_ADVANCED", - MAV_MODE_PROPERTY_NOT_USER_SELECTABLE: "MAV_MODE_PROPERTY_NOT_USER_SELECTABLE", -} - -var values_MAV_MODE_PROPERTY = map[string]MAV_MODE_PROPERTY{ - "MAV_MODE_PROPERTY_ADVANCED": MAV_MODE_PROPERTY_ADVANCED, - "MAV_MODE_PROPERTY_NOT_USER_SELECTABLE": MAV_MODE_PROPERTY_NOT_USER_SELECTABLE, -} - -// MarshalText implements the encoding.TextMarshaler interface. -func (e MAV_MODE_PROPERTY) MarshalText() ([]byte, error) { - if e == 0 { - return []byte("0"), nil - } - var names []string - for i := 0; i < 2; i++ { - mask := MAV_MODE_PROPERTY(1 << i) - if e&mask == mask { - names = append(names, labels_MAV_MODE_PROPERTY[mask]) - } - } - return []byte(strings.Join(names, " | ")), nil -} - -// UnmarshalText implements the encoding.TextUnmarshaler interface. -func (e *MAV_MODE_PROPERTY) UnmarshalText(text []byte) error { - labels := strings.Split(string(text), " | ") - var mask MAV_MODE_PROPERTY - for _, label := range labels { - if value, ok := values_MAV_MODE_PROPERTY[label]; ok { - mask |= value - } else if value, err := strconv.Atoi(label); err == nil { - mask |= MAV_MODE_PROPERTY(value) - } else { - return fmt.Errorf("invalid label '%s'", label) - } - } - *e = mask - return nil -} - -// String implements the fmt.Stringer interface. -func (e MAV_MODE_PROPERTY) String() string { - val, _ := e.MarshalText() - return string(val) -} diff --git a/pkg/dialects/development/enum_mav_standard_mode.go b/pkg/dialects/development/enum_mav_standard_mode.go index d9faf191b..e2990c383 100644 --- a/pkg/dialects/development/enum_mav_standard_mode.go +++ b/pkg/dialects/development/enum_mav_standard_mode.go @@ -3,19 +3,20 @@ package development import ( - "fmt" - "strconv" + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" ) // Standard modes with a well understood meaning across flight stacks and vehicle types. // For example, most flight stack have the concept of a "return" or "RTL" mode that takes a vehicle to safety, even though the precise mechanics of this mode may differ. -// Modes may be set using MAV_CMD_DO_SET_STANDARD_MODE. -type MAV_STANDARD_MODE uint64 +// The modes supported by a flight stack can be queried using AVAILABLE_MODES and set using MAV_CMD_DO_SET_STANDARD_MODE. +// The current mode is streamed in CURRENT_MODE. +// See https://mavlink.io/en/services/standard_modes.html +type MAV_STANDARD_MODE = common.MAV_STANDARD_MODE const ( // Non standard mode. // This may be used when reporting the mode if the current flight mode is not a standard mode. - MAV_STANDARD_MODE_NON_STANDARD MAV_STANDARD_MODE = 0 + MAV_STANDARD_MODE_NON_STANDARD MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_NON_STANDARD // Position mode (manual). // Position-controlled and stabilized manual mode. // When sticks are released vehicles return to their level-flight orientation and hold both position and altitude against wind and external forces. @@ -24,7 +25,7 @@ const ( // Hybrid MC/FW ("VTOL") vehicles first transition to multicopter mode (if needed) but otherwise behave in the same way as MC vehicles. // Fixed-wing (FW) vehicles must not support this mode. // Other vehicle types must not support this mode (this may be revisited through the PR process). - MAV_STANDARD_MODE_POSITION_HOLD MAV_STANDARD_MODE = 1 + MAV_STANDARD_MODE_POSITION_HOLD MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_POSITION_HOLD // Orbit (manual). // Position-controlled and stabilized manual mode. // The vehicle circles around a fixed setpoint in the horizontal plane at a particular radius, altitude, and direction. @@ -33,7 +34,7 @@ const ( // MC and FW vehicles may support this mode. // Hybrid MC/FW ("VTOL") vehicles may support this mode in MC/FW or both modes; if the mode is not supported by the current configuration the vehicle should transition to the supported configuration. // Other vehicle types must not support this mode (this may be revisited through the PR process). - MAV_STANDARD_MODE_ORBIT MAV_STANDARD_MODE = 2 + MAV_STANDARD_MODE_ORBIT MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_ORBIT // Cruise mode (manual). // Position-controlled and stabilized manual mode. // When sticks are released vehicles return to their level-flight orientation and hold their original track against wind and external forces. @@ -41,7 +42,7 @@ const ( // Hybrid MC/FW ("VTOL") vehicles first transition to FW mode (if needed) but otherwise behave in the same way as MC vehicles. // Multicopter (MC) vehicles must not support this mode. // Other vehicle types must not support this mode (this may be revisited through the PR process). - MAV_STANDARD_MODE_CRUISE MAV_STANDARD_MODE = 3 + MAV_STANDARD_MODE_CRUISE MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_CRUISE // Altitude hold (manual). // Altitude-controlled and stabilized manual mode. // When sticks are released vehicles return to their level-flight orientation and hold their altitude. @@ -49,73 +50,23 @@ const ( // FW vehicles continue with current heading, but may be moved off-track by wind. // Hybrid MC/FW ("VTOL") vehicles behave according to their current configuration/mode (FW or MC). // Other vehicle types must not support this mode (this may be revisited through the PR process). - MAV_STANDARD_MODE_ALTITUDE_HOLD MAV_STANDARD_MODE = 4 + MAV_STANDARD_MODE_ALTITUDE_HOLD MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_ALTITUDE_HOLD // Safe recovery mode (auto). // Automatic mode that takes vehicle to a predefined safe location via a safe flight path, and may also automatically land the vehicle. // This mode is more commonly referred to as RTL and/or or Smart RTL. // The precise return location, flight path, and landing behaviour depend on vehicle configuration and type. // For example, the vehicle might return to the home/launch location, a rally point, or the start of a mission landing, it might follow a direct path, mission path, or breadcrumb path, and land using a mission landing pattern or some other kind of descent. - MAV_STANDARD_MODE_SAFE_RECOVERY MAV_STANDARD_MODE = 5 + MAV_STANDARD_MODE_SAFE_RECOVERY MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_SAFE_RECOVERY // Mission mode (automatic). // Automatic mode that executes MAVLink missions. // Missions are executed from the current waypoint as soon as the mode is enabled. - MAV_STANDARD_MODE_MISSION MAV_STANDARD_MODE = 6 + MAV_STANDARD_MODE_MISSION MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_MISSION // Land mode (auto). // Automatic mode that lands the vehicle at the current location. // The precise landing behaviour depends on vehicle configuration and type. - MAV_STANDARD_MODE_LAND MAV_STANDARD_MODE = 7 + MAV_STANDARD_MODE_LAND MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_LAND // Takeoff mode (auto). // Automatic takeoff mode. // The precise takeoff behaviour depends on vehicle configuration and type. - MAV_STANDARD_MODE_TAKEOFF MAV_STANDARD_MODE = 8 + MAV_STANDARD_MODE_TAKEOFF MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_TAKEOFF ) - -var labels_MAV_STANDARD_MODE = map[MAV_STANDARD_MODE]string{ - MAV_STANDARD_MODE_NON_STANDARD: "MAV_STANDARD_MODE_NON_STANDARD", - MAV_STANDARD_MODE_POSITION_HOLD: "MAV_STANDARD_MODE_POSITION_HOLD", - MAV_STANDARD_MODE_ORBIT: "MAV_STANDARD_MODE_ORBIT", - MAV_STANDARD_MODE_CRUISE: "MAV_STANDARD_MODE_CRUISE", - MAV_STANDARD_MODE_ALTITUDE_HOLD: "MAV_STANDARD_MODE_ALTITUDE_HOLD", - MAV_STANDARD_MODE_SAFE_RECOVERY: "MAV_STANDARD_MODE_SAFE_RECOVERY", - MAV_STANDARD_MODE_MISSION: "MAV_STANDARD_MODE_MISSION", - MAV_STANDARD_MODE_LAND: "MAV_STANDARD_MODE_LAND", - MAV_STANDARD_MODE_TAKEOFF: "MAV_STANDARD_MODE_TAKEOFF", -} - -var values_MAV_STANDARD_MODE = map[string]MAV_STANDARD_MODE{ - "MAV_STANDARD_MODE_NON_STANDARD": MAV_STANDARD_MODE_NON_STANDARD, - "MAV_STANDARD_MODE_POSITION_HOLD": MAV_STANDARD_MODE_POSITION_HOLD, - "MAV_STANDARD_MODE_ORBIT": MAV_STANDARD_MODE_ORBIT, - "MAV_STANDARD_MODE_CRUISE": MAV_STANDARD_MODE_CRUISE, - "MAV_STANDARD_MODE_ALTITUDE_HOLD": MAV_STANDARD_MODE_ALTITUDE_HOLD, - "MAV_STANDARD_MODE_SAFE_RECOVERY": MAV_STANDARD_MODE_SAFE_RECOVERY, - "MAV_STANDARD_MODE_MISSION": MAV_STANDARD_MODE_MISSION, - "MAV_STANDARD_MODE_LAND": MAV_STANDARD_MODE_LAND, - "MAV_STANDARD_MODE_TAKEOFF": MAV_STANDARD_MODE_TAKEOFF, -} - -// MarshalText implements the encoding.TextMarshaler interface. -func (e MAV_STANDARD_MODE) MarshalText() ([]byte, error) { - if name, ok := labels_MAV_STANDARD_MODE[e]; ok { - return []byte(name), nil - } - return []byte(strconv.Itoa(int(e))), nil -} - -// UnmarshalText implements the encoding.TextUnmarshaler interface. -func (e *MAV_STANDARD_MODE) UnmarshalText(text []byte) error { - if value, ok := values_MAV_STANDARD_MODE[string(text)]; ok { - *e = value - } else if value, err := strconv.Atoi(string(text)); err == nil { - *e = MAV_STANDARD_MODE(value) - } else { - return fmt.Errorf("invalid label '%s'", text) - } - return nil -} - -// String implements the fmt.Stringer interface. -func (e MAV_STANDARD_MODE) String() string { - val, _ := e.MarshalText() - return string(val) -} diff --git a/pkg/dialects/development/message_available_modes.go b/pkg/dialects/development/message_available_modes.go index 534b6fda2..af786f49e 100644 --- a/pkg/dialects/development/message_available_modes.go +++ b/pkg/dialects/development/message_available_modes.go @@ -2,27 +2,15 @@ //nolint:revive,misspell,govet,lll package development -// Get information about a particular flight modes. -// The message can be enumerated or requested for a particular mode using MAV_CMD_REQUEST_MESSAGE. +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// Information about a flight mode. +// The message can be enumerated to get information for all modes, or requested for a particular mode, using MAV_CMD_REQUEST_MESSAGE. // Specify 0 in param2 to request that the message is emitted for all available modes or the specific index for just one mode. // The modes must be available/settable for the current vehicle/frame type. -// Each modes should only be emitted once (even if it is both standard and custom). -type MessageAvailableModes struct { - // The total number of available modes for the current vehicle type. - NumberModes uint8 - // The current mode index within number_modes, indexed from 1. - ModeIndex uint8 - // Standard mode. - StandardMode MAV_STANDARD_MODE `mavenum:"uint8"` - // A bitfield for use for autopilot-specific flags - CustomMode uint32 - // Mode properties. - Properties MAV_MODE_PROPERTY `mavenum:"uint32"` - // Name of custom mode, with null termination character. Should be omitted for standard modes. - ModeName string `mavlen:"35"` -} - -// GetID implements the message.Message interface. -func (*MessageAvailableModes) GetID() uint32 { - return 435 -} +// Each mode should only be emitted once (even if it is both standard and custom). +// Note that the current mode should be emitted in CURRENT_MODE, and that if the mode list can change then AVAILABLE_MODES_MONITOR must be emitted on first change and subsequently streamed. +// See https://mavlink.io/en/services/standard_modes.html +type MessageAvailableModes = common.MessageAvailableModes diff --git a/pkg/dialects/development/message_available_modes_monitor.go b/pkg/dialects/development/message_available_modes_monitor.go index c6ba7d244..c5ce6693e 100644 --- a/pkg/dialects/development/message_available_modes_monitor.go +++ b/pkg/dialects/development/message_available_modes_monitor.go @@ -2,15 +2,12 @@ //nolint:revive,misspell,govet,lll package development +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + // A change to the sequence number indicates that the set of AVAILABLE_MODES has changed. // A receiver must re-request all available modes whenever the sequence number changes. // This is only emitted after the first change and should then be broadcast at low rate (nominally 0.3 Hz) and on change. -type MessageAvailableModesMonitor struct { - // Sequence number. The value iterates sequentially whenever AVAILABLE_MODES changes (e.g. support for a new mode is added/removed dynamically). - Seq uint8 -} - -// GetID implements the message.Message interface. -func (*MessageAvailableModesMonitor) GetID() uint32 { - return 437 -} +// See https://mavlink.io/en/services/standard_modes.html +type MessageAvailableModesMonitor = common.MessageAvailableModesMonitor diff --git a/pkg/dialects/development/message_current_mode.go b/pkg/dialects/development/message_current_mode.go index 5d03188f9..b174e6a9f 100644 --- a/pkg/dialects/development/message_current_mode.go +++ b/pkg/dialects/development/message_current_mode.go @@ -2,19 +2,12 @@ //nolint:revive,misspell,govet,lll package development +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + // Get the current mode. // This should be emitted on any mode change, and broadcast at low rate (nominally 0.5 Hz). // It may be requested using MAV_CMD_REQUEST_MESSAGE. -type MessageCurrentMode struct { - // Standard mode. - StandardMode MAV_STANDARD_MODE `mavenum:"uint8"` - // A bitfield for use for autopilot-specific flags - CustomMode uint32 - // The custom_mode of the mode that was last commanded by the user (for example, with MAV_CMD_DO_SET_STANDARD_MODE, MAV_CMD_DO_SET_MODE or via RC). This should usually be the same as custom_mode. It will be different if the vehicle is unable to enter the intended mode, or has left that mode due to a failsafe condition. 0 indicates the intended custom mode is unknown/not supplied - IntendedCustomMode uint32 -} - -// GetID implements the message.Message interface. -func (*MessageCurrentMode) GetID() uint32 { - return 436 -} +// See https://mavlink.io/en/services/standard_modes.html +type MessageCurrentMode = common.MessageCurrentMode diff --git a/pkg/dialects/matrixpilot/dialect.go b/pkg/dialects/matrixpilot/dialect.go index f9d34280a..0ea71ec17 100644 --- a/pkg/dialects/matrixpilot/dialect.go +++ b/pkg/dialects/matrixpilot/dialect.go @@ -229,6 +229,9 @@ var dial = &dialect.Dialect{ &MessageCurrentEventSequence{}, &MessageRequestEvent{}, &MessageResponseEventError{}, + &MessageAvailableModes{}, + &MessageCurrentMode{}, + &MessageAvailableModesMonitor{}, &MessageIlluminatorStatus{}, &MessageCanfdFrame{}, &MessageCanFilterModify{}, diff --git a/pkg/dialects/matrixpilot/enum_mav_cmd.go b/pkg/dialects/matrixpilot/enum_mav_cmd.go index cfb87b7bd..40325f7f1 100644 --- a/pkg/dialects/matrixpilot/enum_mav_cmd.go +++ b/pkg/dialects/matrixpilot/enum_mav_cmd.go @@ -203,6 +203,10 @@ const ( MAV_CMD_OVERRIDE_GOTO MAV_CMD = 252 // Mission command to set a Camera Auto Mount Pivoting Oblique Survey (Replaces CAM_TRIGG_DIST for this purpose). The camera is triggered each time this distance is exceeded, then the mount moves to the next position. Params 4~6 set-up the angle limits and number of positions for oblique survey, where mount-enabled vehicles automatically roll the camera between shots to emulate an oblique camera setup (providing an increased HFOV). This command can also be used to set the shutter integration time for the camera. MAV_CMD_OBLIQUE_SURVEY MAV_CMD = 260 + // Enable the specified standard MAVLink mode. + // If the specified mode is not supported, the vehicle should ACK with MAV_RESULT_FAILED. + // See https://mavlink.io/en/services/standard_modes.html + MAV_CMD_DO_SET_STANDARD_MODE MAV_CMD = 262 // start running a mission MAV_CMD_MISSION_START MAV_CMD = 300 // Actuator testing command. This is similar to MAV_CMD_DO_MOTOR_TEST but operates on the level of output functions, i.e. it is possible to test Motor1 independent from which output it is configured on. Autopilots typically refuse this command while armed. @@ -485,6 +489,7 @@ var labels_MAV_CMD = map[MAV_CMD]string{ MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN: "MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN", MAV_CMD_OVERRIDE_GOTO: "MAV_CMD_OVERRIDE_GOTO", MAV_CMD_OBLIQUE_SURVEY: "MAV_CMD_OBLIQUE_SURVEY", + MAV_CMD_DO_SET_STANDARD_MODE: "MAV_CMD_DO_SET_STANDARD_MODE", MAV_CMD_MISSION_START: "MAV_CMD_MISSION_START", MAV_CMD_ACTUATOR_TEST: "MAV_CMD_ACTUATOR_TEST", MAV_CMD_CONFIGURE_ACTUATOR: "MAV_CMD_CONFIGURE_ACTUATOR", @@ -653,6 +658,7 @@ var values_MAV_CMD = map[string]MAV_CMD{ "MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN": MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN, "MAV_CMD_OVERRIDE_GOTO": MAV_CMD_OVERRIDE_GOTO, "MAV_CMD_OBLIQUE_SURVEY": MAV_CMD_OBLIQUE_SURVEY, + "MAV_CMD_DO_SET_STANDARD_MODE": MAV_CMD_DO_SET_STANDARD_MODE, "MAV_CMD_MISSION_START": MAV_CMD_MISSION_START, "MAV_CMD_ACTUATOR_TEST": MAV_CMD_ACTUATOR_TEST, "MAV_CMD_CONFIGURE_ACTUATOR": MAV_CMD_CONFIGURE_ACTUATOR, diff --git a/pkg/dialects/matrixpilot/enum_mav_mode_property.go b/pkg/dialects/matrixpilot/enum_mav_mode_property.go new file mode 100644 index 000000000..d2aa3f42e --- /dev/null +++ b/pkg/dialects/matrixpilot/enum_mav_mode_property.go @@ -0,0 +1,20 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll,dupl,gocritic +package matrixpilot + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// Mode properties. +type MAV_MODE_PROPERTY = common.MAV_MODE_PROPERTY + +const ( + // If set, this mode is an advanced mode. + // For example a rate-controlled manual mode might be advanced, whereas a position-controlled manual mode is not. + // A GCS can optionally use this flag to configure the UI for its intended users. + MAV_MODE_PROPERTY_ADVANCED MAV_MODE_PROPERTY = common.MAV_MODE_PROPERTY_ADVANCED + // If set, this mode should not be added to the list of selectable modes. + // The mode might still be selected by the FC directly (for example as part of a failsafe). + MAV_MODE_PROPERTY_NOT_USER_SELECTABLE MAV_MODE_PROPERTY = common.MAV_MODE_PROPERTY_NOT_USER_SELECTABLE +) diff --git a/pkg/dialects/matrixpilot/enum_mav_standard_mode.go b/pkg/dialects/matrixpilot/enum_mav_standard_mode.go new file mode 100644 index 000000000..1de1cddf6 --- /dev/null +++ b/pkg/dialects/matrixpilot/enum_mav_standard_mode.go @@ -0,0 +1,72 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll,dupl,gocritic +package matrixpilot + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// Standard modes with a well understood meaning across flight stacks and vehicle types. +// For example, most flight stack have the concept of a "return" or "RTL" mode that takes a vehicle to safety, even though the precise mechanics of this mode may differ. +// The modes supported by a flight stack can be queried using AVAILABLE_MODES and set using MAV_CMD_DO_SET_STANDARD_MODE. +// The current mode is streamed in CURRENT_MODE. +// See https://mavlink.io/en/services/standard_modes.html +type MAV_STANDARD_MODE = common.MAV_STANDARD_MODE + +const ( + // Non standard mode. + // This may be used when reporting the mode if the current flight mode is not a standard mode. + MAV_STANDARD_MODE_NON_STANDARD MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_NON_STANDARD + // Position mode (manual). + // Position-controlled and stabilized manual mode. + // When sticks are released vehicles return to their level-flight orientation and hold both position and altitude against wind and external forces. + // This mode can only be set by vehicles that can hold a fixed position. + // Multicopter (MC) vehicles actively brake and hold both position and altitude against wind and external forces. + // Hybrid MC/FW ("VTOL") vehicles first transition to multicopter mode (if needed) but otherwise behave in the same way as MC vehicles. + // Fixed-wing (FW) vehicles must not support this mode. + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_POSITION_HOLD MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_POSITION_HOLD + // Orbit (manual). + // Position-controlled and stabilized manual mode. + // The vehicle circles around a fixed setpoint in the horizontal plane at a particular radius, altitude, and direction. + // Flight stacks may further allow manual control over the setpoint position, radius, direction, speed, and/or altitude of the circle, but this is not mandated. + // Flight stacks may support the [MAV_CMD_DO_ORBIT](https://mavlink.io/en/messages/common.html#MAV_CMD_DO_ORBIT) for changing the orbit parameters. + // MC and FW vehicles may support this mode. + // Hybrid MC/FW ("VTOL") vehicles may support this mode in MC/FW or both modes; if the mode is not supported by the current configuration the vehicle should transition to the supported configuration. + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_ORBIT MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_ORBIT + // Cruise mode (manual). + // Position-controlled and stabilized manual mode. + // When sticks are released vehicles return to their level-flight orientation and hold their original track against wind and external forces. + // Fixed-wing (FW) vehicles level orientation and maintain current track and altitude against wind and external forces. + // Hybrid MC/FW ("VTOL") vehicles first transition to FW mode (if needed) but otherwise behave in the same way as MC vehicles. + // Multicopter (MC) vehicles must not support this mode. + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_CRUISE MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_CRUISE + // Altitude hold (manual). + // Altitude-controlled and stabilized manual mode. + // When sticks are released vehicles return to their level-flight orientation and hold their altitude. + // MC vehicles continue with existing momentum and may move with wind (or other external forces). + // FW vehicles continue with current heading, but may be moved off-track by wind. + // Hybrid MC/FW ("VTOL") vehicles behave according to their current configuration/mode (FW or MC). + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_ALTITUDE_HOLD MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_ALTITUDE_HOLD + // Safe recovery mode (auto). + // Automatic mode that takes vehicle to a predefined safe location via a safe flight path, and may also automatically land the vehicle. + // This mode is more commonly referred to as RTL and/or or Smart RTL. + // The precise return location, flight path, and landing behaviour depend on vehicle configuration and type. + // For example, the vehicle might return to the home/launch location, a rally point, or the start of a mission landing, it might follow a direct path, mission path, or breadcrumb path, and land using a mission landing pattern or some other kind of descent. + MAV_STANDARD_MODE_SAFE_RECOVERY MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_SAFE_RECOVERY + // Mission mode (automatic). + // Automatic mode that executes MAVLink missions. + // Missions are executed from the current waypoint as soon as the mode is enabled. + MAV_STANDARD_MODE_MISSION MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_MISSION + // Land mode (auto). + // Automatic mode that lands the vehicle at the current location. + // The precise landing behaviour depends on vehicle configuration and type. + MAV_STANDARD_MODE_LAND MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_LAND + // Takeoff mode (auto). + // Automatic takeoff mode. + // The precise takeoff behaviour depends on vehicle configuration and type. + MAV_STANDARD_MODE_TAKEOFF MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_TAKEOFF +) diff --git a/pkg/dialects/matrixpilot/message_available_modes.go b/pkg/dialects/matrixpilot/message_available_modes.go new file mode 100644 index 000000000..3cfa6d61e --- /dev/null +++ b/pkg/dialects/matrixpilot/message_available_modes.go @@ -0,0 +1,16 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll +package matrixpilot + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// Information about a flight mode. +// The message can be enumerated to get information for all modes, or requested for a particular mode, using MAV_CMD_REQUEST_MESSAGE. +// Specify 0 in param2 to request that the message is emitted for all available modes or the specific index for just one mode. +// The modes must be available/settable for the current vehicle/frame type. +// Each mode should only be emitted once (even if it is both standard and custom). +// Note that the current mode should be emitted in CURRENT_MODE, and that if the mode list can change then AVAILABLE_MODES_MONITOR must be emitted on first change and subsequently streamed. +// See https://mavlink.io/en/services/standard_modes.html +type MessageAvailableModes = common.MessageAvailableModes diff --git a/pkg/dialects/matrixpilot/message_available_modes_monitor.go b/pkg/dialects/matrixpilot/message_available_modes_monitor.go new file mode 100644 index 000000000..47444a5eb --- /dev/null +++ b/pkg/dialects/matrixpilot/message_available_modes_monitor.go @@ -0,0 +1,13 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll +package matrixpilot + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// A change to the sequence number indicates that the set of AVAILABLE_MODES has changed. +// A receiver must re-request all available modes whenever the sequence number changes. +// This is only emitted after the first change and should then be broadcast at low rate (nominally 0.3 Hz) and on change. +// See https://mavlink.io/en/services/standard_modes.html +type MessageAvailableModesMonitor = common.MessageAvailableModesMonitor diff --git a/pkg/dialects/matrixpilot/message_current_mode.go b/pkg/dialects/matrixpilot/message_current_mode.go new file mode 100644 index 000000000..2a74ba00f --- /dev/null +++ b/pkg/dialects/matrixpilot/message_current_mode.go @@ -0,0 +1,13 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll +package matrixpilot + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// Get the current mode. +// This should be emitted on any mode change, and broadcast at low rate (nominally 0.5 Hz). +// It may be requested using MAV_CMD_REQUEST_MESSAGE. +// See https://mavlink.io/en/services/standard_modes.html +type MessageCurrentMode = common.MessageCurrentMode diff --git a/pkg/dialects/paparazzi/dialect.go b/pkg/dialects/paparazzi/dialect.go index 5cbc72b7c..6376215ac 100644 --- a/pkg/dialects/paparazzi/dialect.go +++ b/pkg/dialects/paparazzi/dialect.go @@ -229,6 +229,9 @@ var dial = &dialect.Dialect{ &MessageCurrentEventSequence{}, &MessageRequestEvent{}, &MessageResponseEventError{}, + &MessageAvailableModes{}, + &MessageCurrentMode{}, + &MessageAvailableModesMonitor{}, &MessageIlluminatorStatus{}, &MessageCanfdFrame{}, &MessageCanFilterModify{}, diff --git a/pkg/dialects/paparazzi/enum_mav_cmd.go b/pkg/dialects/paparazzi/enum_mav_cmd.go index e61297167..ac01739fa 100644 --- a/pkg/dialects/paparazzi/enum_mav_cmd.go +++ b/pkg/dialects/paparazzi/enum_mav_cmd.go @@ -202,6 +202,10 @@ const ( MAV_CMD_OVERRIDE_GOTO MAV_CMD = common.MAV_CMD_OVERRIDE_GOTO // Mission command to set a Camera Auto Mount Pivoting Oblique Survey (Replaces CAM_TRIGG_DIST for this purpose). The camera is triggered each time this distance is exceeded, then the mount moves to the next position. Params 4~6 set-up the angle limits and number of positions for oblique survey, where mount-enabled vehicles automatically roll the camera between shots to emulate an oblique camera setup (providing an increased HFOV). This command can also be used to set the shutter integration time for the camera. MAV_CMD_OBLIQUE_SURVEY MAV_CMD = common.MAV_CMD_OBLIQUE_SURVEY + // Enable the specified standard MAVLink mode. + // If the specified mode is not supported, the vehicle should ACK with MAV_RESULT_FAILED. + // See https://mavlink.io/en/services/standard_modes.html + MAV_CMD_DO_SET_STANDARD_MODE MAV_CMD = common.MAV_CMD_DO_SET_STANDARD_MODE // start running a mission MAV_CMD_MISSION_START MAV_CMD = common.MAV_CMD_MISSION_START // Actuator testing command. This is similar to MAV_CMD_DO_MOTOR_TEST but operates on the level of output functions, i.e. it is possible to test Motor1 independent from which output it is configured on. Autopilots typically refuse this command while armed. diff --git a/pkg/dialects/paparazzi/enum_mav_mode_property.go b/pkg/dialects/paparazzi/enum_mav_mode_property.go new file mode 100644 index 000000000..32b00c3ec --- /dev/null +++ b/pkg/dialects/paparazzi/enum_mav_mode_property.go @@ -0,0 +1,20 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll,dupl,gocritic +package paparazzi + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// Mode properties. +type MAV_MODE_PROPERTY = common.MAV_MODE_PROPERTY + +const ( + // If set, this mode is an advanced mode. + // For example a rate-controlled manual mode might be advanced, whereas a position-controlled manual mode is not. + // A GCS can optionally use this flag to configure the UI for its intended users. + MAV_MODE_PROPERTY_ADVANCED MAV_MODE_PROPERTY = common.MAV_MODE_PROPERTY_ADVANCED + // If set, this mode should not be added to the list of selectable modes. + // The mode might still be selected by the FC directly (for example as part of a failsafe). + MAV_MODE_PROPERTY_NOT_USER_SELECTABLE MAV_MODE_PROPERTY = common.MAV_MODE_PROPERTY_NOT_USER_SELECTABLE +) diff --git a/pkg/dialects/paparazzi/enum_mav_standard_mode.go b/pkg/dialects/paparazzi/enum_mav_standard_mode.go new file mode 100644 index 000000000..b27166901 --- /dev/null +++ b/pkg/dialects/paparazzi/enum_mav_standard_mode.go @@ -0,0 +1,72 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll,dupl,gocritic +package paparazzi + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// Standard modes with a well understood meaning across flight stacks and vehicle types. +// For example, most flight stack have the concept of a "return" or "RTL" mode that takes a vehicle to safety, even though the precise mechanics of this mode may differ. +// The modes supported by a flight stack can be queried using AVAILABLE_MODES and set using MAV_CMD_DO_SET_STANDARD_MODE. +// The current mode is streamed in CURRENT_MODE. +// See https://mavlink.io/en/services/standard_modes.html +type MAV_STANDARD_MODE = common.MAV_STANDARD_MODE + +const ( + // Non standard mode. + // This may be used when reporting the mode if the current flight mode is not a standard mode. + MAV_STANDARD_MODE_NON_STANDARD MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_NON_STANDARD + // Position mode (manual). + // Position-controlled and stabilized manual mode. + // When sticks are released vehicles return to their level-flight orientation and hold both position and altitude against wind and external forces. + // This mode can only be set by vehicles that can hold a fixed position. + // Multicopter (MC) vehicles actively brake and hold both position and altitude against wind and external forces. + // Hybrid MC/FW ("VTOL") vehicles first transition to multicopter mode (if needed) but otherwise behave in the same way as MC vehicles. + // Fixed-wing (FW) vehicles must not support this mode. + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_POSITION_HOLD MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_POSITION_HOLD + // Orbit (manual). + // Position-controlled and stabilized manual mode. + // The vehicle circles around a fixed setpoint in the horizontal plane at a particular radius, altitude, and direction. + // Flight stacks may further allow manual control over the setpoint position, radius, direction, speed, and/or altitude of the circle, but this is not mandated. + // Flight stacks may support the [MAV_CMD_DO_ORBIT](https://mavlink.io/en/messages/common.html#MAV_CMD_DO_ORBIT) for changing the orbit parameters. + // MC and FW vehicles may support this mode. + // Hybrid MC/FW ("VTOL") vehicles may support this mode in MC/FW or both modes; if the mode is not supported by the current configuration the vehicle should transition to the supported configuration. + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_ORBIT MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_ORBIT + // Cruise mode (manual). + // Position-controlled and stabilized manual mode. + // When sticks are released vehicles return to their level-flight orientation and hold their original track against wind and external forces. + // Fixed-wing (FW) vehicles level orientation and maintain current track and altitude against wind and external forces. + // Hybrid MC/FW ("VTOL") vehicles first transition to FW mode (if needed) but otherwise behave in the same way as MC vehicles. + // Multicopter (MC) vehicles must not support this mode. + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_CRUISE MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_CRUISE + // Altitude hold (manual). + // Altitude-controlled and stabilized manual mode. + // When sticks are released vehicles return to their level-flight orientation and hold their altitude. + // MC vehicles continue with existing momentum and may move with wind (or other external forces). + // FW vehicles continue with current heading, but may be moved off-track by wind. + // Hybrid MC/FW ("VTOL") vehicles behave according to their current configuration/mode (FW or MC). + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_ALTITUDE_HOLD MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_ALTITUDE_HOLD + // Safe recovery mode (auto). + // Automatic mode that takes vehicle to a predefined safe location via a safe flight path, and may also automatically land the vehicle. + // This mode is more commonly referred to as RTL and/or or Smart RTL. + // The precise return location, flight path, and landing behaviour depend on vehicle configuration and type. + // For example, the vehicle might return to the home/launch location, a rally point, or the start of a mission landing, it might follow a direct path, mission path, or breadcrumb path, and land using a mission landing pattern or some other kind of descent. + MAV_STANDARD_MODE_SAFE_RECOVERY MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_SAFE_RECOVERY + // Mission mode (automatic). + // Automatic mode that executes MAVLink missions. + // Missions are executed from the current waypoint as soon as the mode is enabled. + MAV_STANDARD_MODE_MISSION MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_MISSION + // Land mode (auto). + // Automatic mode that lands the vehicle at the current location. + // The precise landing behaviour depends on vehicle configuration and type. + MAV_STANDARD_MODE_LAND MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_LAND + // Takeoff mode (auto). + // Automatic takeoff mode. + // The precise takeoff behaviour depends on vehicle configuration and type. + MAV_STANDARD_MODE_TAKEOFF MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_TAKEOFF +) diff --git a/pkg/dialects/paparazzi/message_available_modes.go b/pkg/dialects/paparazzi/message_available_modes.go new file mode 100644 index 000000000..495995b66 --- /dev/null +++ b/pkg/dialects/paparazzi/message_available_modes.go @@ -0,0 +1,16 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll +package paparazzi + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// Information about a flight mode. +// The message can be enumerated to get information for all modes, or requested for a particular mode, using MAV_CMD_REQUEST_MESSAGE. +// Specify 0 in param2 to request that the message is emitted for all available modes or the specific index for just one mode. +// The modes must be available/settable for the current vehicle/frame type. +// Each mode should only be emitted once (even if it is both standard and custom). +// Note that the current mode should be emitted in CURRENT_MODE, and that if the mode list can change then AVAILABLE_MODES_MONITOR must be emitted on first change and subsequently streamed. +// See https://mavlink.io/en/services/standard_modes.html +type MessageAvailableModes = common.MessageAvailableModes diff --git a/pkg/dialects/paparazzi/message_available_modes_monitor.go b/pkg/dialects/paparazzi/message_available_modes_monitor.go new file mode 100644 index 000000000..e2265975d --- /dev/null +++ b/pkg/dialects/paparazzi/message_available_modes_monitor.go @@ -0,0 +1,13 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll +package paparazzi + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// A change to the sequence number indicates that the set of AVAILABLE_MODES has changed. +// A receiver must re-request all available modes whenever the sequence number changes. +// This is only emitted after the first change and should then be broadcast at low rate (nominally 0.3 Hz) and on change. +// See https://mavlink.io/en/services/standard_modes.html +type MessageAvailableModesMonitor = common.MessageAvailableModesMonitor diff --git a/pkg/dialects/paparazzi/message_current_mode.go b/pkg/dialects/paparazzi/message_current_mode.go new file mode 100644 index 000000000..4d7751188 --- /dev/null +++ b/pkg/dialects/paparazzi/message_current_mode.go @@ -0,0 +1,13 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll +package paparazzi + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// Get the current mode. +// This should be emitted on any mode change, and broadcast at low rate (nominally 0.5 Hz). +// It may be requested using MAV_CMD_REQUEST_MESSAGE. +// See https://mavlink.io/en/services/standard_modes.html +type MessageCurrentMode = common.MessageCurrentMode diff --git a/pkg/dialects/pythonarraytest/dialect.go b/pkg/dialects/pythonarraytest/dialect.go index e718fa1dd..c4e3dd996 100644 --- a/pkg/dialects/pythonarraytest/dialect.go +++ b/pkg/dialects/pythonarraytest/dialect.go @@ -229,6 +229,9 @@ var dial = &dialect.Dialect{ &MessageCurrentEventSequence{}, &MessageRequestEvent{}, &MessageResponseEventError{}, + &MessageAvailableModes{}, + &MessageCurrentMode{}, + &MessageAvailableModesMonitor{}, &MessageIlluminatorStatus{}, &MessageCanfdFrame{}, &MessageCanFilterModify{}, diff --git a/pkg/dialects/pythonarraytest/enum_mav_cmd.go b/pkg/dialects/pythonarraytest/enum_mav_cmd.go index 286064b54..9972cfca6 100644 --- a/pkg/dialects/pythonarraytest/enum_mav_cmd.go +++ b/pkg/dialects/pythonarraytest/enum_mav_cmd.go @@ -202,6 +202,10 @@ const ( MAV_CMD_OVERRIDE_GOTO MAV_CMD = common.MAV_CMD_OVERRIDE_GOTO // Mission command to set a Camera Auto Mount Pivoting Oblique Survey (Replaces CAM_TRIGG_DIST for this purpose). The camera is triggered each time this distance is exceeded, then the mount moves to the next position. Params 4~6 set-up the angle limits and number of positions for oblique survey, where mount-enabled vehicles automatically roll the camera between shots to emulate an oblique camera setup (providing an increased HFOV). This command can also be used to set the shutter integration time for the camera. MAV_CMD_OBLIQUE_SURVEY MAV_CMD = common.MAV_CMD_OBLIQUE_SURVEY + // Enable the specified standard MAVLink mode. + // If the specified mode is not supported, the vehicle should ACK with MAV_RESULT_FAILED. + // See https://mavlink.io/en/services/standard_modes.html + MAV_CMD_DO_SET_STANDARD_MODE MAV_CMD = common.MAV_CMD_DO_SET_STANDARD_MODE // start running a mission MAV_CMD_MISSION_START MAV_CMD = common.MAV_CMD_MISSION_START // Actuator testing command. This is similar to MAV_CMD_DO_MOTOR_TEST but operates on the level of output functions, i.e. it is possible to test Motor1 independent from which output it is configured on. Autopilots typically refuse this command while armed. diff --git a/pkg/dialects/pythonarraytest/enum_mav_mode_property.go b/pkg/dialects/pythonarraytest/enum_mav_mode_property.go new file mode 100644 index 000000000..436850ee1 --- /dev/null +++ b/pkg/dialects/pythonarraytest/enum_mav_mode_property.go @@ -0,0 +1,20 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll,dupl,gocritic +package pythonarraytest + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// Mode properties. +type MAV_MODE_PROPERTY = common.MAV_MODE_PROPERTY + +const ( + // If set, this mode is an advanced mode. + // For example a rate-controlled manual mode might be advanced, whereas a position-controlled manual mode is not. + // A GCS can optionally use this flag to configure the UI for its intended users. + MAV_MODE_PROPERTY_ADVANCED MAV_MODE_PROPERTY = common.MAV_MODE_PROPERTY_ADVANCED + // If set, this mode should not be added to the list of selectable modes. + // The mode might still be selected by the FC directly (for example as part of a failsafe). + MAV_MODE_PROPERTY_NOT_USER_SELECTABLE MAV_MODE_PROPERTY = common.MAV_MODE_PROPERTY_NOT_USER_SELECTABLE +) diff --git a/pkg/dialects/pythonarraytest/enum_mav_standard_mode.go b/pkg/dialects/pythonarraytest/enum_mav_standard_mode.go new file mode 100644 index 000000000..a2a889b79 --- /dev/null +++ b/pkg/dialects/pythonarraytest/enum_mav_standard_mode.go @@ -0,0 +1,72 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll,dupl,gocritic +package pythonarraytest + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// Standard modes with a well understood meaning across flight stacks and vehicle types. +// For example, most flight stack have the concept of a "return" or "RTL" mode that takes a vehicle to safety, even though the precise mechanics of this mode may differ. +// The modes supported by a flight stack can be queried using AVAILABLE_MODES and set using MAV_CMD_DO_SET_STANDARD_MODE. +// The current mode is streamed in CURRENT_MODE. +// See https://mavlink.io/en/services/standard_modes.html +type MAV_STANDARD_MODE = common.MAV_STANDARD_MODE + +const ( + // Non standard mode. + // This may be used when reporting the mode if the current flight mode is not a standard mode. + MAV_STANDARD_MODE_NON_STANDARD MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_NON_STANDARD + // Position mode (manual). + // Position-controlled and stabilized manual mode. + // When sticks are released vehicles return to their level-flight orientation and hold both position and altitude against wind and external forces. + // This mode can only be set by vehicles that can hold a fixed position. + // Multicopter (MC) vehicles actively brake and hold both position and altitude against wind and external forces. + // Hybrid MC/FW ("VTOL") vehicles first transition to multicopter mode (if needed) but otherwise behave in the same way as MC vehicles. + // Fixed-wing (FW) vehicles must not support this mode. + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_POSITION_HOLD MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_POSITION_HOLD + // Orbit (manual). + // Position-controlled and stabilized manual mode. + // The vehicle circles around a fixed setpoint in the horizontal plane at a particular radius, altitude, and direction. + // Flight stacks may further allow manual control over the setpoint position, radius, direction, speed, and/or altitude of the circle, but this is not mandated. + // Flight stacks may support the [MAV_CMD_DO_ORBIT](https://mavlink.io/en/messages/common.html#MAV_CMD_DO_ORBIT) for changing the orbit parameters. + // MC and FW vehicles may support this mode. + // Hybrid MC/FW ("VTOL") vehicles may support this mode in MC/FW or both modes; if the mode is not supported by the current configuration the vehicle should transition to the supported configuration. + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_ORBIT MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_ORBIT + // Cruise mode (manual). + // Position-controlled and stabilized manual mode. + // When sticks are released vehicles return to their level-flight orientation and hold their original track against wind and external forces. + // Fixed-wing (FW) vehicles level orientation and maintain current track and altitude against wind and external forces. + // Hybrid MC/FW ("VTOL") vehicles first transition to FW mode (if needed) but otherwise behave in the same way as MC vehicles. + // Multicopter (MC) vehicles must not support this mode. + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_CRUISE MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_CRUISE + // Altitude hold (manual). + // Altitude-controlled and stabilized manual mode. + // When sticks are released vehicles return to their level-flight orientation and hold their altitude. + // MC vehicles continue with existing momentum and may move with wind (or other external forces). + // FW vehicles continue with current heading, but may be moved off-track by wind. + // Hybrid MC/FW ("VTOL") vehicles behave according to their current configuration/mode (FW or MC). + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_ALTITUDE_HOLD MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_ALTITUDE_HOLD + // Safe recovery mode (auto). + // Automatic mode that takes vehicle to a predefined safe location via a safe flight path, and may also automatically land the vehicle. + // This mode is more commonly referred to as RTL and/or or Smart RTL. + // The precise return location, flight path, and landing behaviour depend on vehicle configuration and type. + // For example, the vehicle might return to the home/launch location, a rally point, or the start of a mission landing, it might follow a direct path, mission path, or breadcrumb path, and land using a mission landing pattern or some other kind of descent. + MAV_STANDARD_MODE_SAFE_RECOVERY MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_SAFE_RECOVERY + // Mission mode (automatic). + // Automatic mode that executes MAVLink missions. + // Missions are executed from the current waypoint as soon as the mode is enabled. + MAV_STANDARD_MODE_MISSION MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_MISSION + // Land mode (auto). + // Automatic mode that lands the vehicle at the current location. + // The precise landing behaviour depends on vehicle configuration and type. + MAV_STANDARD_MODE_LAND MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_LAND + // Takeoff mode (auto). + // Automatic takeoff mode. + // The precise takeoff behaviour depends on vehicle configuration and type. + MAV_STANDARD_MODE_TAKEOFF MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_TAKEOFF +) diff --git a/pkg/dialects/pythonarraytest/message_available_modes.go b/pkg/dialects/pythonarraytest/message_available_modes.go new file mode 100644 index 000000000..d3cc12fd2 --- /dev/null +++ b/pkg/dialects/pythonarraytest/message_available_modes.go @@ -0,0 +1,16 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll +package pythonarraytest + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// Information about a flight mode. +// The message can be enumerated to get information for all modes, or requested for a particular mode, using MAV_CMD_REQUEST_MESSAGE. +// Specify 0 in param2 to request that the message is emitted for all available modes or the specific index for just one mode. +// The modes must be available/settable for the current vehicle/frame type. +// Each mode should only be emitted once (even if it is both standard and custom). +// Note that the current mode should be emitted in CURRENT_MODE, and that if the mode list can change then AVAILABLE_MODES_MONITOR must be emitted on first change and subsequently streamed. +// See https://mavlink.io/en/services/standard_modes.html +type MessageAvailableModes = common.MessageAvailableModes diff --git a/pkg/dialects/pythonarraytest/message_available_modes_monitor.go b/pkg/dialects/pythonarraytest/message_available_modes_monitor.go new file mode 100644 index 000000000..70b2275e2 --- /dev/null +++ b/pkg/dialects/pythonarraytest/message_available_modes_monitor.go @@ -0,0 +1,13 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll +package pythonarraytest + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// A change to the sequence number indicates that the set of AVAILABLE_MODES has changed. +// A receiver must re-request all available modes whenever the sequence number changes. +// This is only emitted after the first change and should then be broadcast at low rate (nominally 0.3 Hz) and on change. +// See https://mavlink.io/en/services/standard_modes.html +type MessageAvailableModesMonitor = common.MessageAvailableModesMonitor diff --git a/pkg/dialects/pythonarraytest/message_current_mode.go b/pkg/dialects/pythonarraytest/message_current_mode.go new file mode 100644 index 000000000..9922d9a61 --- /dev/null +++ b/pkg/dialects/pythonarraytest/message_current_mode.go @@ -0,0 +1,13 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll +package pythonarraytest + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// Get the current mode. +// This should be emitted on any mode change, and broadcast at low rate (nominally 0.5 Hz). +// It may be requested using MAV_CMD_REQUEST_MESSAGE. +// See https://mavlink.io/en/services/standard_modes.html +type MessageCurrentMode = common.MessageCurrentMode diff --git a/pkg/dialects/storm32/dialect.go b/pkg/dialects/storm32/dialect.go index f2815e559..6815108c3 100644 --- a/pkg/dialects/storm32/dialect.go +++ b/pkg/dialects/storm32/dialect.go @@ -229,6 +229,9 @@ var dial = &dialect.Dialect{ &MessageCurrentEventSequence{}, &MessageRequestEvent{}, &MessageResponseEventError{}, + &MessageAvailableModes{}, + &MessageCurrentMode{}, + &MessageAvailableModesMonitor{}, &MessageIlluminatorStatus{}, &MessageCanfdFrame{}, &MessageCanFilterModify{}, diff --git a/pkg/dialects/storm32/enum_mav_cmd.go b/pkg/dialects/storm32/enum_mav_cmd.go index 55b866ce7..4b02c7774 100644 --- a/pkg/dialects/storm32/enum_mav_cmd.go +++ b/pkg/dialects/storm32/enum_mav_cmd.go @@ -203,6 +203,10 @@ const ( MAV_CMD_OVERRIDE_GOTO MAV_CMD = 252 // Mission command to set a Camera Auto Mount Pivoting Oblique Survey (Replaces CAM_TRIGG_DIST for this purpose). The camera is triggered each time this distance is exceeded, then the mount moves to the next position. Params 4~6 set-up the angle limits and number of positions for oblique survey, where mount-enabled vehicles automatically roll the camera between shots to emulate an oblique camera setup (providing an increased HFOV). This command can also be used to set the shutter integration time for the camera. MAV_CMD_OBLIQUE_SURVEY MAV_CMD = 260 + // Enable the specified standard MAVLink mode. + // If the specified mode is not supported, the vehicle should ACK with MAV_RESULT_FAILED. + // See https://mavlink.io/en/services/standard_modes.html + MAV_CMD_DO_SET_STANDARD_MODE MAV_CMD = 262 // start running a mission MAV_CMD_MISSION_START MAV_CMD = 300 // Actuator testing command. This is similar to MAV_CMD_DO_MOTOR_TEST but operates on the level of output functions, i.e. it is possible to test Motor1 independent from which output it is configured on. Autopilots typically refuse this command while armed. @@ -556,6 +560,7 @@ var labels_MAV_CMD = map[MAV_CMD]string{ MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN: "MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN", MAV_CMD_OVERRIDE_GOTO: "MAV_CMD_OVERRIDE_GOTO", MAV_CMD_OBLIQUE_SURVEY: "MAV_CMD_OBLIQUE_SURVEY", + MAV_CMD_DO_SET_STANDARD_MODE: "MAV_CMD_DO_SET_STANDARD_MODE", MAV_CMD_MISSION_START: "MAV_CMD_MISSION_START", MAV_CMD_ACTUATOR_TEST: "MAV_CMD_ACTUATOR_TEST", MAV_CMD_CONFIGURE_ACTUATOR: "MAV_CMD_CONFIGURE_ACTUATOR", @@ -759,6 +764,7 @@ var values_MAV_CMD = map[string]MAV_CMD{ "MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN": MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN, "MAV_CMD_OVERRIDE_GOTO": MAV_CMD_OVERRIDE_GOTO, "MAV_CMD_OBLIQUE_SURVEY": MAV_CMD_OBLIQUE_SURVEY, + "MAV_CMD_DO_SET_STANDARD_MODE": MAV_CMD_DO_SET_STANDARD_MODE, "MAV_CMD_MISSION_START": MAV_CMD_MISSION_START, "MAV_CMD_ACTUATOR_TEST": MAV_CMD_ACTUATOR_TEST, "MAV_CMD_CONFIGURE_ACTUATOR": MAV_CMD_CONFIGURE_ACTUATOR, diff --git a/pkg/dialects/storm32/enum_mav_mode_property.go b/pkg/dialects/storm32/enum_mav_mode_property.go new file mode 100644 index 000000000..29c4c177e --- /dev/null +++ b/pkg/dialects/storm32/enum_mav_mode_property.go @@ -0,0 +1,20 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll,dupl,gocritic +package storm32 + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// Mode properties. +type MAV_MODE_PROPERTY = common.MAV_MODE_PROPERTY + +const ( + // If set, this mode is an advanced mode. + // For example a rate-controlled manual mode might be advanced, whereas a position-controlled manual mode is not. + // A GCS can optionally use this flag to configure the UI for its intended users. + MAV_MODE_PROPERTY_ADVANCED MAV_MODE_PROPERTY = common.MAV_MODE_PROPERTY_ADVANCED + // If set, this mode should not be added to the list of selectable modes. + // The mode might still be selected by the FC directly (for example as part of a failsafe). + MAV_MODE_PROPERTY_NOT_USER_SELECTABLE MAV_MODE_PROPERTY = common.MAV_MODE_PROPERTY_NOT_USER_SELECTABLE +) diff --git a/pkg/dialects/storm32/enum_mav_standard_mode.go b/pkg/dialects/storm32/enum_mav_standard_mode.go new file mode 100644 index 000000000..7ba5f7399 --- /dev/null +++ b/pkg/dialects/storm32/enum_mav_standard_mode.go @@ -0,0 +1,72 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll,dupl,gocritic +package storm32 + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// Standard modes with a well understood meaning across flight stacks and vehicle types. +// For example, most flight stack have the concept of a "return" or "RTL" mode that takes a vehicle to safety, even though the precise mechanics of this mode may differ. +// The modes supported by a flight stack can be queried using AVAILABLE_MODES and set using MAV_CMD_DO_SET_STANDARD_MODE. +// The current mode is streamed in CURRENT_MODE. +// See https://mavlink.io/en/services/standard_modes.html +type MAV_STANDARD_MODE = common.MAV_STANDARD_MODE + +const ( + // Non standard mode. + // This may be used when reporting the mode if the current flight mode is not a standard mode. + MAV_STANDARD_MODE_NON_STANDARD MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_NON_STANDARD + // Position mode (manual). + // Position-controlled and stabilized manual mode. + // When sticks are released vehicles return to their level-flight orientation and hold both position and altitude against wind and external forces. + // This mode can only be set by vehicles that can hold a fixed position. + // Multicopter (MC) vehicles actively brake and hold both position and altitude against wind and external forces. + // Hybrid MC/FW ("VTOL") vehicles first transition to multicopter mode (if needed) but otherwise behave in the same way as MC vehicles. + // Fixed-wing (FW) vehicles must not support this mode. + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_POSITION_HOLD MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_POSITION_HOLD + // Orbit (manual). + // Position-controlled and stabilized manual mode. + // The vehicle circles around a fixed setpoint in the horizontal plane at a particular radius, altitude, and direction. + // Flight stacks may further allow manual control over the setpoint position, radius, direction, speed, and/or altitude of the circle, but this is not mandated. + // Flight stacks may support the [MAV_CMD_DO_ORBIT](https://mavlink.io/en/messages/common.html#MAV_CMD_DO_ORBIT) for changing the orbit parameters. + // MC and FW vehicles may support this mode. + // Hybrid MC/FW ("VTOL") vehicles may support this mode in MC/FW or both modes; if the mode is not supported by the current configuration the vehicle should transition to the supported configuration. + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_ORBIT MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_ORBIT + // Cruise mode (manual). + // Position-controlled and stabilized manual mode. + // When sticks are released vehicles return to their level-flight orientation and hold their original track against wind and external forces. + // Fixed-wing (FW) vehicles level orientation and maintain current track and altitude against wind and external forces. + // Hybrid MC/FW ("VTOL") vehicles first transition to FW mode (if needed) but otherwise behave in the same way as MC vehicles. + // Multicopter (MC) vehicles must not support this mode. + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_CRUISE MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_CRUISE + // Altitude hold (manual). + // Altitude-controlled and stabilized manual mode. + // When sticks are released vehicles return to their level-flight orientation and hold their altitude. + // MC vehicles continue with existing momentum and may move with wind (or other external forces). + // FW vehicles continue with current heading, but may be moved off-track by wind. + // Hybrid MC/FW ("VTOL") vehicles behave according to their current configuration/mode (FW or MC). + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_ALTITUDE_HOLD MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_ALTITUDE_HOLD + // Safe recovery mode (auto). + // Automatic mode that takes vehicle to a predefined safe location via a safe flight path, and may also automatically land the vehicle. + // This mode is more commonly referred to as RTL and/or or Smart RTL. + // The precise return location, flight path, and landing behaviour depend on vehicle configuration and type. + // For example, the vehicle might return to the home/launch location, a rally point, or the start of a mission landing, it might follow a direct path, mission path, or breadcrumb path, and land using a mission landing pattern or some other kind of descent. + MAV_STANDARD_MODE_SAFE_RECOVERY MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_SAFE_RECOVERY + // Mission mode (automatic). + // Automatic mode that executes MAVLink missions. + // Missions are executed from the current waypoint as soon as the mode is enabled. + MAV_STANDARD_MODE_MISSION MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_MISSION + // Land mode (auto). + // Automatic mode that lands the vehicle at the current location. + // The precise landing behaviour depends on vehicle configuration and type. + MAV_STANDARD_MODE_LAND MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_LAND + // Takeoff mode (auto). + // Automatic takeoff mode. + // The precise takeoff behaviour depends on vehicle configuration and type. + MAV_STANDARD_MODE_TAKEOFF MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_TAKEOFF +) diff --git a/pkg/dialects/storm32/message_available_modes.go b/pkg/dialects/storm32/message_available_modes.go new file mode 100644 index 000000000..53dd1e181 --- /dev/null +++ b/pkg/dialects/storm32/message_available_modes.go @@ -0,0 +1,16 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll +package storm32 + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// Information about a flight mode. +// The message can be enumerated to get information for all modes, or requested for a particular mode, using MAV_CMD_REQUEST_MESSAGE. +// Specify 0 in param2 to request that the message is emitted for all available modes or the specific index for just one mode. +// The modes must be available/settable for the current vehicle/frame type. +// Each mode should only be emitted once (even if it is both standard and custom). +// Note that the current mode should be emitted in CURRENT_MODE, and that if the mode list can change then AVAILABLE_MODES_MONITOR must be emitted on first change and subsequently streamed. +// See https://mavlink.io/en/services/standard_modes.html +type MessageAvailableModes = common.MessageAvailableModes diff --git a/pkg/dialects/storm32/message_available_modes_monitor.go b/pkg/dialects/storm32/message_available_modes_monitor.go new file mode 100644 index 000000000..5a85d19e4 --- /dev/null +++ b/pkg/dialects/storm32/message_available_modes_monitor.go @@ -0,0 +1,13 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll +package storm32 + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// A change to the sequence number indicates that the set of AVAILABLE_MODES has changed. +// A receiver must re-request all available modes whenever the sequence number changes. +// This is only emitted after the first change and should then be broadcast at low rate (nominally 0.3 Hz) and on change. +// See https://mavlink.io/en/services/standard_modes.html +type MessageAvailableModesMonitor = common.MessageAvailableModesMonitor diff --git a/pkg/dialects/storm32/message_current_mode.go b/pkg/dialects/storm32/message_current_mode.go new file mode 100644 index 000000000..95b25ffe4 --- /dev/null +++ b/pkg/dialects/storm32/message_current_mode.go @@ -0,0 +1,13 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll +package storm32 + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// Get the current mode. +// This should be emitted on any mode change, and broadcast at low rate (nominally 0.5 Hz). +// It may be requested using MAV_CMD_REQUEST_MESSAGE. +// See https://mavlink.io/en/services/standard_modes.html +type MessageCurrentMode = common.MessageCurrentMode diff --git a/pkg/dialects/ualberta/dialect.go b/pkg/dialects/ualberta/dialect.go index ea91ce441..86f870b7c 100644 --- a/pkg/dialects/ualberta/dialect.go +++ b/pkg/dialects/ualberta/dialect.go @@ -229,6 +229,9 @@ var dial = &dialect.Dialect{ &MessageCurrentEventSequence{}, &MessageRequestEvent{}, &MessageResponseEventError{}, + &MessageAvailableModes{}, + &MessageCurrentMode{}, + &MessageAvailableModesMonitor{}, &MessageIlluminatorStatus{}, &MessageCanfdFrame{}, &MessageCanFilterModify{}, diff --git a/pkg/dialects/ualberta/enum_mav_cmd.go b/pkg/dialects/ualberta/enum_mav_cmd.go index d4449b8b0..85b1402d3 100644 --- a/pkg/dialects/ualberta/enum_mav_cmd.go +++ b/pkg/dialects/ualberta/enum_mav_cmd.go @@ -202,6 +202,10 @@ const ( MAV_CMD_OVERRIDE_GOTO MAV_CMD = common.MAV_CMD_OVERRIDE_GOTO // Mission command to set a Camera Auto Mount Pivoting Oblique Survey (Replaces CAM_TRIGG_DIST for this purpose). The camera is triggered each time this distance is exceeded, then the mount moves to the next position. Params 4~6 set-up the angle limits and number of positions for oblique survey, where mount-enabled vehicles automatically roll the camera between shots to emulate an oblique camera setup (providing an increased HFOV). This command can also be used to set the shutter integration time for the camera. MAV_CMD_OBLIQUE_SURVEY MAV_CMD = common.MAV_CMD_OBLIQUE_SURVEY + // Enable the specified standard MAVLink mode. + // If the specified mode is not supported, the vehicle should ACK with MAV_RESULT_FAILED. + // See https://mavlink.io/en/services/standard_modes.html + MAV_CMD_DO_SET_STANDARD_MODE MAV_CMD = common.MAV_CMD_DO_SET_STANDARD_MODE // start running a mission MAV_CMD_MISSION_START MAV_CMD = common.MAV_CMD_MISSION_START // Actuator testing command. This is similar to MAV_CMD_DO_MOTOR_TEST but operates on the level of output functions, i.e. it is possible to test Motor1 independent from which output it is configured on. Autopilots typically refuse this command while armed. diff --git a/pkg/dialects/ualberta/enum_mav_mode_property.go b/pkg/dialects/ualberta/enum_mav_mode_property.go new file mode 100644 index 000000000..0b1a71e07 --- /dev/null +++ b/pkg/dialects/ualberta/enum_mav_mode_property.go @@ -0,0 +1,20 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll,dupl,gocritic +package ualberta + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// Mode properties. +type MAV_MODE_PROPERTY = common.MAV_MODE_PROPERTY + +const ( + // If set, this mode is an advanced mode. + // For example a rate-controlled manual mode might be advanced, whereas a position-controlled manual mode is not. + // A GCS can optionally use this flag to configure the UI for its intended users. + MAV_MODE_PROPERTY_ADVANCED MAV_MODE_PROPERTY = common.MAV_MODE_PROPERTY_ADVANCED + // If set, this mode should not be added to the list of selectable modes. + // The mode might still be selected by the FC directly (for example as part of a failsafe). + MAV_MODE_PROPERTY_NOT_USER_SELECTABLE MAV_MODE_PROPERTY = common.MAV_MODE_PROPERTY_NOT_USER_SELECTABLE +) diff --git a/pkg/dialects/ualberta/enum_mav_standard_mode.go b/pkg/dialects/ualberta/enum_mav_standard_mode.go new file mode 100644 index 000000000..09285b93e --- /dev/null +++ b/pkg/dialects/ualberta/enum_mav_standard_mode.go @@ -0,0 +1,72 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll,dupl,gocritic +package ualberta + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// Standard modes with a well understood meaning across flight stacks and vehicle types. +// For example, most flight stack have the concept of a "return" or "RTL" mode that takes a vehicle to safety, even though the precise mechanics of this mode may differ. +// The modes supported by a flight stack can be queried using AVAILABLE_MODES and set using MAV_CMD_DO_SET_STANDARD_MODE. +// The current mode is streamed in CURRENT_MODE. +// See https://mavlink.io/en/services/standard_modes.html +type MAV_STANDARD_MODE = common.MAV_STANDARD_MODE + +const ( + // Non standard mode. + // This may be used when reporting the mode if the current flight mode is not a standard mode. + MAV_STANDARD_MODE_NON_STANDARD MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_NON_STANDARD + // Position mode (manual). + // Position-controlled and stabilized manual mode. + // When sticks are released vehicles return to their level-flight orientation and hold both position and altitude against wind and external forces. + // This mode can only be set by vehicles that can hold a fixed position. + // Multicopter (MC) vehicles actively brake and hold both position and altitude against wind and external forces. + // Hybrid MC/FW ("VTOL") vehicles first transition to multicopter mode (if needed) but otherwise behave in the same way as MC vehicles. + // Fixed-wing (FW) vehicles must not support this mode. + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_POSITION_HOLD MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_POSITION_HOLD + // Orbit (manual). + // Position-controlled and stabilized manual mode. + // The vehicle circles around a fixed setpoint in the horizontal plane at a particular radius, altitude, and direction. + // Flight stacks may further allow manual control over the setpoint position, radius, direction, speed, and/or altitude of the circle, but this is not mandated. + // Flight stacks may support the [MAV_CMD_DO_ORBIT](https://mavlink.io/en/messages/common.html#MAV_CMD_DO_ORBIT) for changing the orbit parameters. + // MC and FW vehicles may support this mode. + // Hybrid MC/FW ("VTOL") vehicles may support this mode in MC/FW or both modes; if the mode is not supported by the current configuration the vehicle should transition to the supported configuration. + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_ORBIT MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_ORBIT + // Cruise mode (manual). + // Position-controlled and stabilized manual mode. + // When sticks are released vehicles return to their level-flight orientation and hold their original track against wind and external forces. + // Fixed-wing (FW) vehicles level orientation and maintain current track and altitude against wind and external forces. + // Hybrid MC/FW ("VTOL") vehicles first transition to FW mode (if needed) but otherwise behave in the same way as MC vehicles. + // Multicopter (MC) vehicles must not support this mode. + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_CRUISE MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_CRUISE + // Altitude hold (manual). + // Altitude-controlled and stabilized manual mode. + // When sticks are released vehicles return to their level-flight orientation and hold their altitude. + // MC vehicles continue with existing momentum and may move with wind (or other external forces). + // FW vehicles continue with current heading, but may be moved off-track by wind. + // Hybrid MC/FW ("VTOL") vehicles behave according to their current configuration/mode (FW or MC). + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_ALTITUDE_HOLD MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_ALTITUDE_HOLD + // Safe recovery mode (auto). + // Automatic mode that takes vehicle to a predefined safe location via a safe flight path, and may also automatically land the vehicle. + // This mode is more commonly referred to as RTL and/or or Smart RTL. + // The precise return location, flight path, and landing behaviour depend on vehicle configuration and type. + // For example, the vehicle might return to the home/launch location, a rally point, or the start of a mission landing, it might follow a direct path, mission path, or breadcrumb path, and land using a mission landing pattern or some other kind of descent. + MAV_STANDARD_MODE_SAFE_RECOVERY MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_SAFE_RECOVERY + // Mission mode (automatic). + // Automatic mode that executes MAVLink missions. + // Missions are executed from the current waypoint as soon as the mode is enabled. + MAV_STANDARD_MODE_MISSION MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_MISSION + // Land mode (auto). + // Automatic mode that lands the vehicle at the current location. + // The precise landing behaviour depends on vehicle configuration and type. + MAV_STANDARD_MODE_LAND MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_LAND + // Takeoff mode (auto). + // Automatic takeoff mode. + // The precise takeoff behaviour depends on vehicle configuration and type. + MAV_STANDARD_MODE_TAKEOFF MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_TAKEOFF +) diff --git a/pkg/dialects/ualberta/message_available_modes.go b/pkg/dialects/ualberta/message_available_modes.go new file mode 100644 index 000000000..b416ba0b1 --- /dev/null +++ b/pkg/dialects/ualberta/message_available_modes.go @@ -0,0 +1,16 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll +package ualberta + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// Information about a flight mode. +// The message can be enumerated to get information for all modes, or requested for a particular mode, using MAV_CMD_REQUEST_MESSAGE. +// Specify 0 in param2 to request that the message is emitted for all available modes or the specific index for just one mode. +// The modes must be available/settable for the current vehicle/frame type. +// Each mode should only be emitted once (even if it is both standard and custom). +// Note that the current mode should be emitted in CURRENT_MODE, and that if the mode list can change then AVAILABLE_MODES_MONITOR must be emitted on first change and subsequently streamed. +// See https://mavlink.io/en/services/standard_modes.html +type MessageAvailableModes = common.MessageAvailableModes diff --git a/pkg/dialects/ualberta/message_available_modes_monitor.go b/pkg/dialects/ualberta/message_available_modes_monitor.go new file mode 100644 index 000000000..1de2e46f0 --- /dev/null +++ b/pkg/dialects/ualberta/message_available_modes_monitor.go @@ -0,0 +1,13 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll +package ualberta + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// A change to the sequence number indicates that the set of AVAILABLE_MODES has changed. +// A receiver must re-request all available modes whenever the sequence number changes. +// This is only emitted after the first change and should then be broadcast at low rate (nominally 0.3 Hz) and on change. +// See https://mavlink.io/en/services/standard_modes.html +type MessageAvailableModesMonitor = common.MessageAvailableModesMonitor diff --git a/pkg/dialects/ualberta/message_current_mode.go b/pkg/dialects/ualberta/message_current_mode.go new file mode 100644 index 000000000..80ce87dce --- /dev/null +++ b/pkg/dialects/ualberta/message_current_mode.go @@ -0,0 +1,13 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll +package ualberta + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// Get the current mode. +// This should be emitted on any mode change, and broadcast at low rate (nominally 0.5 Hz). +// It may be requested using MAV_CMD_REQUEST_MESSAGE. +// See https://mavlink.io/en/services/standard_modes.html +type MessageCurrentMode = common.MessageCurrentMode diff --git a/pkg/dialects/uavionix/dialect.go b/pkg/dialects/uavionix/dialect.go index 996fa9817..7c1800e6a 100644 --- a/pkg/dialects/uavionix/dialect.go +++ b/pkg/dialects/uavionix/dialect.go @@ -229,6 +229,9 @@ var dial = &dialect.Dialect{ &MessageCurrentEventSequence{}, &MessageRequestEvent{}, &MessageResponseEventError{}, + &MessageAvailableModes{}, + &MessageCurrentMode{}, + &MessageAvailableModesMonitor{}, &MessageIlluminatorStatus{}, &MessageCanfdFrame{}, &MessageCanFilterModify{}, diff --git a/pkg/dialects/uavionix/enum_mav_cmd.go b/pkg/dialects/uavionix/enum_mav_cmd.go index e45c9e372..828da4181 100644 --- a/pkg/dialects/uavionix/enum_mav_cmd.go +++ b/pkg/dialects/uavionix/enum_mav_cmd.go @@ -202,6 +202,10 @@ const ( MAV_CMD_OVERRIDE_GOTO MAV_CMD = common.MAV_CMD_OVERRIDE_GOTO // Mission command to set a Camera Auto Mount Pivoting Oblique Survey (Replaces CAM_TRIGG_DIST for this purpose). The camera is triggered each time this distance is exceeded, then the mount moves to the next position. Params 4~6 set-up the angle limits and number of positions for oblique survey, where mount-enabled vehicles automatically roll the camera between shots to emulate an oblique camera setup (providing an increased HFOV). This command can also be used to set the shutter integration time for the camera. MAV_CMD_OBLIQUE_SURVEY MAV_CMD = common.MAV_CMD_OBLIQUE_SURVEY + // Enable the specified standard MAVLink mode. + // If the specified mode is not supported, the vehicle should ACK with MAV_RESULT_FAILED. + // See https://mavlink.io/en/services/standard_modes.html + MAV_CMD_DO_SET_STANDARD_MODE MAV_CMD = common.MAV_CMD_DO_SET_STANDARD_MODE // start running a mission MAV_CMD_MISSION_START MAV_CMD = common.MAV_CMD_MISSION_START // Actuator testing command. This is similar to MAV_CMD_DO_MOTOR_TEST but operates on the level of output functions, i.e. it is possible to test Motor1 independent from which output it is configured on. Autopilots typically refuse this command while armed. diff --git a/pkg/dialects/uavionix/enum_mav_mode_property.go b/pkg/dialects/uavionix/enum_mav_mode_property.go new file mode 100644 index 000000000..e75bc177b --- /dev/null +++ b/pkg/dialects/uavionix/enum_mav_mode_property.go @@ -0,0 +1,20 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll,dupl,gocritic +package uavionix + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// Mode properties. +type MAV_MODE_PROPERTY = common.MAV_MODE_PROPERTY + +const ( + // If set, this mode is an advanced mode. + // For example a rate-controlled manual mode might be advanced, whereas a position-controlled manual mode is not. + // A GCS can optionally use this flag to configure the UI for its intended users. + MAV_MODE_PROPERTY_ADVANCED MAV_MODE_PROPERTY = common.MAV_MODE_PROPERTY_ADVANCED + // If set, this mode should not be added to the list of selectable modes. + // The mode might still be selected by the FC directly (for example as part of a failsafe). + MAV_MODE_PROPERTY_NOT_USER_SELECTABLE MAV_MODE_PROPERTY = common.MAV_MODE_PROPERTY_NOT_USER_SELECTABLE +) diff --git a/pkg/dialects/uavionix/enum_mav_standard_mode.go b/pkg/dialects/uavionix/enum_mav_standard_mode.go new file mode 100644 index 000000000..6760a9ba3 --- /dev/null +++ b/pkg/dialects/uavionix/enum_mav_standard_mode.go @@ -0,0 +1,72 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll,dupl,gocritic +package uavionix + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// Standard modes with a well understood meaning across flight stacks and vehicle types. +// For example, most flight stack have the concept of a "return" or "RTL" mode that takes a vehicle to safety, even though the precise mechanics of this mode may differ. +// The modes supported by a flight stack can be queried using AVAILABLE_MODES and set using MAV_CMD_DO_SET_STANDARD_MODE. +// The current mode is streamed in CURRENT_MODE. +// See https://mavlink.io/en/services/standard_modes.html +type MAV_STANDARD_MODE = common.MAV_STANDARD_MODE + +const ( + // Non standard mode. + // This may be used when reporting the mode if the current flight mode is not a standard mode. + MAV_STANDARD_MODE_NON_STANDARD MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_NON_STANDARD + // Position mode (manual). + // Position-controlled and stabilized manual mode. + // When sticks are released vehicles return to their level-flight orientation and hold both position and altitude against wind and external forces. + // This mode can only be set by vehicles that can hold a fixed position. + // Multicopter (MC) vehicles actively brake and hold both position and altitude against wind and external forces. + // Hybrid MC/FW ("VTOL") vehicles first transition to multicopter mode (if needed) but otherwise behave in the same way as MC vehicles. + // Fixed-wing (FW) vehicles must not support this mode. + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_POSITION_HOLD MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_POSITION_HOLD + // Orbit (manual). + // Position-controlled and stabilized manual mode. + // The vehicle circles around a fixed setpoint in the horizontal plane at a particular radius, altitude, and direction. + // Flight stacks may further allow manual control over the setpoint position, radius, direction, speed, and/or altitude of the circle, but this is not mandated. + // Flight stacks may support the [MAV_CMD_DO_ORBIT](https://mavlink.io/en/messages/common.html#MAV_CMD_DO_ORBIT) for changing the orbit parameters. + // MC and FW vehicles may support this mode. + // Hybrid MC/FW ("VTOL") vehicles may support this mode in MC/FW or both modes; if the mode is not supported by the current configuration the vehicle should transition to the supported configuration. + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_ORBIT MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_ORBIT + // Cruise mode (manual). + // Position-controlled and stabilized manual mode. + // When sticks are released vehicles return to their level-flight orientation and hold their original track against wind and external forces. + // Fixed-wing (FW) vehicles level orientation and maintain current track and altitude against wind and external forces. + // Hybrid MC/FW ("VTOL") vehicles first transition to FW mode (if needed) but otherwise behave in the same way as MC vehicles. + // Multicopter (MC) vehicles must not support this mode. + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_CRUISE MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_CRUISE + // Altitude hold (manual). + // Altitude-controlled and stabilized manual mode. + // When sticks are released vehicles return to their level-flight orientation and hold their altitude. + // MC vehicles continue with existing momentum and may move with wind (or other external forces). + // FW vehicles continue with current heading, but may be moved off-track by wind. + // Hybrid MC/FW ("VTOL") vehicles behave according to their current configuration/mode (FW or MC). + // Other vehicle types must not support this mode (this may be revisited through the PR process). + MAV_STANDARD_MODE_ALTITUDE_HOLD MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_ALTITUDE_HOLD + // Safe recovery mode (auto). + // Automatic mode that takes vehicle to a predefined safe location via a safe flight path, and may also automatically land the vehicle. + // This mode is more commonly referred to as RTL and/or or Smart RTL. + // The precise return location, flight path, and landing behaviour depend on vehicle configuration and type. + // For example, the vehicle might return to the home/launch location, a rally point, or the start of a mission landing, it might follow a direct path, mission path, or breadcrumb path, and land using a mission landing pattern or some other kind of descent. + MAV_STANDARD_MODE_SAFE_RECOVERY MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_SAFE_RECOVERY + // Mission mode (automatic). + // Automatic mode that executes MAVLink missions. + // Missions are executed from the current waypoint as soon as the mode is enabled. + MAV_STANDARD_MODE_MISSION MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_MISSION + // Land mode (auto). + // Automatic mode that lands the vehicle at the current location. + // The precise landing behaviour depends on vehicle configuration and type. + MAV_STANDARD_MODE_LAND MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_LAND + // Takeoff mode (auto). + // Automatic takeoff mode. + // The precise takeoff behaviour depends on vehicle configuration and type. + MAV_STANDARD_MODE_TAKEOFF MAV_STANDARD_MODE = common.MAV_STANDARD_MODE_TAKEOFF +) diff --git a/pkg/dialects/uavionix/message_available_modes.go b/pkg/dialects/uavionix/message_available_modes.go new file mode 100644 index 000000000..bea8bcc73 --- /dev/null +++ b/pkg/dialects/uavionix/message_available_modes.go @@ -0,0 +1,16 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll +package uavionix + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// Information about a flight mode. +// The message can be enumerated to get information for all modes, or requested for a particular mode, using MAV_CMD_REQUEST_MESSAGE. +// Specify 0 in param2 to request that the message is emitted for all available modes or the specific index for just one mode. +// The modes must be available/settable for the current vehicle/frame type. +// Each mode should only be emitted once (even if it is both standard and custom). +// Note that the current mode should be emitted in CURRENT_MODE, and that if the mode list can change then AVAILABLE_MODES_MONITOR must be emitted on first change and subsequently streamed. +// See https://mavlink.io/en/services/standard_modes.html +type MessageAvailableModes = common.MessageAvailableModes diff --git a/pkg/dialects/uavionix/message_available_modes_monitor.go b/pkg/dialects/uavionix/message_available_modes_monitor.go new file mode 100644 index 000000000..7ce6b0b75 --- /dev/null +++ b/pkg/dialects/uavionix/message_available_modes_monitor.go @@ -0,0 +1,13 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll +package uavionix + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// A change to the sequence number indicates that the set of AVAILABLE_MODES has changed. +// A receiver must re-request all available modes whenever the sequence number changes. +// This is only emitted after the first change and should then be broadcast at low rate (nominally 0.3 Hz) and on change. +// See https://mavlink.io/en/services/standard_modes.html +type MessageAvailableModesMonitor = common.MessageAvailableModesMonitor diff --git a/pkg/dialects/uavionix/message_current_mode.go b/pkg/dialects/uavionix/message_current_mode.go new file mode 100644 index 000000000..089ada307 --- /dev/null +++ b/pkg/dialects/uavionix/message_current_mode.go @@ -0,0 +1,13 @@ +//autogenerated:yes +//nolint:revive,misspell,govet,lll +package uavionix + +import ( + "github.com/bluenviron/gomavlib/v3/pkg/dialects/common" +) + +// Get the current mode. +// This should be emitted on any mode change, and broadcast at low rate (nominally 0.5 Hz). +// It may be requested using MAV_CMD_REQUEST_MESSAGE. +// See https://mavlink.io/en/services/standard_modes.html +type MessageCurrentMode = common.MessageCurrentMode