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