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

     1  //autogenerated:yes
     2  //nolint:revive,misspell,govet,lll,dupl,gocritic
     3  package common
     4  
     5  import (
     6  	"fmt"
     7  	"strconv"
     8  )
     9  
    10  // Coordinate frames used by MAVLink. Not all frames are supported by all commands, messages, or vehicles.
    11  // Global frames use the following naming conventions:
    12  // - "GLOBAL": Global coordinate frame with WGS84 latitude/longitude and altitude positive over mean sea level (MSL) by default.
    13  // The following modifiers may be used with "GLOBAL":
    14  // - "RELATIVE_ALT": Altitude is relative to the vehicle home position rather than MSL.
    15  // - "TERRAIN_ALT": Altitude is relative to ground level rather than MSL.
    16  // - "INT": Latitude/longitude (in degrees) are scaled by multiplying by 1E7.
    17  // Local frames use the following naming conventions:
    18  // - "LOCAL": Origin of local frame is fixed relative to earth. Unless otherwise specified this origin is the origin of the vehicle position-estimator ("EKF").
    19  // - "BODY": Origin of local frame travels with the vehicle. NOTE, "BODY" does NOT indicate alignment of frame axis with vehicle attitude.
    20  // - "OFFSET": Deprecated synonym for "BODY" (origin travels with the vehicle). Not to be used for new frames.
    21  // Some deprecated frames do not follow these conventions (e.g. MAV_FRAME_BODY_NED and MAV_FRAME_BODY_OFFSET_NED).
    22  type MAV_FRAME uint64
    23  
    24  const (
    25  	// Global (WGS84) coordinate frame + MSL altitude. First value / x: latitude, second value / y: longitude, third value / z: positive altitude over mean sea level (MSL).
    26  	MAV_FRAME_GLOBAL MAV_FRAME = 0
    27  	// NED local tangent frame (x: North, y: East, z: Down) with origin fixed relative to earth.
    28  	MAV_FRAME_LOCAL_NED MAV_FRAME = 1
    29  	// NOT a coordinate frame, indicates a mission command.
    30  	MAV_FRAME_MISSION MAV_FRAME = 2
    31  	// Global (WGS84) coordinate frame + altitude relative to the home position.
    32  	// First value / x: latitude, second value / y: longitude, third value / z: positive altitude with 0 being at the altitude of the home position.
    33  	MAV_FRAME_GLOBAL_RELATIVE_ALT MAV_FRAME = 3
    34  	// ENU local tangent frame (x: East, y: North, z: Up) with origin fixed relative to earth.
    35  	MAV_FRAME_LOCAL_ENU MAV_FRAME = 4
    36  	// Global (WGS84) coordinate frame (scaled) + MSL altitude. First value / x: latitude in degrees*1E7, second value / y: longitude in degrees*1E7, third value / z: positive altitude over mean sea level (MSL).
    37  	MAV_FRAME_GLOBAL_INT MAV_FRAME = 5
    38  	// Global (WGS84) coordinate frame (scaled) + altitude relative to the home position.
    39  	// First value / x: latitude in degrees*1E7, second value / y: longitude in degrees*1E7, third value / z: positive altitude with 0 being at the altitude of the home position.
    40  	MAV_FRAME_GLOBAL_RELATIVE_ALT_INT MAV_FRAME = 6
    41  	// NED local tangent frame (x: North, y: East, z: Down) with origin that travels with the vehicle.
    42  	MAV_FRAME_LOCAL_OFFSET_NED MAV_FRAME = 7
    43  	// Same as MAV_FRAME_LOCAL_NED when used to represent position values. Same as MAV_FRAME_BODY_FRD when used with velocity/acceleration values.
    44  	MAV_FRAME_BODY_NED MAV_FRAME = 8
    45  	// This is the same as MAV_FRAME_BODY_FRD.
    46  	MAV_FRAME_BODY_OFFSET_NED MAV_FRAME = 9
    47  	// Global (WGS84) coordinate frame with AGL altitude (at the waypoint coordinate). First value / x: latitude in degrees, second value / y: longitude in degrees, third value / z: positive altitude in meters with 0 being at ground level in terrain model.
    48  	MAV_FRAME_GLOBAL_TERRAIN_ALT MAV_FRAME = 10
    49  	// Global (WGS84) coordinate frame (scaled) with AGL altitude (at the waypoint coordinate). First value / x: latitude in degrees*1E7, second value / y: longitude in degrees*1E7, third value / z: positive altitude in meters with 0 being at ground level in terrain model.
    50  	MAV_FRAME_GLOBAL_TERRAIN_ALT_INT MAV_FRAME = 11
    51  	// FRD local frame aligned to the vehicle's attitude (x: Forward, y: Right, z: Down) with an origin that travels with vehicle.
    52  	MAV_FRAME_BODY_FRD MAV_FRAME = 12
    53  	// MAV_FRAME_BODY_FLU - Body fixed frame of reference, Z-up (x: Forward, y: Left, z: Up).
    54  	MAV_FRAME_RESERVED_13 MAV_FRAME = 13
    55  	// MAV_FRAME_MOCAP_NED - Odometry local coordinate frame of data given by a motion capture system, Z-down (x: North, y: East, z: Down).
    56  	MAV_FRAME_RESERVED_14 MAV_FRAME = 14
    57  	// MAV_FRAME_MOCAP_ENU - Odometry local coordinate frame of data given by a motion capture system, Z-up (x: East, y: North, z: Up).
    58  	MAV_FRAME_RESERVED_15 MAV_FRAME = 15
    59  	// MAV_FRAME_VISION_NED - Odometry local coordinate frame of data given by a vision estimation system, Z-down (x: North, y: East, z: Down).
    60  	MAV_FRAME_RESERVED_16 MAV_FRAME = 16
    61  	// MAV_FRAME_VISION_ENU - Odometry local coordinate frame of data given by a vision estimation system, Z-up (x: East, y: North, z: Up).
    62  	MAV_FRAME_RESERVED_17 MAV_FRAME = 17
    63  	// MAV_FRAME_ESTIM_NED - Odometry local coordinate frame of data given by an estimator running onboard the vehicle, Z-down (x: North, y: East, z: Down).
    64  	MAV_FRAME_RESERVED_18 MAV_FRAME = 18
    65  	// MAV_FRAME_ESTIM_ENU - Odometry local coordinate frame of data given by an estimator running onboard the vehicle, Z-up (x: East, y: North, z: Up).
    66  	MAV_FRAME_RESERVED_19 MAV_FRAME = 19
    67  	// FRD local tangent frame (x: Forward, y: Right, z: Down) with origin fixed relative to earth. The forward axis is aligned to the front of the vehicle in the horizontal plane.
    68  	MAV_FRAME_LOCAL_FRD MAV_FRAME = 20
    69  	// FLU local tangent frame (x: Forward, y: Left, z: Up) with origin fixed relative to earth. The forward axis is aligned to the front of the vehicle in the horizontal plane.
    70  	MAV_FRAME_LOCAL_FLU MAV_FRAME = 21
    71  )
    72  
    73  var labels_MAV_FRAME = map[MAV_FRAME]string{
    74  	MAV_FRAME_GLOBAL:                  "MAV_FRAME_GLOBAL",
    75  	MAV_FRAME_LOCAL_NED:               "MAV_FRAME_LOCAL_NED",
    76  	MAV_FRAME_MISSION:                 "MAV_FRAME_MISSION",
    77  	MAV_FRAME_GLOBAL_RELATIVE_ALT:     "MAV_FRAME_GLOBAL_RELATIVE_ALT",
    78  	MAV_FRAME_LOCAL_ENU:               "MAV_FRAME_LOCAL_ENU",
    79  	MAV_FRAME_GLOBAL_INT:              "MAV_FRAME_GLOBAL_INT",
    80  	MAV_FRAME_GLOBAL_RELATIVE_ALT_INT: "MAV_FRAME_GLOBAL_RELATIVE_ALT_INT",
    81  	MAV_FRAME_LOCAL_OFFSET_NED:        "MAV_FRAME_LOCAL_OFFSET_NED",
    82  	MAV_FRAME_BODY_NED:                "MAV_FRAME_BODY_NED",
    83  	MAV_FRAME_BODY_OFFSET_NED:         "MAV_FRAME_BODY_OFFSET_NED",
    84  	MAV_FRAME_GLOBAL_TERRAIN_ALT:      "MAV_FRAME_GLOBAL_TERRAIN_ALT",
    85  	MAV_FRAME_GLOBAL_TERRAIN_ALT_INT:  "MAV_FRAME_GLOBAL_TERRAIN_ALT_INT",
    86  	MAV_FRAME_BODY_FRD:                "MAV_FRAME_BODY_FRD",
    87  	MAV_FRAME_RESERVED_13:             "MAV_FRAME_RESERVED_13",
    88  	MAV_FRAME_RESERVED_14:             "MAV_FRAME_RESERVED_14",
    89  	MAV_FRAME_RESERVED_15:             "MAV_FRAME_RESERVED_15",
    90  	MAV_FRAME_RESERVED_16:             "MAV_FRAME_RESERVED_16",
    91  	MAV_FRAME_RESERVED_17:             "MAV_FRAME_RESERVED_17",
    92  	MAV_FRAME_RESERVED_18:             "MAV_FRAME_RESERVED_18",
    93  	MAV_FRAME_RESERVED_19:             "MAV_FRAME_RESERVED_19",
    94  	MAV_FRAME_LOCAL_FRD:               "MAV_FRAME_LOCAL_FRD",
    95  	MAV_FRAME_LOCAL_FLU:               "MAV_FRAME_LOCAL_FLU",
    96  }
    97  
    98  var values_MAV_FRAME = map[string]MAV_FRAME{
    99  	"MAV_FRAME_GLOBAL":                  MAV_FRAME_GLOBAL,
   100  	"MAV_FRAME_LOCAL_NED":               MAV_FRAME_LOCAL_NED,
   101  	"MAV_FRAME_MISSION":                 MAV_FRAME_MISSION,
   102  	"MAV_FRAME_GLOBAL_RELATIVE_ALT":     MAV_FRAME_GLOBAL_RELATIVE_ALT,
   103  	"MAV_FRAME_LOCAL_ENU":               MAV_FRAME_LOCAL_ENU,
   104  	"MAV_FRAME_GLOBAL_INT":              MAV_FRAME_GLOBAL_INT,
   105  	"MAV_FRAME_GLOBAL_RELATIVE_ALT_INT": MAV_FRAME_GLOBAL_RELATIVE_ALT_INT,
   106  	"MAV_FRAME_LOCAL_OFFSET_NED":        MAV_FRAME_LOCAL_OFFSET_NED,
   107  	"MAV_FRAME_BODY_NED":                MAV_FRAME_BODY_NED,
   108  	"MAV_FRAME_BODY_OFFSET_NED":         MAV_FRAME_BODY_OFFSET_NED,
   109  	"MAV_FRAME_GLOBAL_TERRAIN_ALT":      MAV_FRAME_GLOBAL_TERRAIN_ALT,
   110  	"MAV_FRAME_GLOBAL_TERRAIN_ALT_INT":  MAV_FRAME_GLOBAL_TERRAIN_ALT_INT,
   111  	"MAV_FRAME_BODY_FRD":                MAV_FRAME_BODY_FRD,
   112  	"MAV_FRAME_RESERVED_13":             MAV_FRAME_RESERVED_13,
   113  	"MAV_FRAME_RESERVED_14":             MAV_FRAME_RESERVED_14,
   114  	"MAV_FRAME_RESERVED_15":             MAV_FRAME_RESERVED_15,
   115  	"MAV_FRAME_RESERVED_16":             MAV_FRAME_RESERVED_16,
   116  	"MAV_FRAME_RESERVED_17":             MAV_FRAME_RESERVED_17,
   117  	"MAV_FRAME_RESERVED_18":             MAV_FRAME_RESERVED_18,
   118  	"MAV_FRAME_RESERVED_19":             MAV_FRAME_RESERVED_19,
   119  	"MAV_FRAME_LOCAL_FRD":               MAV_FRAME_LOCAL_FRD,
   120  	"MAV_FRAME_LOCAL_FLU":               MAV_FRAME_LOCAL_FLU,
   121  }
   122  
   123  // MarshalText implements the encoding.TextMarshaler interface.
   124  func (e MAV_FRAME) MarshalText() ([]byte, error) {
   125  	if name, ok := labels_MAV_FRAME[e]; ok {
   126  		return []byte(name), nil
   127  	}
   128  	return []byte(strconv.Itoa(int(e))), nil
   129  }
   130  
   131  // UnmarshalText implements the encoding.TextUnmarshaler interface.
   132  func (e *MAV_FRAME) UnmarshalText(text []byte) error {
   133  	if value, ok := values_MAV_FRAME[string(text)]; ok {
   134  		*e = value
   135  	} else if value, err := strconv.Atoi(string(text)); err == nil {
   136  		*e = MAV_FRAME(value)
   137  	} else {
   138  		return fmt.Errorf("invalid label '%s'", text)
   139  	}
   140  	return nil
   141  }
   142  
   143  // String implements the fmt.Stringer interface.
   144  func (e MAV_FRAME) String() string {
   145  	val, _ := e.MarshalText()
   146  	return string(val)
   147  }