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