00001 """autogenerated by genpy from starmac_msgs/EulerAngles.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 EulerAngles(genpy.Message):
00009 _md5sum = "b41bea25ef0825fa6d2799746a51460f"
00010 _type = "starmac_msgs/EulerAngles"
00011 _has_header = False
00012 _full_text = """string sequence # as per transformations.py, e.g. 'rzyx' for standard yaw-pitch-roll
00013 bool angles_in_degrees # true if ai, aj, ak are in degrees, otherwise they are in radians
00014 # rotations about 1st, 2nd, 3rd axis:
00015 float64 ai
00016 float64 aj
00017 float64 ak
00018 """
00019 __slots__ = ['sequence','angles_in_degrees','ai','aj','ak']
00020 _slot_types = ['string','bool','float64','float64','float64']
00021
00022 def __init__(self, *args, **kwds):
00023 """
00024 Constructor. Any message fields that are implicitly/explicitly
00025 set to None will be assigned a default value. The recommend
00026 use is keyword arguments as this is more robust to future message
00027 changes. You cannot mix in-order arguments and keyword arguments.
00028
00029 The available fields are:
00030 sequence,angles_in_degrees,ai,aj,ak
00031
00032 :param args: complete set of field values, in .msg order
00033 :param kwds: use keyword arguments corresponding to message field names
00034 to set specific fields.
00035 """
00036 if args or kwds:
00037 super(EulerAngles, self).__init__(*args, **kwds)
00038
00039 if self.sequence is None:
00040 self.sequence = ''
00041 if self.angles_in_degrees is None:
00042 self.angles_in_degrees = False
00043 if self.ai is None:
00044 self.ai = 0.
00045 if self.aj is None:
00046 self.aj = 0.
00047 if self.ak is None:
00048 self.ak = 0.
00049 else:
00050 self.sequence = ''
00051 self.angles_in_degrees = False
00052 self.ai = 0.
00053 self.aj = 0.
00054 self.ak = 0.
00055
00056 def _get_types(self):
00057 """
00058 internal API method
00059 """
00060 return self._slot_types
00061
00062 def serialize(self, buff):
00063 """
00064 serialize message into buffer
00065 :param buff: buffer, ``StringIO``
00066 """
00067 try:
00068 _x = self.sequence
00069 length = len(_x)
00070 if python3 or type(_x) == unicode:
00071 _x = _x.encode('utf-8')
00072 length = len(_x)
00073 buff.write(struct.pack('<I%ss'%length, length, _x))
00074 _x = self
00075 buff.write(_struct_B3d.pack(_x.angles_in_degrees, _x.ai, _x.aj, _x.ak))
00076 except struct.error as se: self._check_types(se)
00077 except TypeError as te: self._check_types(te)
00078
00079 def deserialize(self, str):
00080 """
00081 unpack serialized message in str into this message instance
00082 :param str: byte array of serialized message, ``str``
00083 """
00084 try:
00085 end = 0
00086 start = end
00087 end += 4
00088 (length,) = _struct_I.unpack(str[start:end])
00089 start = end
00090 end += length
00091 if python3:
00092 self.sequence = str[start:end].decode('utf-8')
00093 else:
00094 self.sequence = str[start:end]
00095 _x = self
00096 start = end
00097 end += 25
00098 (_x.angles_in_degrees, _x.ai, _x.aj, _x.ak,) = _struct_B3d.unpack(str[start:end])
00099 self.angles_in_degrees = bool(self.angles_in_degrees)
00100 return self
00101 except struct.error as e:
00102 raise genpy.DeserializationError(e)
00103
00104
00105 def serialize_numpy(self, buff, numpy):
00106 """
00107 serialize message with numpy array types into buffer
00108 :param buff: buffer, ``StringIO``
00109 :param numpy: numpy python module
00110 """
00111 try:
00112 _x = self.sequence
00113 length = len(_x)
00114 if python3 or type(_x) == unicode:
00115 _x = _x.encode('utf-8')
00116 length = len(_x)
00117 buff.write(struct.pack('<I%ss'%length, length, _x))
00118 _x = self
00119 buff.write(_struct_B3d.pack(_x.angles_in_degrees, _x.ai, _x.aj, _x.ak))
00120 except struct.error as se: self._check_types(se)
00121 except TypeError as te: self._check_types(te)
00122
00123 def deserialize_numpy(self, str, numpy):
00124 """
00125 unpack serialized message in str into this message instance using numpy for array types
00126 :param str: byte array of serialized message, ``str``
00127 :param numpy: numpy python module
00128 """
00129 try:
00130 end = 0
00131 start = end
00132 end += 4
00133 (length,) = _struct_I.unpack(str[start:end])
00134 start = end
00135 end += length
00136 if python3:
00137 self.sequence = str[start:end].decode('utf-8')
00138 else:
00139 self.sequence = str[start:end]
00140 _x = self
00141 start = end
00142 end += 25
00143 (_x.angles_in_degrees, _x.ai, _x.aj, _x.ak,) = _struct_B3d.unpack(str[start:end])
00144 self.angles_in_degrees = bool(self.angles_in_degrees)
00145 return self
00146 except struct.error as e:
00147 raise genpy.DeserializationError(e)
00148
00149 _struct_I = genpy.struct_I
00150 _struct_B3d = struct.Struct("<B3d")