$search
00001 """autogenerated by genmsg_py from State.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 import wiimote.msg 00006 import geometry_msgs.msg 00007 import roslib.rostime 00008 import std_msgs.msg 00009 00010 class State(roslib.message.Message): 00011 _md5sum = "a69651e8129655c6ed3c5039e468362c" 00012 _type = "wiimote/State" 00013 _has_header = True #flag to mark the presence of a Header object 00014 _full_text = """# 00015 # Wiimote State message containing one complete Wiimote state 00016 00017 # Note: For ease of manipulation this message often uses 00018 # int8[] when a bit vector would work. One might 00019 # wish to use uint8[], but then Python takes 00020 # the respective structure as a string and disallows 00021 # item assignment. 00022 00023 int8 INVALID = -1 00024 float32 INVALID_FLOAT = -1.0 00025 00026 int8 MSG_BTN_1 = 0 00027 int8 MSG_BTN_2 = 1 00028 int8 MSG_BTN_A = 2 00029 int8 MSG_BTN_B = 3 00030 int8 MSG_BTN_PLUS = 4 00031 int8 MSG_BTN_MINUS = 5 00032 int8 MSG_BTN_LEFT = 6 00033 int8 MSG_BTN_RIGHT = 7 00034 int8 MSG_BTN_UP = 8 00035 int8 MSG_BTN_DOWN = 9 00036 int8 MSG_BTN_HOME = 10 00037 int8 MSG_BTN_Z = 0 00038 int8 MSG_BTN_C = 1 00039 int8 MSG_CLASSIC_BTN_X = 0 00040 int8 MSG_CLASSIC_BTN_Y = 1 00041 int8 MSG_CLASSIC_BTN_A = 2 00042 int8 MSG_CLASSIC_BTN_B = 3 00043 int8 MSG_CLASSIC_BTN_PLUS = 4 00044 int8 MSG_CLASSIC_BTN_MINUS = 5 00045 int8 MSG_CLASSIC_BTN_LEFT = 6 00046 int8 MSG_CLASSIC_BTN_RIGHT = 7 00047 int8 MSG_CLASSIC_BTN_UP = 8 00048 int8 MSG_CLASSIC_BTN_DOWN = 9 00049 int8 MSG_CLASSIC_BTN_HOME = 10 00050 int8 MSG_CLASSIC_BTN_L = 11 00051 int8 MSG_CLASSIC_BTN_R = 12 00052 int8 MSG_CLASSIC_BTN_ZL = 13 00053 int8 MSG_CLASSIC_BTN_ZR = 14 00054 00055 #----------------------------- 00056 # Header 00057 #---------------------- 00058 00059 Header header 00060 00061 #---------------------- 00062 # Gyro reading 00063 #----------------------------- 00064 # In radians/sec. If reading is invalid, 00065 # for instance b/c no gyro is attached to the Wii, then 00066 # set first element of covariance to -1 (same as imu_data.msg): 00067 # Covariance matrix (roll, pitch, yaw) in radians^2/sec^2. 00068 00069 geometry_msgs/Vector3 angular_velocity_zeroed 00070 geometry_msgs/Vector3 angular_velocity_raw 00071 float64[9] angular_velocity_covariance 00072 00073 #---------------------- 00074 # Accelerometer reading 00075 #----------------------------- 00076 # Acceleration in m/sec^2. Covariance matrix 00077 # (x,y,z) in m^2/sec^4. (all same as imu_data.msg) 00078 00079 geometry_msgs/Vector3 linear_acceleration_zeroed 00080 geometry_msgs/Vector3 linear_acceleration_raw 00081 float64[9] linear_acceleration_covariance 00082 00083 #------------------------------ 00084 # Nunchuk Accelerometer reading 00085 #------------------------------ 00086 geometry_msgs/Vector3 nunchuk_acceleration_zeroed 00087 geometry_msgs/Vector3 nunchuk_acceleration_raw 00088 00089 #----------------- 00090 # Nunchuk Joystick 00091 #----------------- 00092 float32[2] nunchuk_joystick_zeroed 00093 float32[2] nunchuk_joystick_raw 00094 00095 #---------------------- 00096 # Wiimote buttons 00097 #----------------------------- 00098 # Mappings from Wiimote button name 00099 # to array position are defined above. 00100 # 00101 bool[11] buttons 00102 bool[2] nunchuk_buttons 00103 00104 #---------------------- 00105 # Wiimote LED states: 00106 #----------------------------- 00107 00108 bool[4] LEDs 00109 00110 #---------------------- 00111 # Wiimote Rumble 00112 #----------------------------- 00113 # State (True or False) 00114 00115 bool rumble 00116 00117 #---------------------- 00118 # IR Light sensor (Camera) 00119 #----------------------------- 00120 # The Wiimote handles up to four light sources, 00121 # and the wiimote_node.py software is written to 00122 # that limit as well. For future expansion 00123 # we make the following array extensible, rather 00124 # than locking its length down to four: 00125 00126 wiimote/IrSourceInfo[] ir_tracking 00127 00128 #---------------------- 00129 # Wiimote battery 00130 #----------------------------- 00131 # A battery reading consists of two numbers: 00132 # the battery percentage, and the raw reading. 00133 # Maximum battery is 208 units (unknown how this 00134 # relates to electrical properties): 00135 00136 float32 raw_battery 00137 float32 percent_battery 00138 00139 #---------------------- 00140 # Time of most recent zeroing: 00141 #----------------------------- 00142 00143 time zeroing_time 00144 00145 #---------------------- 00146 # Error vector 00147 #----------------------------- 00148 # For error condition definitions see wiimoteConstants.py 00149 # Value of zero means all is well. (Currently NOT used). 00150 00151 uint64 errors 00152 00153 ================================================================================ 00154 MSG: std_msgs/Header 00155 # Standard metadata for higher-level stamped data types. 00156 # This is generally used to communicate timestamped data 00157 # in a particular coordinate frame. 00158 # 00159 # sequence ID: consecutively increasing ID 00160 uint32 seq 00161 #Two-integer timestamp that is expressed as: 00162 # * stamp.secs: seconds (stamp_secs) since epoch 00163 # * stamp.nsecs: nanoseconds since stamp_secs 00164 # time-handling sugar is provided by the client library 00165 time stamp 00166 #Frame this data is associated with 00167 # 0: no frame 00168 # 1: global frame 00169 string frame_id 00170 00171 ================================================================================ 00172 MSG: geometry_msgs/Vector3 00173 # This represents a vector in free space. 00174 00175 float64 x 00176 float64 y 00177 float64 z 00178 ================================================================================ 00179 MSG: wiimote/IrSourceInfo 00180 # Sensor data pertaining to the Wiimote infrared camera. 00181 # This message contains data for one of the four infrared 00182 # light sources that the camera detects. 00183 # 00184 # Each light is specified with a 2D position and 00185 # a 'source magnitude' (ir_size). If the x dimension 00186 # is set to INVALID_FLOAT, then no light was detected for 00187 # the respective light. The Wiimote handles up to 00188 # four light sources, and the wiimote_node.py software 00189 # is written to that limit as well. 00190 # 00191 # I am unsure what the 'ir_size' values represent. 00192 # They are described as 'source magnitude' in some places. I 00193 # *assume* this is signal amplitude, but it's unclear. 00194 # Note that current lowest level cwiid driver does not 00195 # seem to pass the ir_size value to the cwiid Wiimote.c. 00196 # For now this size will therefore be set INVALID 00197 00198 float64 x 00199 float64 y 00200 int64 ir_size 00201 00202 """ 00203 # Pseudo-constants 00204 INVALID = -1 00205 INVALID_FLOAT = -1.0 00206 MSG_BTN_1 = 0 00207 MSG_BTN_2 = 1 00208 MSG_BTN_A = 2 00209 MSG_BTN_B = 3 00210 MSG_BTN_PLUS = 4 00211 MSG_BTN_MINUS = 5 00212 MSG_BTN_LEFT = 6 00213 MSG_BTN_RIGHT = 7 00214 MSG_BTN_UP = 8 00215 MSG_BTN_DOWN = 9 00216 MSG_BTN_HOME = 10 00217 MSG_BTN_Z = 0 00218 MSG_BTN_C = 1 00219 MSG_CLASSIC_BTN_X = 0 00220 MSG_CLASSIC_BTN_Y = 1 00221 MSG_CLASSIC_BTN_A = 2 00222 MSG_CLASSIC_BTN_B = 3 00223 MSG_CLASSIC_BTN_PLUS = 4 00224 MSG_CLASSIC_BTN_MINUS = 5 00225 MSG_CLASSIC_BTN_LEFT = 6 00226 MSG_CLASSIC_BTN_RIGHT = 7 00227 MSG_CLASSIC_BTN_UP = 8 00228 MSG_CLASSIC_BTN_DOWN = 9 00229 MSG_CLASSIC_BTN_HOME = 10 00230 MSG_CLASSIC_BTN_L = 11 00231 MSG_CLASSIC_BTN_R = 12 00232 MSG_CLASSIC_BTN_ZL = 13 00233 MSG_CLASSIC_BTN_ZR = 14 00234 00235 __slots__ = ['header','angular_velocity_zeroed','angular_velocity_raw','angular_velocity_covariance','linear_acceleration_zeroed','linear_acceleration_raw','linear_acceleration_covariance','nunchuk_acceleration_zeroed','nunchuk_acceleration_raw','nunchuk_joystick_zeroed','nunchuk_joystick_raw','buttons','nunchuk_buttons','LEDs','rumble','ir_tracking','raw_battery','percent_battery','zeroing_time','errors'] 00236 _slot_types = ['Header','geometry_msgs/Vector3','geometry_msgs/Vector3','float64[9]','geometry_msgs/Vector3','geometry_msgs/Vector3','float64[9]','geometry_msgs/Vector3','geometry_msgs/Vector3','float32[2]','float32[2]','bool[11]','bool[2]','bool[4]','bool','wiimote/IrSourceInfo[]','float32','float32','time','uint64'] 00237 00238 def __init__(self, *args, **kwds): 00239 """ 00240 Constructor. Any message fields that are implicitly/explicitly 00241 set to None will be assigned a default value. The recommend 00242 use is keyword arguments as this is more robust to future message 00243 changes. You cannot mix in-order arguments and keyword arguments. 00244 00245 The available fields are: 00246 header,angular_velocity_zeroed,angular_velocity_raw,angular_velocity_covariance,linear_acceleration_zeroed,linear_acceleration_raw,linear_acceleration_covariance,nunchuk_acceleration_zeroed,nunchuk_acceleration_raw,nunchuk_joystick_zeroed,nunchuk_joystick_raw,buttons,nunchuk_buttons,LEDs,rumble,ir_tracking,raw_battery,percent_battery,zeroing_time,errors 00247 00248 @param args: complete set of field values, in .msg order 00249 @param kwds: use keyword arguments corresponding to message field names 00250 to set specific fields. 00251 """ 00252 if args or kwds: 00253 super(State, self).__init__(*args, **kwds) 00254 #message fields cannot be None, assign default values for those that are 00255 if self.header is None: 00256 self.header = std_msgs.msg._Header.Header() 00257 if self.angular_velocity_zeroed is None: 00258 self.angular_velocity_zeroed = geometry_msgs.msg.Vector3() 00259 if self.angular_velocity_raw is None: 00260 self.angular_velocity_raw = geometry_msgs.msg.Vector3() 00261 if self.angular_velocity_covariance is None: 00262 self.angular_velocity_covariance = [0.,0.,0.,0.,0.,0.,0.,0.,0.] 00263 if self.linear_acceleration_zeroed is None: 00264 self.linear_acceleration_zeroed = geometry_msgs.msg.Vector3() 00265 if self.linear_acceleration_raw is None: 00266 self.linear_acceleration_raw = geometry_msgs.msg.Vector3() 00267 if self.linear_acceleration_covariance is None: 00268 self.linear_acceleration_covariance = [0.,0.,0.,0.,0.,0.,0.,0.,0.] 00269 if self.nunchuk_acceleration_zeroed is None: 00270 self.nunchuk_acceleration_zeroed = geometry_msgs.msg.Vector3() 00271 if self.nunchuk_acceleration_raw is None: 00272 self.nunchuk_acceleration_raw = geometry_msgs.msg.Vector3() 00273 if self.nunchuk_joystick_zeroed is None: 00274 self.nunchuk_joystick_zeroed = [0.,0.] 00275 if self.nunchuk_joystick_raw is None: 00276 self.nunchuk_joystick_raw = [0.,0.] 00277 if self.buttons is None: 00278 self.buttons = [False,False,False,False,False,False,False,False,False,False,False] 00279 if self.nunchuk_buttons is None: 00280 self.nunchuk_buttons = [False,False] 00281 if self.LEDs is None: 00282 self.LEDs = [False,False,False,False] 00283 if self.rumble is None: 00284 self.rumble = False 00285 if self.ir_tracking is None: 00286 self.ir_tracking = [] 00287 if self.raw_battery is None: 00288 self.raw_battery = 0. 00289 if self.percent_battery is None: 00290 self.percent_battery = 0. 00291 if self.zeroing_time is None: 00292 self.zeroing_time = roslib.rostime.Time() 00293 if self.errors is None: 00294 self.errors = 0 00295 else: 00296 self.header = std_msgs.msg._Header.Header() 00297 self.angular_velocity_zeroed = geometry_msgs.msg.Vector3() 00298 self.angular_velocity_raw = geometry_msgs.msg.Vector3() 00299 self.angular_velocity_covariance = [0.,0.,0.,0.,0.,0.,0.,0.,0.] 00300 self.linear_acceleration_zeroed = geometry_msgs.msg.Vector3() 00301 self.linear_acceleration_raw = geometry_msgs.msg.Vector3() 00302 self.linear_acceleration_covariance = [0.,0.,0.,0.,0.,0.,0.,0.,0.] 00303 self.nunchuk_acceleration_zeroed = geometry_msgs.msg.Vector3() 00304 self.nunchuk_acceleration_raw = geometry_msgs.msg.Vector3() 00305 self.nunchuk_joystick_zeroed = [0.,0.] 00306 self.nunchuk_joystick_raw = [0.,0.] 00307 self.buttons = [False,False,False,False,False,False,False,False,False,False,False] 00308 self.nunchuk_buttons = [False,False] 00309 self.LEDs = [False,False,False,False] 00310 self.rumble = False 00311 self.ir_tracking = [] 00312 self.raw_battery = 0. 00313 self.percent_battery = 0. 00314 self.zeroing_time = roslib.rostime.Time() 00315 self.errors = 0 00316 00317 def _get_types(self): 00318 """ 00319 internal API method 00320 """ 00321 return self._slot_types 00322 00323 def serialize(self, buff): 00324 """ 00325 serialize message into buffer 00326 @param buff: buffer 00327 @type buff: StringIO 00328 """ 00329 try: 00330 _x = self 00331 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00332 _x = self.header.frame_id 00333 length = len(_x) 00334 buff.write(struct.pack('<I%ss'%length, length, _x)) 00335 _x = self 00336 buff.write(_struct_6d.pack(_x.angular_velocity_zeroed.x, _x.angular_velocity_zeroed.y, _x.angular_velocity_zeroed.z, _x.angular_velocity_raw.x, _x.angular_velocity_raw.y, _x.angular_velocity_raw.z)) 00337 buff.write(_struct_9d.pack(*self.angular_velocity_covariance)) 00338 _x = self 00339 buff.write(_struct_6d.pack(_x.linear_acceleration_zeroed.x, _x.linear_acceleration_zeroed.y, _x.linear_acceleration_zeroed.z, _x.linear_acceleration_raw.x, _x.linear_acceleration_raw.y, _x.linear_acceleration_raw.z)) 00340 buff.write(_struct_9d.pack(*self.linear_acceleration_covariance)) 00341 _x = self 00342 buff.write(_struct_6d.pack(_x.nunchuk_acceleration_zeroed.x, _x.nunchuk_acceleration_zeroed.y, _x.nunchuk_acceleration_zeroed.z, _x.nunchuk_acceleration_raw.x, _x.nunchuk_acceleration_raw.y, _x.nunchuk_acceleration_raw.z)) 00343 buff.write(_struct_2f.pack(*self.nunchuk_joystick_zeroed)) 00344 buff.write(_struct_2f.pack(*self.nunchuk_joystick_raw)) 00345 buff.write(_struct_11B.pack(*self.buttons)) 00346 buff.write(_struct_2B.pack(*self.nunchuk_buttons)) 00347 buff.write(_struct_4B.pack(*self.LEDs)) 00348 buff.write(_struct_B.pack(self.rumble)) 00349 length = len(self.ir_tracking) 00350 buff.write(_struct_I.pack(length)) 00351 for val1 in self.ir_tracking: 00352 _x = val1 00353 buff.write(_struct_2dq.pack(_x.x, _x.y, _x.ir_size)) 00354 _x = self 00355 buff.write(_struct_2f2IQ.pack(_x.raw_battery, _x.percent_battery, _x.zeroing_time.secs, _x.zeroing_time.nsecs, _x.errors)) 00356 except struct.error as se: self._check_types(se) 00357 except TypeError as te: self._check_types(te) 00358 00359 def deserialize(self, str): 00360 """ 00361 unpack serialized message in str into this message instance 00362 @param str: byte array of serialized message 00363 @type str: str 00364 """ 00365 try: 00366 if self.header is None: 00367 self.header = std_msgs.msg._Header.Header() 00368 if self.angular_velocity_zeroed is None: 00369 self.angular_velocity_zeroed = geometry_msgs.msg.Vector3() 00370 if self.angular_velocity_raw is None: 00371 self.angular_velocity_raw = geometry_msgs.msg.Vector3() 00372 if self.linear_acceleration_zeroed is None: 00373 self.linear_acceleration_zeroed = geometry_msgs.msg.Vector3() 00374 if self.linear_acceleration_raw is None: 00375 self.linear_acceleration_raw = geometry_msgs.msg.Vector3() 00376 if self.nunchuk_acceleration_zeroed is None: 00377 self.nunchuk_acceleration_zeroed = geometry_msgs.msg.Vector3() 00378 if self.nunchuk_acceleration_raw is None: 00379 self.nunchuk_acceleration_raw = geometry_msgs.msg.Vector3() 00380 if self.zeroing_time is None: 00381 self.zeroing_time = roslib.rostime.Time() 00382 end = 0 00383 _x = self 00384 start = end 00385 end += 12 00386 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00387 start = end 00388 end += 4 00389 (length,) = _struct_I.unpack(str[start:end]) 00390 start = end 00391 end += length 00392 self.header.frame_id = str[start:end] 00393 _x = self 00394 start = end 00395 end += 48 00396 (_x.angular_velocity_zeroed.x, _x.angular_velocity_zeroed.y, _x.angular_velocity_zeroed.z, _x.angular_velocity_raw.x, _x.angular_velocity_raw.y, _x.angular_velocity_raw.z,) = _struct_6d.unpack(str[start:end]) 00397 start = end 00398 end += 72 00399 self.angular_velocity_covariance = _struct_9d.unpack(str[start:end]) 00400 _x = self 00401 start = end 00402 end += 48 00403 (_x.linear_acceleration_zeroed.x, _x.linear_acceleration_zeroed.y, _x.linear_acceleration_zeroed.z, _x.linear_acceleration_raw.x, _x.linear_acceleration_raw.y, _x.linear_acceleration_raw.z,) = _struct_6d.unpack(str[start:end]) 00404 start = end 00405 end += 72 00406 self.linear_acceleration_covariance = _struct_9d.unpack(str[start:end]) 00407 _x = self 00408 start = end 00409 end += 48 00410 (_x.nunchuk_acceleration_zeroed.x, _x.nunchuk_acceleration_zeroed.y, _x.nunchuk_acceleration_zeroed.z, _x.nunchuk_acceleration_raw.x, _x.nunchuk_acceleration_raw.y, _x.nunchuk_acceleration_raw.z,) = _struct_6d.unpack(str[start:end]) 00411 start = end 00412 end += 8 00413 self.nunchuk_joystick_zeroed = _struct_2f.unpack(str[start:end]) 00414 start = end 00415 end += 8 00416 self.nunchuk_joystick_raw = _struct_2f.unpack(str[start:end]) 00417 start = end 00418 end += 11 00419 self.buttons = _struct_11B.unpack(str[start:end]) 00420 self.buttons = map(bool, self.buttons) 00421 start = end 00422 end += 2 00423 self.nunchuk_buttons = _struct_2B.unpack(str[start:end]) 00424 self.nunchuk_buttons = map(bool, self.nunchuk_buttons) 00425 start = end 00426 end += 4 00427 self.LEDs = _struct_4B.unpack(str[start:end]) 00428 self.LEDs = map(bool, self.LEDs) 00429 start = end 00430 end += 1 00431 (self.rumble,) = _struct_B.unpack(str[start:end]) 00432 self.rumble = bool(self.rumble) 00433 start = end 00434 end += 4 00435 (length,) = _struct_I.unpack(str[start:end]) 00436 self.ir_tracking = [] 00437 for i in range(0, length): 00438 val1 = wiimote.msg.IrSourceInfo() 00439 _x = val1 00440 start = end 00441 end += 24 00442 (_x.x, _x.y, _x.ir_size,) = _struct_2dq.unpack(str[start:end]) 00443 self.ir_tracking.append(val1) 00444 _x = self 00445 start = end 00446 end += 24 00447 (_x.raw_battery, _x.percent_battery, _x.zeroing_time.secs, _x.zeroing_time.nsecs, _x.errors,) = _struct_2f2IQ.unpack(str[start:end]) 00448 self.zeroing_time.canon() 00449 return self 00450 except struct.error as e: 00451 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00452 00453 00454 def serialize_numpy(self, buff, numpy): 00455 """ 00456 serialize message with numpy array types into buffer 00457 @param buff: buffer 00458 @type buff: StringIO 00459 @param numpy: numpy python module 00460 @type numpy module 00461 """ 00462 try: 00463 _x = self 00464 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00465 _x = self.header.frame_id 00466 length = len(_x) 00467 buff.write(struct.pack('<I%ss'%length, length, _x)) 00468 _x = self 00469 buff.write(_struct_6d.pack(_x.angular_velocity_zeroed.x, _x.angular_velocity_zeroed.y, _x.angular_velocity_zeroed.z, _x.angular_velocity_raw.x, _x.angular_velocity_raw.y, _x.angular_velocity_raw.z)) 00470 buff.write(self.angular_velocity_covariance.tostring()) 00471 _x = self 00472 buff.write(_struct_6d.pack(_x.linear_acceleration_zeroed.x, _x.linear_acceleration_zeroed.y, _x.linear_acceleration_zeroed.z, _x.linear_acceleration_raw.x, _x.linear_acceleration_raw.y, _x.linear_acceleration_raw.z)) 00473 buff.write(self.linear_acceleration_covariance.tostring()) 00474 _x = self 00475 buff.write(_struct_6d.pack(_x.nunchuk_acceleration_zeroed.x, _x.nunchuk_acceleration_zeroed.y, _x.nunchuk_acceleration_zeroed.z, _x.nunchuk_acceleration_raw.x, _x.nunchuk_acceleration_raw.y, _x.nunchuk_acceleration_raw.z)) 00476 buff.write(self.nunchuk_joystick_zeroed.tostring()) 00477 buff.write(self.nunchuk_joystick_raw.tostring()) 00478 buff.write(self.buttons.tostring()) 00479 buff.write(self.nunchuk_buttons.tostring()) 00480 buff.write(self.LEDs.tostring()) 00481 buff.write(_struct_B.pack(self.rumble)) 00482 length = len(self.ir_tracking) 00483 buff.write(_struct_I.pack(length)) 00484 for val1 in self.ir_tracking: 00485 _x = val1 00486 buff.write(_struct_2dq.pack(_x.x, _x.y, _x.ir_size)) 00487 _x = self 00488 buff.write(_struct_2f2IQ.pack(_x.raw_battery, _x.percent_battery, _x.zeroing_time.secs, _x.zeroing_time.nsecs, _x.errors)) 00489 except struct.error as se: self._check_types(se) 00490 except TypeError as te: self._check_types(te) 00491 00492 def deserialize_numpy(self, str, numpy): 00493 """ 00494 unpack serialized message in str into this message instance using numpy for array types 00495 @param str: byte array of serialized message 00496 @type str: str 00497 @param numpy: numpy python module 00498 @type numpy: module 00499 """ 00500 try: 00501 if self.header is None: 00502 self.header = std_msgs.msg._Header.Header() 00503 if self.angular_velocity_zeroed is None: 00504 self.angular_velocity_zeroed = geometry_msgs.msg.Vector3() 00505 if self.angular_velocity_raw is None: 00506 self.angular_velocity_raw = geometry_msgs.msg.Vector3() 00507 if self.linear_acceleration_zeroed is None: 00508 self.linear_acceleration_zeroed = geometry_msgs.msg.Vector3() 00509 if self.linear_acceleration_raw is None: 00510 self.linear_acceleration_raw = geometry_msgs.msg.Vector3() 00511 if self.nunchuk_acceleration_zeroed is None: 00512 self.nunchuk_acceleration_zeroed = geometry_msgs.msg.Vector3() 00513 if self.nunchuk_acceleration_raw is None: 00514 self.nunchuk_acceleration_raw = geometry_msgs.msg.Vector3() 00515 if self.zeroing_time is None: 00516 self.zeroing_time = roslib.rostime.Time() 00517 end = 0 00518 _x = self 00519 start = end 00520 end += 12 00521 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00522 start = end 00523 end += 4 00524 (length,) = _struct_I.unpack(str[start:end]) 00525 start = end 00526 end += length 00527 self.header.frame_id = str[start:end] 00528 _x = self 00529 start = end 00530 end += 48 00531 (_x.angular_velocity_zeroed.x, _x.angular_velocity_zeroed.y, _x.angular_velocity_zeroed.z, _x.angular_velocity_raw.x, _x.angular_velocity_raw.y, _x.angular_velocity_raw.z,) = _struct_6d.unpack(str[start:end]) 00532 start = end 00533 end += 72 00534 self.angular_velocity_covariance = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=9) 00535 _x = self 00536 start = end 00537 end += 48 00538 (_x.linear_acceleration_zeroed.x, _x.linear_acceleration_zeroed.y, _x.linear_acceleration_zeroed.z, _x.linear_acceleration_raw.x, _x.linear_acceleration_raw.y, _x.linear_acceleration_raw.z,) = _struct_6d.unpack(str[start:end]) 00539 start = end 00540 end += 72 00541 self.linear_acceleration_covariance = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=9) 00542 _x = self 00543 start = end 00544 end += 48 00545 (_x.nunchuk_acceleration_zeroed.x, _x.nunchuk_acceleration_zeroed.y, _x.nunchuk_acceleration_zeroed.z, _x.nunchuk_acceleration_raw.x, _x.nunchuk_acceleration_raw.y, _x.nunchuk_acceleration_raw.z,) = _struct_6d.unpack(str[start:end]) 00546 start = end 00547 end += 8 00548 self.nunchuk_joystick_zeroed = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=2) 00549 start = end 00550 end += 8 00551 self.nunchuk_joystick_raw = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=2) 00552 start = end 00553 end += 11 00554 self.buttons = numpy.frombuffer(str[start:end], dtype=numpy.bool, count=11) 00555 self.buttons = map(bool, self.buttons) 00556 start = end 00557 end += 2 00558 self.nunchuk_buttons = numpy.frombuffer(str[start:end], dtype=numpy.bool, count=2) 00559 self.nunchuk_buttons = map(bool, self.nunchuk_buttons) 00560 start = end 00561 end += 4 00562 self.LEDs = numpy.frombuffer(str[start:end], dtype=numpy.bool, count=4) 00563 self.LEDs = map(bool, self.LEDs) 00564 start = end 00565 end += 1 00566 (self.rumble,) = _struct_B.unpack(str[start:end]) 00567 self.rumble = bool(self.rumble) 00568 start = end 00569 end += 4 00570 (length,) = _struct_I.unpack(str[start:end]) 00571 self.ir_tracking = [] 00572 for i in range(0, length): 00573 val1 = wiimote.msg.IrSourceInfo() 00574 _x = val1 00575 start = end 00576 end += 24 00577 (_x.x, _x.y, _x.ir_size,) = _struct_2dq.unpack(str[start:end]) 00578 self.ir_tracking.append(val1) 00579 _x = self 00580 start = end 00581 end += 24 00582 (_x.raw_battery, _x.percent_battery, _x.zeroing_time.secs, _x.zeroing_time.nsecs, _x.errors,) = _struct_2f2IQ.unpack(str[start:end]) 00583 self.zeroing_time.canon() 00584 return self 00585 except struct.error as e: 00586 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00587 00588 _struct_I = roslib.message.struct_I 00589 _struct_B = struct.Struct("<B") 00590 _struct_6d = struct.Struct("<6d") 00591 _struct_11B = struct.Struct("<11B") 00592 _struct_9d = struct.Struct("<9d") 00593 _struct_3I = struct.Struct("<3I") 00594 _struct_2f = struct.Struct("<2f") 00595 _struct_2B = struct.Struct("<2B") 00596 _struct_2f2IQ = struct.Struct("<2f2IQ") 00597 _struct_2dq = struct.Struct("<2dq") 00598 _struct_4B = struct.Struct("<4B")