github.com/bluenviron/gomavlib/v2@v2.2.1-0.20240308101627-2c07e3da629c/pkg/dialects/common/enum_winch_actions.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  // Winch actions.
    11  type WINCH_ACTIONS uint64
    12  
    13  const (
    14  	// Allow motor to freewheel.
    15  	WINCH_RELAXED WINCH_ACTIONS = 0
    16  	// Wind or unwind specified length of line, optionally using specified rate.
    17  	WINCH_RELATIVE_LENGTH_CONTROL WINCH_ACTIONS = 1
    18  	// Wind or unwind line at specified rate.
    19  	WINCH_RATE_CONTROL WINCH_ACTIONS = 2
    20  	// Perform the locking sequence to relieve motor while in the fully retracted position. Only action and instance command parameters are used, others are ignored.
    21  	WINCH_LOCK WINCH_ACTIONS = 3
    22  	// Sequence of drop, slow down, touch down, reel up, lock. Only action and instance command parameters are used, others are ignored.
    23  	WINCH_DELIVER WINCH_ACTIONS = 4
    24  	// Engage motor and hold current position. Only action and instance command parameters are used, others are ignored.
    25  	WINCH_HOLD WINCH_ACTIONS = 5
    26  	// Return the reel to the fully retracted position. Only action and instance command parameters are used, others are ignored.
    27  	WINCH_RETRACT WINCH_ACTIONS = 6
    28  	// Load the reel with line. The winch will calculate the total loaded length and stop when the tension exceeds a threshold. Only action and instance command parameters are used, others are ignored.
    29  	WINCH_LOAD_LINE WINCH_ACTIONS = 7
    30  	// Spool out the entire length of the line. Only action and instance command parameters are used, others are ignored.
    31  	WINCH_ABANDON_LINE WINCH_ACTIONS = 8
    32  	// Spools out just enough to present the hook to the user to load the payload. Only action and instance command parameters are used, others are ignored
    33  	WINCH_LOAD_PAYLOAD WINCH_ACTIONS = 9
    34  )
    35  
    36  var labels_WINCH_ACTIONS = map[WINCH_ACTIONS]string{
    37  	WINCH_RELAXED:                 "WINCH_RELAXED",
    38  	WINCH_RELATIVE_LENGTH_CONTROL: "WINCH_RELATIVE_LENGTH_CONTROL",
    39  	WINCH_RATE_CONTROL:            "WINCH_RATE_CONTROL",
    40  	WINCH_LOCK:                    "WINCH_LOCK",
    41  	WINCH_DELIVER:                 "WINCH_DELIVER",
    42  	WINCH_HOLD:                    "WINCH_HOLD",
    43  	WINCH_RETRACT:                 "WINCH_RETRACT",
    44  	WINCH_LOAD_LINE:               "WINCH_LOAD_LINE",
    45  	WINCH_ABANDON_LINE:            "WINCH_ABANDON_LINE",
    46  	WINCH_LOAD_PAYLOAD:            "WINCH_LOAD_PAYLOAD",
    47  }
    48  
    49  var values_WINCH_ACTIONS = map[string]WINCH_ACTIONS{
    50  	"WINCH_RELAXED":                 WINCH_RELAXED,
    51  	"WINCH_RELATIVE_LENGTH_CONTROL": WINCH_RELATIVE_LENGTH_CONTROL,
    52  	"WINCH_RATE_CONTROL":            WINCH_RATE_CONTROL,
    53  	"WINCH_LOCK":                    WINCH_LOCK,
    54  	"WINCH_DELIVER":                 WINCH_DELIVER,
    55  	"WINCH_HOLD":                    WINCH_HOLD,
    56  	"WINCH_RETRACT":                 WINCH_RETRACT,
    57  	"WINCH_LOAD_LINE":               WINCH_LOAD_LINE,
    58  	"WINCH_ABANDON_LINE":            WINCH_ABANDON_LINE,
    59  	"WINCH_LOAD_PAYLOAD":            WINCH_LOAD_PAYLOAD,
    60  }
    61  
    62  // MarshalText implements the encoding.TextMarshaler interface.
    63  func (e WINCH_ACTIONS) MarshalText() ([]byte, error) {
    64  	if name, ok := labels_WINCH_ACTIONS[e]; ok {
    65  		return []byte(name), nil
    66  	}
    67  	return []byte(strconv.Itoa(int(e))), nil
    68  }
    69  
    70  // UnmarshalText implements the encoding.TextUnmarshaler interface.
    71  func (e *WINCH_ACTIONS) UnmarshalText(text []byte) error {
    72  	if value, ok := values_WINCH_ACTIONS[string(text)]; ok {
    73  		*e = value
    74  	} else if value, err := strconv.Atoi(string(text)); err == nil {
    75  		*e = WINCH_ACTIONS(value)
    76  	} else {
    77  		return fmt.Errorf("invalid label '%s'", text)
    78  	}
    79  	return nil
    80  }
    81  
    82  // String implements the fmt.Stringer interface.
    83  func (e WINCH_ACTIONS) String() string {
    84  	val, _ := e.MarshalText()
    85  	return string(val)
    86  }