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