$search
00001 """autogenerated by genmsg_py from ModelStates.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 import geometry_msgs.msg 00006 00007 class ModelStates(roslib.message.Message): 00008 _md5sum = "48c080191eb15c41858319b4d8a609c2" 00009 _type = "gazebo/ModelStates" 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 # broadcast all model states in world frame 00014 string[] name # model names 00015 geometry_msgs/Pose[] pose # desired pose in world frame 00016 geometry_msgs/Twist[] twist # desired twist in world frame 00017 00018 ================================================================================ 00019 MSG: geometry_msgs/Pose 00020 # A representation of pose in free space, composed of postion and orientation. 00021 Point position 00022 Quaternion orientation 00023 00024 ================================================================================ 00025 MSG: geometry_msgs/Point 00026 # This contains the position of a point in free space 00027 float64 x 00028 float64 y 00029 float64 z 00030 00031 ================================================================================ 00032 MSG: geometry_msgs/Quaternion 00033 # This represents an orientation in free space in quaternion form. 00034 00035 float64 x 00036 float64 y 00037 float64 z 00038 float64 w 00039 00040 ================================================================================ 00041 MSG: geometry_msgs/Twist 00042 # This expresses velocity in free space broken into it's linear and angular parts. 00043 Vector3 linear 00044 Vector3 angular 00045 00046 ================================================================================ 00047 MSG: geometry_msgs/Vector3 00048 # This represents a vector in free space. 00049 00050 float64 x 00051 float64 y 00052 float64 z 00053 """ 00054 __slots__ = ['name','pose','twist'] 00055 _slot_types = ['string[]','geometry_msgs/Pose[]','geometry_msgs/Twist[]'] 00056 00057 def __init__(self, *args, **kwds): 00058 """ 00059 Constructor. Any message fields that are implicitly/explicitly 00060 set to None will be assigned a default value. The recommend 00061 use is keyword arguments as this is more robust to future message 00062 changes. You cannot mix in-order arguments and keyword arguments. 00063 00064 The available fields are: 00065 name,pose,twist 00066 00067 @param args: complete set of field values, in .msg order 00068 @param kwds: use keyword arguments corresponding to message field names 00069 to set specific fields. 00070 """ 00071 if args or kwds: 00072 super(ModelStates, self).__init__(*args, **kwds) 00073 #message fields cannot be None, assign default values for those that are 00074 if self.name is None: 00075 self.name = [] 00076 if self.pose is None: 00077 self.pose = [] 00078 if self.twist is None: 00079 self.twist = [] 00080 else: 00081 self.name = [] 00082 self.pose = [] 00083 self.twist = [] 00084 00085 def _get_types(self): 00086 """ 00087 internal API method 00088 """ 00089 return self._slot_types 00090 00091 def serialize(self, buff): 00092 """ 00093 serialize message into buffer 00094 @param buff: buffer 00095 @type buff: StringIO 00096 """ 00097 try: 00098 length = len(self.name) 00099 buff.write(_struct_I.pack(length)) 00100 for val1 in self.name: 00101 length = len(val1) 00102 buff.write(struct.pack('<I%ss'%length, length, val1)) 00103 length = len(self.pose) 00104 buff.write(_struct_I.pack(length)) 00105 for val1 in self.pose: 00106 _v1 = val1.position 00107 _x = _v1 00108 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z)) 00109 _v2 = val1.orientation 00110 _x = _v2 00111 buff.write(_struct_4d.pack(_x.x, _x.y, _x.z, _x.w)) 00112 length = len(self.twist) 00113 buff.write(_struct_I.pack(length)) 00114 for val1 in self.twist: 00115 _v3 = val1.linear 00116 _x = _v3 00117 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z)) 00118 _v4 = val1.angular 00119 _x = _v4 00120 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z)) 00121 except struct.error as se: self._check_types(se) 00122 except TypeError as te: self._check_types(te) 00123 00124 def deserialize(self, str): 00125 """ 00126 unpack serialized message in str into this message instance 00127 @param str: byte array of serialized message 00128 @type str: str 00129 """ 00130 try: 00131 end = 0 00132 start = end 00133 end += 4 00134 (length,) = _struct_I.unpack(str[start:end]) 00135 self.name = [] 00136 for i in range(0, length): 00137 start = end 00138 end += 4 00139 (length,) = _struct_I.unpack(str[start:end]) 00140 start = end 00141 end += length 00142 val1 = str[start:end] 00143 self.name.append(val1) 00144 start = end 00145 end += 4 00146 (length,) = _struct_I.unpack(str[start:end]) 00147 self.pose = [] 00148 for i in range(0, length): 00149 val1 = geometry_msgs.msg.Pose() 00150 _v5 = val1.position 00151 _x = _v5 00152 start = end 00153 end += 24 00154 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end]) 00155 _v6 = val1.orientation 00156 _x = _v6 00157 start = end 00158 end += 32 00159 (_x.x, _x.y, _x.z, _x.w,) = _struct_4d.unpack(str[start:end]) 00160 self.pose.append(val1) 00161 start = end 00162 end += 4 00163 (length,) = _struct_I.unpack(str[start:end]) 00164 self.twist = [] 00165 for i in range(0, length): 00166 val1 = geometry_msgs.msg.Twist() 00167 _v7 = val1.linear 00168 _x = _v7 00169 start = end 00170 end += 24 00171 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end]) 00172 _v8 = val1.angular 00173 _x = _v8 00174 start = end 00175 end += 24 00176 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end]) 00177 self.twist.append(val1) 00178 return self 00179 except struct.error as e: 00180 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00181 00182 00183 def serialize_numpy(self, buff, numpy): 00184 """ 00185 serialize message with numpy array types into buffer 00186 @param buff: buffer 00187 @type buff: StringIO 00188 @param numpy: numpy python module 00189 @type numpy module 00190 """ 00191 try: 00192 length = len(self.name) 00193 buff.write(_struct_I.pack(length)) 00194 for val1 in self.name: 00195 length = len(val1) 00196 buff.write(struct.pack('<I%ss'%length, length, val1)) 00197 length = len(self.pose) 00198 buff.write(_struct_I.pack(length)) 00199 for val1 in self.pose: 00200 _v9 = val1.position 00201 _x = _v9 00202 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z)) 00203 _v10 = val1.orientation 00204 _x = _v10 00205 buff.write(_struct_4d.pack(_x.x, _x.y, _x.z, _x.w)) 00206 length = len(self.twist) 00207 buff.write(_struct_I.pack(length)) 00208 for val1 in self.twist: 00209 _v11 = val1.linear 00210 _x = _v11 00211 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z)) 00212 _v12 = val1.angular 00213 _x = _v12 00214 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z)) 00215 except struct.error as se: self._check_types(se) 00216 except TypeError as te: self._check_types(te) 00217 00218 def deserialize_numpy(self, str, numpy): 00219 """ 00220 unpack serialized message in str into this message instance using numpy for array types 00221 @param str: byte array of serialized message 00222 @type str: str 00223 @param numpy: numpy python module 00224 @type numpy: module 00225 """ 00226 try: 00227 end = 0 00228 start = end 00229 end += 4 00230 (length,) = _struct_I.unpack(str[start:end]) 00231 self.name = [] 00232 for i in range(0, length): 00233 start = end 00234 end += 4 00235 (length,) = _struct_I.unpack(str[start:end]) 00236 start = end 00237 end += length 00238 val1 = str[start:end] 00239 self.name.append(val1) 00240 start = end 00241 end += 4 00242 (length,) = _struct_I.unpack(str[start:end]) 00243 self.pose = [] 00244 for i in range(0, length): 00245 val1 = geometry_msgs.msg.Pose() 00246 _v13 = val1.position 00247 _x = _v13 00248 start = end 00249 end += 24 00250 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end]) 00251 _v14 = val1.orientation 00252 _x = _v14 00253 start = end 00254 end += 32 00255 (_x.x, _x.y, _x.z, _x.w,) = _struct_4d.unpack(str[start:end]) 00256 self.pose.append(val1) 00257 start = end 00258 end += 4 00259 (length,) = _struct_I.unpack(str[start:end]) 00260 self.twist = [] 00261 for i in range(0, length): 00262 val1 = geometry_msgs.msg.Twist() 00263 _v15 = val1.linear 00264 _x = _v15 00265 start = end 00266 end += 24 00267 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end]) 00268 _v16 = val1.angular 00269 _x = _v16 00270 start = end 00271 end += 24 00272 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end]) 00273 self.twist.append(val1) 00274 return self 00275 except struct.error as e: 00276 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00277 00278 _struct_I = roslib.message.struct_I 00279 _struct_4d = struct.Struct("<4d") 00280 _struct_3d = struct.Struct("<3d")