$search
00001 """autogenerated by genmsg_py from ContactState.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 import geometry_msgs.msg 00006 00007 class ContactState(roslib.message.Message): 00008 _md5sum = "7f688fc24d90d16872fdc9ea8c6e45ab" 00009 _type = "gazebo/ContactState" 00010 _has_header = False #flag to mark the presence of a Header object 00011 _full_text = """#This message is deprecated. Please use the version in gazebo_msgs instead. 00012 00013 string info # text info on this contact 00014 string geom1_name # name of contact geom1 00015 string geom2_name # name of contact geom2 00016 geometry_msgs/Wrench[] wrenches # list of forces/torques 00017 geometry_msgs/Wrench total_wrench # sum of forces/torques in every DOF 00018 geometry_msgs/Vector3[] contact_positions # list of contact position 00019 geometry_msgs/Vector3[] contact_normals # list of contact normals 00020 float64[] depths # list of penetration depths 00021 00022 ================================================================================ 00023 MSG: geometry_msgs/Wrench 00024 # This represents force in free space, seperated into 00025 # it's linear and angular parts. 00026 Vector3 force 00027 Vector3 torque 00028 00029 ================================================================================ 00030 MSG: geometry_msgs/Vector3 00031 # This represents a vector in free space. 00032 00033 float64 x 00034 float64 y 00035 float64 z 00036 """ 00037 __slots__ = ['info','geom1_name','geom2_name','wrenches','total_wrench','contact_positions','contact_normals','depths'] 00038 _slot_types = ['string','string','string','geometry_msgs/Wrench[]','geometry_msgs/Wrench','geometry_msgs/Vector3[]','geometry_msgs/Vector3[]','float64[]'] 00039 00040 def __init__(self, *args, **kwds): 00041 """ 00042 Constructor. Any message fields that are implicitly/explicitly 00043 set to None will be assigned a default value. The recommend 00044 use is keyword arguments as this is more robust to future message 00045 changes. You cannot mix in-order arguments and keyword arguments. 00046 00047 The available fields are: 00048 info,geom1_name,geom2_name,wrenches,total_wrench,contact_positions,contact_normals,depths 00049 00050 @param args: complete set of field values, in .msg order 00051 @param kwds: use keyword arguments corresponding to message field names 00052 to set specific fields. 00053 """ 00054 if args or kwds: 00055 super(ContactState, self).__init__(*args, **kwds) 00056 #message fields cannot be None, assign default values for those that are 00057 if self.info is None: 00058 self.info = '' 00059 if self.geom1_name is None: 00060 self.geom1_name = '' 00061 if self.geom2_name is None: 00062 self.geom2_name = '' 00063 if self.wrenches is None: 00064 self.wrenches = [] 00065 if self.total_wrench is None: 00066 self.total_wrench = geometry_msgs.msg.Wrench() 00067 if self.contact_positions is None: 00068 self.contact_positions = [] 00069 if self.contact_normals is None: 00070 self.contact_normals = [] 00071 if self.depths is None: 00072 self.depths = [] 00073 else: 00074 self.info = '' 00075 self.geom1_name = '' 00076 self.geom2_name = '' 00077 self.wrenches = [] 00078 self.total_wrench = geometry_msgs.msg.Wrench() 00079 self.contact_positions = [] 00080 self.contact_normals = [] 00081 self.depths = [] 00082 00083 def _get_types(self): 00084 """ 00085 internal API method 00086 """ 00087 return self._slot_types 00088 00089 def serialize(self, buff): 00090 """ 00091 serialize message into buffer 00092 @param buff: buffer 00093 @type buff: StringIO 00094 """ 00095 try: 00096 _x = self.info 00097 length = len(_x) 00098 buff.write(struct.pack('<I%ss'%length, length, _x)) 00099 _x = self.geom1_name 00100 length = len(_x) 00101 buff.write(struct.pack('<I%ss'%length, length, _x)) 00102 _x = self.geom2_name 00103 length = len(_x) 00104 buff.write(struct.pack('<I%ss'%length, length, _x)) 00105 length = len(self.wrenches) 00106 buff.write(_struct_I.pack(length)) 00107 for val1 in self.wrenches: 00108 _v1 = val1.force 00109 _x = _v1 00110 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z)) 00111 _v2 = val1.torque 00112 _x = _v2 00113 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z)) 00114 _x = self 00115 buff.write(_struct_6d.pack(_x.total_wrench.force.x, _x.total_wrench.force.y, _x.total_wrench.force.z, _x.total_wrench.torque.x, _x.total_wrench.torque.y, _x.total_wrench.torque.z)) 00116 length = len(self.contact_positions) 00117 buff.write(_struct_I.pack(length)) 00118 for val1 in self.contact_positions: 00119 _x = val1 00120 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z)) 00121 length = len(self.contact_normals) 00122 buff.write(_struct_I.pack(length)) 00123 for val1 in self.contact_normals: 00124 _x = val1 00125 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z)) 00126 length = len(self.depths) 00127 buff.write(_struct_I.pack(length)) 00128 pattern = '<%sd'%length 00129 buff.write(struct.pack(pattern, *self.depths)) 00130 except struct.error as se: self._check_types(se) 00131 except TypeError as te: self._check_types(te) 00132 00133 def deserialize(self, str): 00134 """ 00135 unpack serialized message in str into this message instance 00136 @param str: byte array of serialized message 00137 @type str: str 00138 """ 00139 try: 00140 if self.total_wrench is None: 00141 self.total_wrench = geometry_msgs.msg.Wrench() 00142 end = 0 00143 start = end 00144 end += 4 00145 (length,) = _struct_I.unpack(str[start:end]) 00146 start = end 00147 end += length 00148 self.info = str[start:end] 00149 start = end 00150 end += 4 00151 (length,) = _struct_I.unpack(str[start:end]) 00152 start = end 00153 end += length 00154 self.geom1_name = str[start:end] 00155 start = end 00156 end += 4 00157 (length,) = _struct_I.unpack(str[start:end]) 00158 start = end 00159 end += length 00160 self.geom2_name = str[start:end] 00161 start = end 00162 end += 4 00163 (length,) = _struct_I.unpack(str[start:end]) 00164 self.wrenches = [] 00165 for i in range(0, length): 00166 val1 = geometry_msgs.msg.Wrench() 00167 _v3 = val1.force 00168 _x = _v3 00169 start = end 00170 end += 24 00171 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end]) 00172 _v4 = val1.torque 00173 _x = _v4 00174 start = end 00175 end += 24 00176 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end]) 00177 self.wrenches.append(val1) 00178 _x = self 00179 start = end 00180 end += 48 00181 (_x.total_wrench.force.x, _x.total_wrench.force.y, _x.total_wrench.force.z, _x.total_wrench.torque.x, _x.total_wrench.torque.y, _x.total_wrench.torque.z,) = _struct_6d.unpack(str[start:end]) 00182 start = end 00183 end += 4 00184 (length,) = _struct_I.unpack(str[start:end]) 00185 self.contact_positions = [] 00186 for i in range(0, length): 00187 val1 = geometry_msgs.msg.Vector3() 00188 _x = val1 00189 start = end 00190 end += 24 00191 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end]) 00192 self.contact_positions.append(val1) 00193 start = end 00194 end += 4 00195 (length,) = _struct_I.unpack(str[start:end]) 00196 self.contact_normals = [] 00197 for i in range(0, length): 00198 val1 = geometry_msgs.msg.Vector3() 00199 _x = val1 00200 start = end 00201 end += 24 00202 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end]) 00203 self.contact_normals.append(val1) 00204 start = end 00205 end += 4 00206 (length,) = _struct_I.unpack(str[start:end]) 00207 pattern = '<%sd'%length 00208 start = end 00209 end += struct.calcsize(pattern) 00210 self.depths = struct.unpack(pattern, str[start:end]) 00211 return self 00212 except struct.error as e: 00213 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00214 00215 00216 def serialize_numpy(self, buff, numpy): 00217 """ 00218 serialize message with numpy array types into buffer 00219 @param buff: buffer 00220 @type buff: StringIO 00221 @param numpy: numpy python module 00222 @type numpy module 00223 """ 00224 try: 00225 _x = self.info 00226 length = len(_x) 00227 buff.write(struct.pack('<I%ss'%length, length, _x)) 00228 _x = self.geom1_name 00229 length = len(_x) 00230 buff.write(struct.pack('<I%ss'%length, length, _x)) 00231 _x = self.geom2_name 00232 length = len(_x) 00233 buff.write(struct.pack('<I%ss'%length, length, _x)) 00234 length = len(self.wrenches) 00235 buff.write(_struct_I.pack(length)) 00236 for val1 in self.wrenches: 00237 _v5 = val1.force 00238 _x = _v5 00239 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z)) 00240 _v6 = val1.torque 00241 _x = _v6 00242 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z)) 00243 _x = self 00244 buff.write(_struct_6d.pack(_x.total_wrench.force.x, _x.total_wrench.force.y, _x.total_wrench.force.z, _x.total_wrench.torque.x, _x.total_wrench.torque.y, _x.total_wrench.torque.z)) 00245 length = len(self.contact_positions) 00246 buff.write(_struct_I.pack(length)) 00247 for val1 in self.contact_positions: 00248 _x = val1 00249 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z)) 00250 length = len(self.contact_normals) 00251 buff.write(_struct_I.pack(length)) 00252 for val1 in self.contact_normals: 00253 _x = val1 00254 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z)) 00255 length = len(self.depths) 00256 buff.write(_struct_I.pack(length)) 00257 pattern = '<%sd'%length 00258 buff.write(self.depths.tostring()) 00259 except struct.error as se: self._check_types(se) 00260 except TypeError as te: self._check_types(te) 00261 00262 def deserialize_numpy(self, str, numpy): 00263 """ 00264 unpack serialized message in str into this message instance using numpy for array types 00265 @param str: byte array of serialized message 00266 @type str: str 00267 @param numpy: numpy python module 00268 @type numpy: module 00269 """ 00270 try: 00271 if self.total_wrench is None: 00272 self.total_wrench = geometry_msgs.msg.Wrench() 00273 end = 0 00274 start = end 00275 end += 4 00276 (length,) = _struct_I.unpack(str[start:end]) 00277 start = end 00278 end += length 00279 self.info = str[start:end] 00280 start = end 00281 end += 4 00282 (length,) = _struct_I.unpack(str[start:end]) 00283 start = end 00284 end += length 00285 self.geom1_name = str[start:end] 00286 start = end 00287 end += 4 00288 (length,) = _struct_I.unpack(str[start:end]) 00289 start = end 00290 end += length 00291 self.geom2_name = str[start:end] 00292 start = end 00293 end += 4 00294 (length,) = _struct_I.unpack(str[start:end]) 00295 self.wrenches = [] 00296 for i in range(0, length): 00297 val1 = geometry_msgs.msg.Wrench() 00298 _v7 = val1.force 00299 _x = _v7 00300 start = end 00301 end += 24 00302 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end]) 00303 _v8 = val1.torque 00304 _x = _v8 00305 start = end 00306 end += 24 00307 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end]) 00308 self.wrenches.append(val1) 00309 _x = self 00310 start = end 00311 end += 48 00312 (_x.total_wrench.force.x, _x.total_wrench.force.y, _x.total_wrench.force.z, _x.total_wrench.torque.x, _x.total_wrench.torque.y, _x.total_wrench.torque.z,) = _struct_6d.unpack(str[start:end]) 00313 start = end 00314 end += 4 00315 (length,) = _struct_I.unpack(str[start:end]) 00316 self.contact_positions = [] 00317 for i in range(0, length): 00318 val1 = geometry_msgs.msg.Vector3() 00319 _x = val1 00320 start = end 00321 end += 24 00322 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end]) 00323 self.contact_positions.append(val1) 00324 start = end 00325 end += 4 00326 (length,) = _struct_I.unpack(str[start:end]) 00327 self.contact_normals = [] 00328 for i in range(0, length): 00329 val1 = geometry_msgs.msg.Vector3() 00330 _x = val1 00331 start = end 00332 end += 24 00333 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end]) 00334 self.contact_normals.append(val1) 00335 start = end 00336 end += 4 00337 (length,) = _struct_I.unpack(str[start:end]) 00338 pattern = '<%sd'%length 00339 start = end 00340 end += struct.calcsize(pattern) 00341 self.depths = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length) 00342 return self 00343 except struct.error as e: 00344 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00345 00346 _struct_I = roslib.message.struct_I 00347 _struct_6d = struct.Struct("<6d") 00348 _struct_3d = struct.Struct("<3d")