00001 """autogenerated by genpy from starmac_msgs/OperatorCommands.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006
00007
00008 class OperatorCommands(genpy.Message):
00009 _md5sum = "6368ecdaa27b1424d4bcd7569c40402b"
00010 _type = "starmac_msgs/OperatorCommands"
00011 _has_header = False
00012 _full_text = """# This message conveys normalized operator joystick commands, expressed in the
00013 # joystick frame of reference. I.e., roll_cmd = -1.0 corresponds to full left deflection
00014 # of the joystick's roll axis. Any deadbands should already be applied. Any semantic
00015 # interpretation of these commands occurs downstream of this message. E.g., in
00016 # one context yaw_cmd = 0.5 could mean a certain yaw angle is being commanded
00017 # or it could mean a certain yaw rate is commanded. In another context yaw might
00018 # be entirely repurposed.
00019
00020 float64 roll_cmd # -1.0 .. 1.0
00021 float64 pitch_cmd # -1.0 .. 1.0
00022 float64 yaw_cmd # -1.0 .. 1.0
00023 float64 alt_cmd # 0.0 .. 1.0
00024 bool motors_on # true if motors should be running
00025
00026 """
00027 __slots__ = ['roll_cmd','pitch_cmd','yaw_cmd','alt_cmd','motors_on']
00028 _slot_types = ['float64','float64','float64','float64','bool']
00029
00030 def __init__(self, *args, **kwds):
00031 """
00032 Constructor. Any message fields that are implicitly/explicitly
00033 set to None will be assigned a default value. The recommend
00034 use is keyword arguments as this is more robust to future message
00035 changes. You cannot mix in-order arguments and keyword arguments.
00036
00037 The available fields are:
00038 roll_cmd,pitch_cmd,yaw_cmd,alt_cmd,motors_on
00039
00040 :param args: complete set of field values, in .msg order
00041 :param kwds: use keyword arguments corresponding to message field names
00042 to set specific fields.
00043 """
00044 if args or kwds:
00045 super(OperatorCommands, self).__init__(*args, **kwds)
00046
00047 if self.roll_cmd is None:
00048 self.roll_cmd = 0.
00049 if self.pitch_cmd is None:
00050 self.pitch_cmd = 0.
00051 if self.yaw_cmd is None:
00052 self.yaw_cmd = 0.
00053 if self.alt_cmd is None:
00054 self.alt_cmd = 0.
00055 if self.motors_on is None:
00056 self.motors_on = False
00057 else:
00058 self.roll_cmd = 0.
00059 self.pitch_cmd = 0.
00060 self.yaw_cmd = 0.
00061 self.alt_cmd = 0.
00062 self.motors_on = False
00063
00064 def _get_types(self):
00065 """
00066 internal API method
00067 """
00068 return self._slot_types
00069
00070 def serialize(self, buff):
00071 """
00072 serialize message into buffer
00073 :param buff: buffer, ``StringIO``
00074 """
00075 try:
00076 _x = self
00077 buff.write(_struct_4dB.pack(_x.roll_cmd, _x.pitch_cmd, _x.yaw_cmd, _x.alt_cmd, _x.motors_on))
00078 except struct.error as se: self._check_types(se)
00079 except TypeError as te: self._check_types(te)
00080
00081 def deserialize(self, str):
00082 """
00083 unpack serialized message in str into this message instance
00084 :param str: byte array of serialized message, ``str``
00085 """
00086 try:
00087 end = 0
00088 _x = self
00089 start = end
00090 end += 33
00091 (_x.roll_cmd, _x.pitch_cmd, _x.yaw_cmd, _x.alt_cmd, _x.motors_on,) = _struct_4dB.unpack(str[start:end])
00092 self.motors_on = bool(self.motors_on)
00093 return self
00094 except struct.error as e:
00095 raise genpy.DeserializationError(e)
00096
00097
00098 def serialize_numpy(self, buff, numpy):
00099 """
00100 serialize message with numpy array types into buffer
00101 :param buff: buffer, ``StringIO``
00102 :param numpy: numpy python module
00103 """
00104 try:
00105 _x = self
00106 buff.write(_struct_4dB.pack(_x.roll_cmd, _x.pitch_cmd, _x.yaw_cmd, _x.alt_cmd, _x.motors_on))
00107 except struct.error as se: self._check_types(se)
00108 except TypeError as te: self._check_types(te)
00109
00110 def deserialize_numpy(self, str, numpy):
00111 """
00112 unpack serialized message in str into this message instance using numpy for array types
00113 :param str: byte array of serialized message, ``str``
00114 :param numpy: numpy python module
00115 """
00116 try:
00117 end = 0
00118 _x = self
00119 start = end
00120 end += 33
00121 (_x.roll_cmd, _x.pitch_cmd, _x.yaw_cmd, _x.alt_cmd, _x.motors_on,) = _struct_4dB.unpack(str[start:end])
00122 self.motors_on = bool(self.motors_on)
00123 return self
00124 except struct.error as e:
00125 raise genpy.DeserializationError(e)
00126
00127 _struct_I = genpy.struct_I
00128 _struct_4dB = struct.Struct("<4dB")