00001 """autogenerated by genpy from corobot_phidgetIK/spatial.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 spatial(genpy.Message):
00009 _md5sum = "88d5070ee7206e7a7c6044849f478293"
00010 _type = "corobot_phidgetIK/spatial"
00011 _has_header = False
00012 _full_text = """#Deprecated. Prefer to use the one in corobot_msgs package, which is exactly the same
00013
00014 float32 acc1
00015 float32 acc2
00016 float32 acc3
00017
00018 float32 ang1
00019 float32 ang2
00020 float32 ang3
00021
00022 float32 mag1
00023 float32 mag2
00024 float32 mag3
00025
00026 """
00027 __slots__ = ['acc1','acc2','acc3','ang1','ang2','ang3','mag1','mag2','mag3']
00028 _slot_types = ['float32','float32','float32','float32','float32','float32','float32','float32','float32']
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 acc1,acc2,acc3,ang1,ang2,ang3,mag1,mag2,mag3
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(spatial, self).__init__(*args, **kwds)
00046
00047 if self.acc1 is None:
00048 self.acc1 = 0.
00049 if self.acc2 is None:
00050 self.acc2 = 0.
00051 if self.acc3 is None:
00052 self.acc3 = 0.
00053 if self.ang1 is None:
00054 self.ang1 = 0.
00055 if self.ang2 is None:
00056 self.ang2 = 0.
00057 if self.ang3 is None:
00058 self.ang3 = 0.
00059 if self.mag1 is None:
00060 self.mag1 = 0.
00061 if self.mag2 is None:
00062 self.mag2 = 0.
00063 if self.mag3 is None:
00064 self.mag3 = 0.
00065 else:
00066 self.acc1 = 0.
00067 self.acc2 = 0.
00068 self.acc3 = 0.
00069 self.ang1 = 0.
00070 self.ang2 = 0.
00071 self.ang3 = 0.
00072 self.mag1 = 0.
00073 self.mag2 = 0.
00074 self.mag3 = 0.
00075
00076 def _get_types(self):
00077 """
00078 internal API method
00079 """
00080 return self._slot_types
00081
00082 def serialize(self, buff):
00083 """
00084 serialize message into buffer
00085 :param buff: buffer, ``StringIO``
00086 """
00087 try:
00088 _x = self
00089 buff.write(_struct_9f.pack(_x.acc1, _x.acc2, _x.acc3, _x.ang1, _x.ang2, _x.ang3, _x.mag1, _x.mag2, _x.mag3))
00090 except struct.error as se: self._check_types(se)
00091 except TypeError as te: self._check_types(te)
00092
00093 def deserialize(self, str):
00094 """
00095 unpack serialized message in str into this message instance
00096 :param str: byte array of serialized message, ``str``
00097 """
00098 try:
00099 end = 0
00100 _x = self
00101 start = end
00102 end += 36
00103 (_x.acc1, _x.acc2, _x.acc3, _x.ang1, _x.ang2, _x.ang3, _x.mag1, _x.mag2, _x.mag3,) = _struct_9f.unpack(str[start:end])
00104 return self
00105 except struct.error as e:
00106 raise genpy.DeserializationError(e)
00107
00108
00109 def serialize_numpy(self, buff, numpy):
00110 """
00111 serialize message with numpy array types into buffer
00112 :param buff: buffer, ``StringIO``
00113 :param numpy: numpy python module
00114 """
00115 try:
00116 _x = self
00117 buff.write(_struct_9f.pack(_x.acc1, _x.acc2, _x.acc3, _x.ang1, _x.ang2, _x.ang3, _x.mag1, _x.mag2, _x.mag3))
00118 except struct.error as se: self._check_types(se)
00119 except TypeError as te: self._check_types(te)
00120
00121 def deserialize_numpy(self, str, numpy):
00122 """
00123 unpack serialized message in str into this message instance using numpy for array types
00124 :param str: byte array of serialized message, ``str``
00125 :param numpy: numpy python module
00126 """
00127 try:
00128 end = 0
00129 _x = self
00130 start = end
00131 end += 36
00132 (_x.acc1, _x.acc2, _x.acc3, _x.ang1, _x.ang2, _x.ang3, _x.mag1, _x.mag2, _x.mag3,) = _struct_9f.unpack(str[start:end])
00133 return self
00134 except struct.error as e:
00135 raise genpy.DeserializationError(e)
00136
00137 _struct_I = genpy.struct_I
00138 _struct_9f = struct.Struct("<9f")