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