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