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


sr_edc_ethercat_drivers
Author(s): Yann Sionneau, Ugo Cupcic / ugo@shadowrobot.com, software@shadowrobot.com
autogenerated on Thu Jan 2 2014 12:03:32