$search
00001 """autogenerated by genmsg_py from ContactsState.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 import geometry_msgs.msg 00006 import gazebo_msgs.msg 00007 import std_msgs.msg 00008 00009 class ContactsState(roslib.message.Message): 00010 _md5sum = "9d29ce6da289d3d303cc64b4cfdd0e84" 00011 _type = "gazebo_msgs/ContactsState" 00012 _has_header = True #flag to mark the presence of a Header object 00013 _full_text = """Header header # stamp 00014 gazebo_msgs/ContactState[] states # array of geom pairs in contact 00015 00016 ================================================================================ 00017 MSG: std_msgs/Header 00018 # Standard metadata for higher-level stamped data types. 00019 # This is generally used to communicate timestamped data 00020 # in a particular coordinate frame. 00021 # 00022 # sequence ID: consecutively increasing ID 00023 uint32 seq 00024 #Two-integer timestamp that is expressed as: 00025 # * stamp.secs: seconds (stamp_secs) since epoch 00026 # * stamp.nsecs: nanoseconds since stamp_secs 00027 # time-handling sugar is provided by the client library 00028 time stamp 00029 #Frame this data is associated with 00030 # 0: no frame 00031 # 1: global frame 00032 string frame_id 00033 00034 ================================================================================ 00035 MSG: gazebo_msgs/ContactState 00036 string info # text info on this contact 00037 string geom1_name # name of contact geom1 00038 string geom2_name # name of contact geom2 00039 geometry_msgs/Wrench[] wrenches # list of forces/torques 00040 geometry_msgs/Wrench total_wrench # sum of forces/torques in every DOF 00041 geometry_msgs/Vector3[] contact_positions # list of contact position 00042 geometry_msgs/Vector3[] contact_normals # list of contact normals 00043 float64[] depths # list of penetration depths 00044 00045 ================================================================================ 00046 MSG: geometry_msgs/Wrench 00047 # This represents force in free space, seperated into 00048 # it's linear and angular parts. 00049 Vector3 force 00050 Vector3 torque 00051 00052 ================================================================================ 00053 MSG: geometry_msgs/Vector3 00054 # This represents a vector in free space. 00055 00056 float64 x 00057 float64 y 00058 float64 z 00059 """ 00060 __slots__ = ['header','states'] 00061 _slot_types = ['Header','gazebo_msgs/ContactState[]'] 00062 00063 def __init__(self, *args, **kwds): 00064 """ 00065 Constructor. Any message fields that are implicitly/explicitly 00066 set to None will be assigned a default value. The recommend 00067 use is keyword arguments as this is more robust to future message 00068 changes. You cannot mix in-order arguments and keyword arguments. 00069 00070 The available fields are: 00071 header,states 00072 00073 @param args: complete set of field values, in .msg order 00074 @param kwds: use keyword arguments corresponding to message field names 00075 to set specific fields. 00076 """ 00077 if args or kwds: 00078 super(ContactsState, self).__init__(*args, **kwds) 00079 #message fields cannot be None, assign default values for those that are 00080 if self.header is None: 00081 self.header = std_msgs.msg._Header.Header() 00082 if self.states is None: 00083 self.states = [] 00084 else: 00085 self.header = std_msgs.msg._Header.Header() 00086 self.states = [] 00087 00088 def _get_types(self): 00089 """ 00090 internal API method 00091 """ 00092 return self._slot_types 00093 00094 def serialize(self, buff): 00095 """ 00096 serialize message into buffer 00097 @param buff: buffer 00098 @type buff: StringIO 00099 """ 00100 try: 00101 _x = self 00102 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00103 _x = self.header.frame_id 00104 length = len(_x) 00105 buff.write(struct.pack('<I%ss'%length, length, _x)) 00106 length = len(self.states) 00107 buff.write(_struct_I.pack(length)) 00108 for val1 in self.states: 00109 _x = val1.info 00110 length = len(_x) 00111 buff.write(struct.pack('<I%ss'%length, length, _x)) 00112 _x = val1.geom1_name 00113 length = len(_x) 00114 buff.write(struct.pack('<I%ss'%length, length, _x)) 00115 _x = val1.geom2_name 00116 length = len(_x) 00117 buff.write(struct.pack('<I%ss'%length, length, _x)) 00118 length = len(val1.wrenches) 00119 buff.write(_struct_I.pack(length)) 00120 for val2 in val1.wrenches: 00121 _v1 = val2.force 00122 _x = _v1 00123 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z)) 00124 _v2 = val2.torque 00125 _x = _v2 00126 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z)) 00127 _v3 = val1.total_wrench 00128 _v4 = _v3.force 00129 _x = _v4 00130 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z)) 00131 _v5 = _v3.torque 00132 _x = _v5 00133 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z)) 00134 length = len(val1.contact_positions) 00135 buff.write(_struct_I.pack(length)) 00136 for val2 in val1.contact_positions: 00137 _x = val2 00138 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z)) 00139 length = len(val1.contact_normals) 00140 buff.write(_struct_I.pack(length)) 00141 for val2 in val1.contact_normals: 00142 _x = val2 00143 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z)) 00144 length = len(val1.depths) 00145 buff.write(_struct_I.pack(length)) 00146 pattern = '<%sd'%length 00147 buff.write(struct.pack(pattern, *val1.depths)) 00148 except struct.error as se: self._check_types(se) 00149 except TypeError as te: self._check_types(te) 00150 00151 def deserialize(self, str): 00152 """ 00153 unpack serialized message in str into this message instance 00154 @param str: byte array of serialized message 00155 @type str: str 00156 """ 00157 try: 00158 if self.header is None: 00159 self.header = std_msgs.msg._Header.Header() 00160 end = 0 00161 _x = self 00162 start = end 00163 end += 12 00164 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00165 start = end 00166 end += 4 00167 (length,) = _struct_I.unpack(str[start:end]) 00168 start = end 00169 end += length 00170 self.header.frame_id = str[start:end] 00171 start = end 00172 end += 4 00173 (length,) = _struct_I.unpack(str[start:end]) 00174 self.states = [] 00175 for i in range(0, length): 00176 val1 = gazebo_msgs.msg.ContactState() 00177 start = end 00178 end += 4 00179 (length,) = _struct_I.unpack(str[start:end]) 00180 start = end 00181 end += length 00182 val1.info = str[start:end] 00183 start = end 00184 end += 4 00185 (length,) = _struct_I.unpack(str[start:end]) 00186 start = end 00187 end += length 00188 val1.geom1_name = str[start:end] 00189 start = end 00190 end += 4 00191 (length,) = _struct_I.unpack(str[start:end]) 00192 start = end 00193 end += length 00194 val1.geom2_name = str[start:end] 00195 start = end 00196 end += 4 00197 (length,) = _struct_I.unpack(str[start:end]) 00198 val1.wrenches = [] 00199 for i in range(0, length): 00200 val2 = geometry_msgs.msg.Wrench() 00201 _v6 = val2.force 00202 _x = _v6 00203 start = end 00204 end += 24 00205 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end]) 00206 _v7 = val2.torque 00207 _x = _v7 00208 start = end 00209 end += 24 00210 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end]) 00211 val1.wrenches.append(val2) 00212 _v8 = val1.total_wrench 00213 _v9 = _v8.force 00214 _x = _v9 00215 start = end 00216 end += 24 00217 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end]) 00218 _v10 = _v8.torque 00219 _x = _v10 00220 start = end 00221 end += 24 00222 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end]) 00223 start = end 00224 end += 4 00225 (length,) = _struct_I.unpack(str[start:end]) 00226 val1.contact_positions = [] 00227 for i in range(0, length): 00228 val2 = geometry_msgs.msg.Vector3() 00229 _x = val2 00230 start = end 00231 end += 24 00232 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end]) 00233 val1.contact_positions.append(val2) 00234 start = end 00235 end += 4 00236 (length,) = _struct_I.unpack(str[start:end]) 00237 val1.contact_normals = [] 00238 for i in range(0, length): 00239 val2 = geometry_msgs.msg.Vector3() 00240 _x = val2 00241 start = end 00242 end += 24 00243 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end]) 00244 val1.contact_normals.append(val2) 00245 start = end 00246 end += 4 00247 (length,) = _struct_I.unpack(str[start:end]) 00248 pattern = '<%sd'%length 00249 start = end 00250 end += struct.calcsize(pattern) 00251 val1.depths = struct.unpack(pattern, str[start:end]) 00252 self.states.append(val1) 00253 return self 00254 except struct.error as e: 00255 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00256 00257 00258 def serialize_numpy(self, buff, numpy): 00259 """ 00260 serialize message with numpy array types into buffer 00261 @param buff: buffer 00262 @type buff: StringIO 00263 @param numpy: numpy python module 00264 @type numpy module 00265 """ 00266 try: 00267 _x = self 00268 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00269 _x = self.header.frame_id 00270 length = len(_x) 00271 buff.write(struct.pack('<I%ss'%length, length, _x)) 00272 length = len(self.states) 00273 buff.write(_struct_I.pack(length)) 00274 for val1 in self.states: 00275 _x = val1.info 00276 length = len(_x) 00277 buff.write(struct.pack('<I%ss'%length, length, _x)) 00278 _x = val1.geom1_name 00279 length = len(_x) 00280 buff.write(struct.pack('<I%ss'%length, length, _x)) 00281 _x = val1.geom2_name 00282 length = len(_x) 00283 buff.write(struct.pack('<I%ss'%length, length, _x)) 00284 length = len(val1.wrenches) 00285 buff.write(_struct_I.pack(length)) 00286 for val2 in val1.wrenches: 00287 _v11 = val2.force 00288 _x = _v11 00289 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z)) 00290 _v12 = val2.torque 00291 _x = _v12 00292 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z)) 00293 _v13 = val1.total_wrench 00294 _v14 = _v13.force 00295 _x = _v14 00296 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z)) 00297 _v15 = _v13.torque 00298 _x = _v15 00299 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z)) 00300 length = len(val1.contact_positions) 00301 buff.write(_struct_I.pack(length)) 00302 for val2 in val1.contact_positions: 00303 _x = val2 00304 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z)) 00305 length = len(val1.contact_normals) 00306 buff.write(_struct_I.pack(length)) 00307 for val2 in val1.contact_normals: 00308 _x = val2 00309 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z)) 00310 length = len(val1.depths) 00311 buff.write(_struct_I.pack(length)) 00312 pattern = '<%sd'%length 00313 buff.write(val1.depths.tostring()) 00314 except struct.error as se: self._check_types(se) 00315 except TypeError as te: self._check_types(te) 00316 00317 def deserialize_numpy(self, str, numpy): 00318 """ 00319 unpack serialized message in str into this message instance using numpy for array types 00320 @param str: byte array of serialized message 00321 @type str: str 00322 @param numpy: numpy python module 00323 @type numpy: module 00324 """ 00325 try: 00326 if self.header is None: 00327 self.header = std_msgs.msg._Header.Header() 00328 end = 0 00329 _x = self 00330 start = end 00331 end += 12 00332 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00333 start = end 00334 end += 4 00335 (length,) = _struct_I.unpack(str[start:end]) 00336 start = end 00337 end += length 00338 self.header.frame_id = str[start:end] 00339 start = end 00340 end += 4 00341 (length,) = _struct_I.unpack(str[start:end]) 00342 self.states = [] 00343 for i in range(0, length): 00344 val1 = gazebo_msgs.msg.ContactState() 00345 start = end 00346 end += 4 00347 (length,) = _struct_I.unpack(str[start:end]) 00348 start = end 00349 end += length 00350 val1.info = str[start:end] 00351 start = end 00352 end += 4 00353 (length,) = _struct_I.unpack(str[start:end]) 00354 start = end 00355 end += length 00356 val1.geom1_name = str[start:end] 00357 start = end 00358 end += 4 00359 (length,) = _struct_I.unpack(str[start:end]) 00360 start = end 00361 end += length 00362 val1.geom2_name = str[start:end] 00363 start = end 00364 end += 4 00365 (length,) = _struct_I.unpack(str[start:end]) 00366 val1.wrenches = [] 00367 for i in range(0, length): 00368 val2 = geometry_msgs.msg.Wrench() 00369 _v16 = val2.force 00370 _x = _v16 00371 start = end 00372 end += 24 00373 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end]) 00374 _v17 = val2.torque 00375 _x = _v17 00376 start = end 00377 end += 24 00378 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end]) 00379 val1.wrenches.append(val2) 00380 _v18 = val1.total_wrench 00381 _v19 = _v18.force 00382 _x = _v19 00383 start = end 00384 end += 24 00385 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end]) 00386 _v20 = _v18.torque 00387 _x = _v20 00388 start = end 00389 end += 24 00390 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end]) 00391 start = end 00392 end += 4 00393 (length,) = _struct_I.unpack(str[start:end]) 00394 val1.contact_positions = [] 00395 for i in range(0, length): 00396 val2 = geometry_msgs.msg.Vector3() 00397 _x = val2 00398 start = end 00399 end += 24 00400 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end]) 00401 val1.contact_positions.append(val2) 00402 start = end 00403 end += 4 00404 (length,) = _struct_I.unpack(str[start:end]) 00405 val1.contact_normals = [] 00406 for i in range(0, length): 00407 val2 = geometry_msgs.msg.Vector3() 00408 _x = val2 00409 start = end 00410 end += 24 00411 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end]) 00412 val1.contact_normals.append(val2) 00413 start = end 00414 end += 4 00415 (length,) = _struct_I.unpack(str[start:end]) 00416 pattern = '<%sd'%length 00417 start = end 00418 end += struct.calcsize(pattern) 00419 val1.depths = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length) 00420 self.states.append(val1) 00421 return self 00422 except struct.error as e: 00423 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00424 00425 _struct_I = roslib.message.struct_I 00426 _struct_3I = struct.Struct("<3I") 00427 _struct_3d = struct.Struct("<3d")