$search
00001 """autogenerated by genmsg_py from TorsoIMU.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 import std_msgs.msg 00006 00007 class TorsoIMU(roslib.message.Message): 00008 _md5sum = "404112cb51a476613d7a445b4586a894" 00009 _type = "nao_msgs/TorsoIMU" 00010 _has_header = True #flag to mark the presence of a Header object 00011 _full_text = """# Data from Nao's IMU, raw and filtered 00012 00013 Header header 00014 00015 # corrected / filtered angle to X axis (roll) 00016 float32 angleX 00017 00018 # corrected / filtered angle to Y axis (pitch) 00019 float32 angleY 00020 00021 # Raw data from gyroscopes 00022 float32 gyroX 00023 float32 gyroY 00024 00025 # Raw data from accelerometers 00026 float32 accelX 00027 float32 accelY 00028 float32 accelZ 00029 ================================================================================ 00030 MSG: std_msgs/Header 00031 # Standard metadata for higher-level stamped data types. 00032 # This is generally used to communicate timestamped data 00033 # in a particular coordinate frame. 00034 # 00035 # sequence ID: consecutively increasing ID 00036 uint32 seq 00037 #Two-integer timestamp that is expressed as: 00038 # * stamp.secs: seconds (stamp_secs) since epoch 00039 # * stamp.nsecs: nanoseconds since stamp_secs 00040 # time-handling sugar is provided by the client library 00041 time stamp 00042 #Frame this data is associated with 00043 # 0: no frame 00044 # 1: global frame 00045 string frame_id 00046 00047 """ 00048 __slots__ = ['header','angleX','angleY','gyroX','gyroY','accelX','accelY','accelZ'] 00049 _slot_types = ['Header','float32','float32','float32','float32','float32','float32','float32'] 00050 00051 def __init__(self, *args, **kwds): 00052 """ 00053 Constructor. Any message fields that are implicitly/explicitly 00054 set to None will be assigned a default value. The recommend 00055 use is keyword arguments as this is more robust to future message 00056 changes. You cannot mix in-order arguments and keyword arguments. 00057 00058 The available fields are: 00059 header,angleX,angleY,gyroX,gyroY,accelX,accelY,accelZ 00060 00061 @param args: complete set of field values, in .msg order 00062 @param kwds: use keyword arguments corresponding to message field names 00063 to set specific fields. 00064 """ 00065 if args or kwds: 00066 super(TorsoIMU, self).__init__(*args, **kwds) 00067 #message fields cannot be None, assign default values for those that are 00068 if self.header is None: 00069 self.header = std_msgs.msg._Header.Header() 00070 if self.angleX is None: 00071 self.angleX = 0. 00072 if self.angleY is None: 00073 self.angleY = 0. 00074 if self.gyroX is None: 00075 self.gyroX = 0. 00076 if self.gyroY is None: 00077 self.gyroY = 0. 00078 if self.accelX is None: 00079 self.accelX = 0. 00080 if self.accelY is None: 00081 self.accelY = 0. 00082 if self.accelZ is None: 00083 self.accelZ = 0. 00084 else: 00085 self.header = std_msgs.msg._Header.Header() 00086 self.angleX = 0. 00087 self.angleY = 0. 00088 self.gyroX = 0. 00089 self.gyroY = 0. 00090 self.accelX = 0. 00091 self.accelY = 0. 00092 self.accelZ = 0. 00093 00094 def _get_types(self): 00095 """ 00096 internal API method 00097 """ 00098 return self._slot_types 00099 00100 def serialize(self, buff): 00101 """ 00102 serialize message into buffer 00103 @param buff: buffer 00104 @type buff: StringIO 00105 """ 00106 try: 00107 _x = self 00108 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00109 _x = self.header.frame_id 00110 length = len(_x) 00111 buff.write(struct.pack('<I%ss'%length, length, _x)) 00112 _x = self 00113 buff.write(_struct_7f.pack(_x.angleX, _x.angleY, _x.gyroX, _x.gyroY, _x.accelX, _x.accelY, _x.accelZ)) 00114 except struct.error as se: self._check_types(se) 00115 except TypeError as te: self._check_types(te) 00116 00117 def deserialize(self, str): 00118 """ 00119 unpack serialized message in str into this message instance 00120 @param str: byte array of serialized message 00121 @type str: str 00122 """ 00123 try: 00124 if self.header is None: 00125 self.header = std_msgs.msg._Header.Header() 00126 end = 0 00127 _x = self 00128 start = end 00129 end += 12 00130 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00131 start = end 00132 end += 4 00133 (length,) = _struct_I.unpack(str[start:end]) 00134 start = end 00135 end += length 00136 self.header.frame_id = str[start:end] 00137 _x = self 00138 start = end 00139 end += 28 00140 (_x.angleX, _x.angleY, _x.gyroX, _x.gyroY, _x.accelX, _x.accelY, _x.accelZ,) = _struct_7f.unpack(str[start:end]) 00141 return self 00142 except struct.error as e: 00143 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00144 00145 00146 def serialize_numpy(self, buff, numpy): 00147 """ 00148 serialize message with numpy array types into buffer 00149 @param buff: buffer 00150 @type buff: StringIO 00151 @param numpy: numpy python module 00152 @type numpy module 00153 """ 00154 try: 00155 _x = self 00156 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00157 _x = self.header.frame_id 00158 length = len(_x) 00159 buff.write(struct.pack('<I%ss'%length, length, _x)) 00160 _x = self 00161 buff.write(_struct_7f.pack(_x.angleX, _x.angleY, _x.gyroX, _x.gyroY, _x.accelX, _x.accelY, _x.accelZ)) 00162 except struct.error as se: self._check_types(se) 00163 except TypeError as te: self._check_types(te) 00164 00165 def deserialize_numpy(self, str, numpy): 00166 """ 00167 unpack serialized message in str into this message instance using numpy for array types 00168 @param str: byte array of serialized message 00169 @type str: str 00170 @param numpy: numpy python module 00171 @type numpy: module 00172 """ 00173 try: 00174 if self.header is None: 00175 self.header = std_msgs.msg._Header.Header() 00176 end = 0 00177 _x = self 00178 start = end 00179 end += 12 00180 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00181 start = end 00182 end += 4 00183 (length,) = _struct_I.unpack(str[start:end]) 00184 start = end 00185 end += length 00186 self.header.frame_id = str[start:end] 00187 _x = self 00188 start = end 00189 end += 28 00190 (_x.angleX, _x.angleY, _x.gyroX, _x.gyroY, _x.accelX, _x.accelY, _x.accelZ,) = _struct_7f.unpack(str[start:end]) 00191 return self 00192 except struct.error as e: 00193 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00194 00195 _struct_I = roslib.message.struct_I 00196 _struct_7f = struct.Struct("<7f") 00197 _struct_3I = struct.Struct("<3I")