00001 """autogenerated by genpy from nasa_r2_common_msgs/JointControlDataArray.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006
00007 import nasa_r2_common_msgs.msg
00008 import std_msgs.msg
00009
00010 class JointControlDataArray(genpy.Message):
00011 _md5sum = "96b9d2bc74ad5b1c503caf2252599837"
00012 _type = "nasa_r2_common_msgs/JointControlDataArray"
00013 _has_header = True
00014 _full_text = """Header header
00015 string[] joint
00016 JointControlData[] data
00017
00018 ================================================================================
00019 MSG: std_msgs/Header
00020 # Standard metadata for higher-level stamped data types.
00021 # This is generally used to communicate timestamped data
00022 # in a particular coordinate frame.
00023 #
00024 # sequence ID: consecutively increasing ID
00025 uint32 seq
00026 #Two-integer timestamp that is expressed as:
00027 # * stamp.secs: seconds (stamp_secs) since epoch
00028 # * stamp.nsecs: nanoseconds since stamp_secs
00029 # time-handling sugar is provided by the client library
00030 time stamp
00031 #Frame this data is associated with
00032 # 0: no frame
00033 # 1: global frame
00034 string frame_id
00035
00036 ================================================================================
00037 MSG: nasa_r2_common_msgs/JointControlData
00038 JointControlMode controlMode
00039 JointControlCommandMode commandMode
00040 JointControlCalibrationMode calibrationMode
00041 JointControlClearFaultMode clearFaultMode
00042 JointControlCoeffState coeffState
00043
00044 ================================================================================
00045 MSG: nasa_r2_common_msgs/JointControlMode
00046 uint8 state
00047 uint8 IGNORE = 0
00048 uint8 INVALID = 1
00049 uint8 BOOTLOADER = 2
00050 uint8 FAULTED = 3
00051 uint8 SAFE = 4
00052 uint8 OFF = 5
00053 uint8 PARK = 6
00054 uint8 NEUTRAL = 7
00055 uint8 DRIVE = 8
00056
00057 ================================================================================
00058 MSG: nasa_r2_common_msgs/JointControlCommandMode
00059 uint8 state
00060 uint8 IGNORE = 0
00061 uint8 INVALID = 1
00062 uint8 MOTCOM = 2
00063 uint8 MULTILOOPSTEP = 3
00064 uint8 MULTILOOPSMOOTH = 4
00065 uint8 ACTUATOR = 5
00066 uint8 STALLMODE = 6
00067
00068 ================================================================================
00069 MSG: nasa_r2_common_msgs/JointControlCalibrationMode
00070 uint8 state
00071 uint8 IGNORE = 0
00072 uint8 DISABLE = 1
00073 uint8 ENABLE = 2
00074 uint8 UNCALIBRATED = 3
00075
00076 ================================================================================
00077 MSG: nasa_r2_common_msgs/JointControlClearFaultMode
00078 uint8 state
00079 uint8 IGNORE = 0
00080 uint8 DISABLE = 1
00081 uint8 ENABLE = 2
00082
00083 ================================================================================
00084 MSG: nasa_r2_common_msgs/JointControlCoeffState
00085 uint8 state
00086 uint8 NOTLOADED = 0
00087 uint8 LOADED = 1
00088
00089 """
00090 __slots__ = ['header','joint','data']
00091 _slot_types = ['std_msgs/Header','string[]','nasa_r2_common_msgs/JointControlData[]']
00092
00093 def __init__(self, *args, **kwds):
00094 """
00095 Constructor. Any message fields that are implicitly/explicitly
00096 set to None will be assigned a default value. The recommend
00097 use is keyword arguments as this is more robust to future message
00098 changes. You cannot mix in-order arguments and keyword arguments.
00099
00100 The available fields are:
00101 header,joint,data
00102
00103 :param args: complete set of field values, in .msg order
00104 :param kwds: use keyword arguments corresponding to message field names
00105 to set specific fields.
00106 """
00107 if args or kwds:
00108 super(JointControlDataArray, self).__init__(*args, **kwds)
00109
00110 if self.header is None:
00111 self.header = std_msgs.msg.Header()
00112 if self.joint is None:
00113 self.joint = []
00114 if self.data is None:
00115 self.data = []
00116 else:
00117 self.header = std_msgs.msg.Header()
00118 self.joint = []
00119 self.data = []
00120
00121 def _get_types(self):
00122 """
00123 internal API method
00124 """
00125 return self._slot_types
00126
00127 def serialize(self, buff):
00128 """
00129 serialize message into buffer
00130 :param buff: buffer, ``StringIO``
00131 """
00132 try:
00133 _x = self
00134 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00135 _x = self.header.frame_id
00136 length = len(_x)
00137 if python3 or type(_x) == unicode:
00138 _x = _x.encode('utf-8')
00139 length = len(_x)
00140 buff.write(struct.pack('<I%ss'%length, length, _x))
00141 length = len(self.joint)
00142 buff.write(_struct_I.pack(length))
00143 for val1 in self.joint:
00144 length = len(val1)
00145 if python3 or type(val1) == unicode:
00146 val1 = val1.encode('utf-8')
00147 length = len(val1)
00148 buff.write(struct.pack('<I%ss'%length, length, val1))
00149 length = len(self.data)
00150 buff.write(_struct_I.pack(length))
00151 for val1 in self.data:
00152 _v1 = val1.controlMode
00153 buff.write(_struct_B.pack(_v1.state))
00154 _v2 = val1.commandMode
00155 buff.write(_struct_B.pack(_v2.state))
00156 _v3 = val1.calibrationMode
00157 buff.write(_struct_B.pack(_v3.state))
00158 _v4 = val1.clearFaultMode
00159 buff.write(_struct_B.pack(_v4.state))
00160 _v5 = val1.coeffState
00161 buff.write(_struct_B.pack(_v5.state))
00162 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00163 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00164
00165 def deserialize(self, str):
00166 """
00167 unpack serialized message in str into this message instance
00168 :param str: byte array of serialized message, ``str``
00169 """
00170 try:
00171 if self.header is None:
00172 self.header = std_msgs.msg.Header()
00173 if self.data is None:
00174 self.data = None
00175 end = 0
00176 _x = self
00177 start = end
00178 end += 12
00179 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00180 start = end
00181 end += 4
00182 (length,) = _struct_I.unpack(str[start:end])
00183 start = end
00184 end += length
00185 if python3:
00186 self.header.frame_id = str[start:end].decode('utf-8')
00187 else:
00188 self.header.frame_id = str[start:end]
00189 start = end
00190 end += 4
00191 (length,) = _struct_I.unpack(str[start:end])
00192 self.joint = []
00193 for i in range(0, length):
00194 start = end
00195 end += 4
00196 (length,) = _struct_I.unpack(str[start:end])
00197 start = end
00198 end += length
00199 if python3:
00200 val1 = str[start:end].decode('utf-8')
00201 else:
00202 val1 = str[start:end]
00203 self.joint.append(val1)
00204 start = end
00205 end += 4
00206 (length,) = _struct_I.unpack(str[start:end])
00207 self.data = []
00208 for i in range(0, length):
00209 val1 = nasa_r2_common_msgs.msg.JointControlData()
00210 _v6 = val1.controlMode
00211 start = end
00212 end += 1
00213 (_v6.state,) = _struct_B.unpack(str[start:end])
00214 _v7 = val1.commandMode
00215 start = end
00216 end += 1
00217 (_v7.state,) = _struct_B.unpack(str[start:end])
00218 _v8 = val1.calibrationMode
00219 start = end
00220 end += 1
00221 (_v8.state,) = _struct_B.unpack(str[start:end])
00222 _v9 = val1.clearFaultMode
00223 start = end
00224 end += 1
00225 (_v9.state,) = _struct_B.unpack(str[start:end])
00226 _v10 = val1.coeffState
00227 start = end
00228 end += 1
00229 (_v10.state,) = _struct_B.unpack(str[start:end])
00230 self.data.append(val1)
00231 return self
00232 except struct.error as e:
00233 raise genpy.DeserializationError(e)
00234
00235
00236 def serialize_numpy(self, buff, numpy):
00237 """
00238 serialize message with numpy array types into buffer
00239 :param buff: buffer, ``StringIO``
00240 :param numpy: numpy python module
00241 """
00242 try:
00243 _x = self
00244 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00245 _x = self.header.frame_id
00246 length = len(_x)
00247 if python3 or type(_x) == unicode:
00248 _x = _x.encode('utf-8')
00249 length = len(_x)
00250 buff.write(struct.pack('<I%ss'%length, length, _x))
00251 length = len(self.joint)
00252 buff.write(_struct_I.pack(length))
00253 for val1 in self.joint:
00254 length = len(val1)
00255 if python3 or type(val1) == unicode:
00256 val1 = val1.encode('utf-8')
00257 length = len(val1)
00258 buff.write(struct.pack('<I%ss'%length, length, val1))
00259 length = len(self.data)
00260 buff.write(_struct_I.pack(length))
00261 for val1 in self.data:
00262 _v11 = val1.controlMode
00263 buff.write(_struct_B.pack(_v11.state))
00264 _v12 = val1.commandMode
00265 buff.write(_struct_B.pack(_v12.state))
00266 _v13 = val1.calibrationMode
00267 buff.write(_struct_B.pack(_v13.state))
00268 _v14 = val1.clearFaultMode
00269 buff.write(_struct_B.pack(_v14.state))
00270 _v15 = val1.coeffState
00271 buff.write(_struct_B.pack(_v15.state))
00272 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00273 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00274
00275 def deserialize_numpy(self, str, numpy):
00276 """
00277 unpack serialized message in str into this message instance using numpy for array types
00278 :param str: byte array of serialized message, ``str``
00279 :param numpy: numpy python module
00280 """
00281 try:
00282 if self.header is None:
00283 self.header = std_msgs.msg.Header()
00284 if self.data is None:
00285 self.data = None
00286 end = 0
00287 _x = self
00288 start = end
00289 end += 12
00290 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00291 start = end
00292 end += 4
00293 (length,) = _struct_I.unpack(str[start:end])
00294 start = end
00295 end += length
00296 if python3:
00297 self.header.frame_id = str[start:end].decode('utf-8')
00298 else:
00299 self.header.frame_id = str[start:end]
00300 start = end
00301 end += 4
00302 (length,) = _struct_I.unpack(str[start:end])
00303 self.joint = []
00304 for i in range(0, length):
00305 start = end
00306 end += 4
00307 (length,) = _struct_I.unpack(str[start:end])
00308 start = end
00309 end += length
00310 if python3:
00311 val1 = str[start:end].decode('utf-8')
00312 else:
00313 val1 = str[start:end]
00314 self.joint.append(val1)
00315 start = end
00316 end += 4
00317 (length,) = _struct_I.unpack(str[start:end])
00318 self.data = []
00319 for i in range(0, length):
00320 val1 = nasa_r2_common_msgs.msg.JointControlData()
00321 _v16 = val1.controlMode
00322 start = end
00323 end += 1
00324 (_v16.state,) = _struct_B.unpack(str[start:end])
00325 _v17 = val1.commandMode
00326 start = end
00327 end += 1
00328 (_v17.state,) = _struct_B.unpack(str[start:end])
00329 _v18 = val1.calibrationMode
00330 start = end
00331 end += 1
00332 (_v18.state,) = _struct_B.unpack(str[start:end])
00333 _v19 = val1.clearFaultMode
00334 start = end
00335 end += 1
00336 (_v19.state,) = _struct_B.unpack(str[start:end])
00337 _v20 = val1.coeffState
00338 start = end
00339 end += 1
00340 (_v20.state,) = _struct_B.unpack(str[start:end])
00341 self.data.append(val1)
00342 return self
00343 except struct.error as e:
00344 raise genpy.DeserializationError(e)
00345
00346 _struct_I = genpy.struct_I
00347 _struct_3I = struct.Struct("<3I")
00348 _struct_B = struct.Struct("<B")