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