github.com/bluenviron/gomavlib/v2@v2.2.1-0.20240308101627-2c07e3da629c/pkg/dialects/development/enum_mav_standard_mode.go (about)

     1  //autogenerated:yes
     2  //nolint:revive,misspell,govet,lll,dupl,gocritic
     3  package development
     4  
     5  import (
     6  	"fmt"
     7  	"strconv"
     8  )
     9  
    10  // Standard modes with a well understood meaning across flight stacks and vehicle types.
    11  // 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.
    12  // Modes may be set using MAV_CMD_DO_SET_STANDARD_MODE.
    13  type MAV_STANDARD_MODE uint64
    14  
    15  const (
    16  	// Non standard mode.
    17  	// This may be used when reporting the mode if the current flight mode is not a standard mode.
    18  	MAV_STANDARD_MODE_NON_STANDARD MAV_STANDARD_MODE = 0
    19  	// Position mode (manual).
    20  	// Position-controlled and stabilized manual mode.
    21  	// When sticks are released vehicles return to their level-flight orientation and hold both position and altitude against wind and external forces.
    22  	// This mode can only be set by vehicles that can hold a fixed position.
    23  	// Multicopter (MC) vehicles actively brake and hold both position and altitude against wind and external forces.
    24  	// Hybrid MC/FW ("VTOL") vehicles first transition to multicopter mode (if needed) but otherwise behave in the same way as MC vehicles.
    25  	// Fixed-wing (FW) vehicles must not support this mode.
    26  	// Other vehicle types must not support this mode (this may be revisited through the PR process).
    27  	MAV_STANDARD_MODE_POSITION_HOLD MAV_STANDARD_MODE = 1
    28  	// Orbit (manual).
    29  	// Position-controlled and stabilized manual mode.
    30  	// The vehicle circles around a fixed setpoint in the horizontal plane at a particular radius, altitude, and direction.
    31  	// 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.
    32  	// 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.
    33  	// MC and FW vehicles may support this mode.
    34  	// 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.
    35  	// Other vehicle types must not support this mode (this may be revisited through the PR process).
    36  	MAV_STANDARD_MODE_ORBIT MAV_STANDARD_MODE = 2
    37  	// Cruise mode (manual).
    38  	// Position-controlled and stabilized manual mode.
    39  	// When sticks are released vehicles return to their level-flight orientation and hold their original track against wind and external forces.
    40  	// Fixed-wing (FW) vehicles level orientation and maintain current track and altitude against wind and external forces.
    41  	// Hybrid MC/FW ("VTOL") vehicles first transition to FW mode (if needed) but otherwise behave in the same way as MC vehicles.
    42  	// Multicopter (MC) vehicles must not support this mode.
    43  	// Other vehicle types must not support this mode (this may be revisited through the PR process).
    44  	MAV_STANDARD_MODE_CRUISE MAV_STANDARD_MODE = 3
    45  	// Altitude hold (manual).
    46  	// Altitude-controlled and stabilized manual mode.
    47  	// When sticks are released vehicles return to their level-flight orientation and hold their altitude.
    48  	// MC vehicles continue with existing momentum and may move with wind (or other external forces).
    49  	// FW vehicles continue with current heading, but may be moved off-track by wind.
    50  	// Hybrid MC/FW ("VTOL") vehicles behave according to their current configuration/mode (FW or MC).
    51  	// Other vehicle types must not support this mode (this may be revisited through the PR process).
    52  	MAV_STANDARD_MODE_ALTITUDE_HOLD MAV_STANDARD_MODE = 4
    53  	// Return home mode (auto).
    54  	// Automatic mode that returns vehicle to home via a safe flight path.
    55  	// It may also automatically land the vehicle (i.e. RTL).
    56  	// The precise flight path and landing behaviour depend on vehicle configuration and type.
    57  	MAV_STANDARD_MODE_RETURN_HOME MAV_STANDARD_MODE = 5
    58  	// Safe recovery mode (auto).
    59  	// Automatic mode that takes vehicle to a predefined safe location via a safe flight path (rally point or mission defined landing) .
    60  	// It may also automatically land the vehicle.
    61  	// The precise return location, flight path, and landing behaviour depend on vehicle configuration and type.
    62  	MAV_STANDARD_MODE_SAFE_RECOVERY MAV_STANDARD_MODE = 6
    63  	// Mission mode (automatic).
    64  	// Automatic mode that executes MAVLink missions.
    65  	// Missions are executed from the current waypoint as soon as the mode is enabled.
    66  	MAV_STANDARD_MODE_MISSION MAV_STANDARD_MODE = 7
    67  	// Land mode (auto).
    68  	// Automatic mode that lands the vehicle at the current location.
    69  	// The precise landing behaviour depends on vehicle configuration and type.
    70  	MAV_STANDARD_MODE_LAND MAV_STANDARD_MODE = 8
    71  	// Takeoff mode (auto).
    72  	// Automatic takeoff mode.
    73  	// The precise takeoff behaviour depends on vehicle configuration and type.
    74  	MAV_STANDARD_MODE_TAKEOFF MAV_STANDARD_MODE = 9
    75  )
    76  
    77  var labels_MAV_STANDARD_MODE = map[MAV_STANDARD_MODE]string{
    78  	MAV_STANDARD_MODE_NON_STANDARD:  "MAV_STANDARD_MODE_NON_STANDARD",
    79  	MAV_STANDARD_MODE_POSITION_HOLD: "MAV_STANDARD_MODE_POSITION_HOLD",
    80  	MAV_STANDARD_MODE_ORBIT:         "MAV_STANDARD_MODE_ORBIT",
    81  	MAV_STANDARD_MODE_CRUISE:        "MAV_STANDARD_MODE_CRUISE",
    82  	MAV_STANDARD_MODE_ALTITUDE_HOLD: "MAV_STANDARD_MODE_ALTITUDE_HOLD",
    83  	MAV_STANDARD_MODE_RETURN_HOME:   "MAV_STANDARD_MODE_RETURN_HOME",
    84  	MAV_STANDARD_MODE_SAFE_RECOVERY: "MAV_STANDARD_MODE_SAFE_RECOVERY",
    85  	MAV_STANDARD_MODE_MISSION:       "MAV_STANDARD_MODE_MISSION",
    86  	MAV_STANDARD_MODE_LAND:          "MAV_STANDARD_MODE_LAND",
    87  	MAV_STANDARD_MODE_TAKEOFF:       "MAV_STANDARD_MODE_TAKEOFF",
    88  }
    89  
    90  var values_MAV_STANDARD_MODE = map[string]MAV_STANDARD_MODE{
    91  	"MAV_STANDARD_MODE_NON_STANDARD":  MAV_STANDARD_MODE_NON_STANDARD,
    92  	"MAV_STANDARD_MODE_POSITION_HOLD": MAV_STANDARD_MODE_POSITION_HOLD,
    93  	"MAV_STANDARD_MODE_ORBIT":         MAV_STANDARD_MODE_ORBIT,
    94  	"MAV_STANDARD_MODE_CRUISE":        MAV_STANDARD_MODE_CRUISE,
    95  	"MAV_STANDARD_MODE_ALTITUDE_HOLD": MAV_STANDARD_MODE_ALTITUDE_HOLD,
    96  	"MAV_STANDARD_MODE_RETURN_HOME":   MAV_STANDARD_MODE_RETURN_HOME,
    97  	"MAV_STANDARD_MODE_SAFE_RECOVERY": MAV_STANDARD_MODE_SAFE_RECOVERY,
    98  	"MAV_STANDARD_MODE_MISSION":       MAV_STANDARD_MODE_MISSION,
    99  	"MAV_STANDARD_MODE_LAND":          MAV_STANDARD_MODE_LAND,
   100  	"MAV_STANDARD_MODE_TAKEOFF":       MAV_STANDARD_MODE_TAKEOFF,
   101  }
   102  
   103  // MarshalText implements the encoding.TextMarshaler interface.
   104  func (e MAV_STANDARD_MODE) MarshalText() ([]byte, error) {
   105  	if name, ok := labels_MAV_STANDARD_MODE[e]; ok {
   106  		return []byte(name), nil
   107  	}
   108  	return []byte(strconv.Itoa(int(e))), nil
   109  }
   110  
   111  // UnmarshalText implements the encoding.TextUnmarshaler interface.
   112  func (e *MAV_STANDARD_MODE) UnmarshalText(text []byte) error {
   113  	if value, ok := values_MAV_STANDARD_MODE[string(text)]; ok {
   114  		*e = value
   115  	} else if value, err := strconv.Atoi(string(text)); err == nil {
   116  		*e = MAV_STANDARD_MODE(value)
   117  	} else {
   118  		return fmt.Errorf("invalid label '%s'", text)
   119  	}
   120  	return nil
   121  }
   122  
   123  // String implements the fmt.Stringer interface.
   124  func (e MAV_STANDARD_MODE) String() string {
   125  	val, _ := e.MarshalText()
   126  	return string(val)
   127  }