_MotorTraceSample.py
Go to the documentation of this file.
00001 """autogenerated by genpy from sr_edc_ethercat_drivers/MotorTraceSample.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006 
00007 
00008 class MotorTraceSample(genpy.Message):
00009   _md5sum = "f5faf420d7c29e68b1c6bfdff440ffb8"
00010   _type = "sr_edc_ethercat_drivers/MotorTraceSample"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """float64 commanded_effort
00013 float64 slow_effort_limit
00014 float64 quick_effort_limit
00015 float64 motor_current
00016 float64 motor_supply_voltage
00017 float64 hbridge_duty
00018 float64 temperature
00019 float64 force_sensor_1
00020 float64 force_sensor_2
00021 float64 force_sensor_3
00022 float64 motor_velocity
00023 float64 velocity
00024 float64 position
00025 
00026 """
00027   __slots__ = ['commanded_effort','slow_effort_limit','quick_effort_limit','motor_current','motor_supply_voltage','hbridge_duty','temperature','force_sensor_1','force_sensor_2','force_sensor_3','motor_velocity','velocity','position']
00028   _slot_types = ['float64','float64','float64','float64','float64','float64','float64','float64','float64','float64','float64','float64','float64']
00029 
00030   def __init__(self, *args, **kwds):
00031     """
00032     Constructor. Any message fields that are implicitly/explicitly
00033     set to None will be assigned a default value. The recommend
00034     use is keyword arguments as this is more robust to future message
00035     changes.  You cannot mix in-order arguments and keyword arguments.
00036 
00037     The available fields are:
00038        commanded_effort,slow_effort_limit,quick_effort_limit,motor_current,motor_supply_voltage,hbridge_duty,temperature,force_sensor_1,force_sensor_2,force_sensor_3,motor_velocity,velocity,position
00039 
00040     :param args: complete set of field values, in .msg order
00041     :param kwds: use keyword arguments corresponding to message field names
00042     to set specific fields.
00043     """
00044     if args or kwds:
00045       super(MotorTraceSample, self).__init__(*args, **kwds)
00046       #message fields cannot be None, assign default values for those that are
00047       if self.commanded_effort is None:
00048         self.commanded_effort = 0.
00049       if self.slow_effort_limit is None:
00050         self.slow_effort_limit = 0.
00051       if self.quick_effort_limit is None:
00052         self.quick_effort_limit = 0.
00053       if self.motor_current is None:
00054         self.motor_current = 0.
00055       if self.motor_supply_voltage is None:
00056         self.motor_supply_voltage = 0.
00057       if self.hbridge_duty is None:
00058         self.hbridge_duty = 0.
00059       if self.temperature is None:
00060         self.temperature = 0.
00061       if self.force_sensor_1 is None:
00062         self.force_sensor_1 = 0.
00063       if self.force_sensor_2 is None:
00064         self.force_sensor_2 = 0.
00065       if self.force_sensor_3 is None:
00066         self.force_sensor_3 = 0.
00067       if self.motor_velocity is None:
00068         self.motor_velocity = 0.
00069       if self.velocity is None:
00070         self.velocity = 0.
00071       if self.position is None:
00072         self.position = 0.
00073     else:
00074       self.commanded_effort = 0.
00075       self.slow_effort_limit = 0.
00076       self.quick_effort_limit = 0.
00077       self.motor_current = 0.
00078       self.motor_supply_voltage = 0.
00079       self.hbridge_duty = 0.
00080       self.temperature = 0.
00081       self.force_sensor_1 = 0.
00082       self.force_sensor_2 = 0.
00083       self.force_sensor_3 = 0.
00084       self.motor_velocity = 0.
00085       self.velocity = 0.
00086       self.position = 0.
00087 
00088   def _get_types(self):
00089     """
00090     internal API method
00091     """
00092     return self._slot_types
00093 
00094   def serialize(self, buff):
00095     """
00096     serialize message into buffer
00097     :param buff: buffer, ``StringIO``
00098     """
00099     try:
00100       _x = self
00101       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))
00102     except struct.error as se: self._check_types(se)
00103     except TypeError as te: self._check_types(te)
00104 
00105   def deserialize(self, str):
00106     """
00107     unpack serialized message in str into this message instance
00108     :param str: byte array of serialized message, ``str``
00109     """
00110     try:
00111       end = 0
00112       _x = self
00113       start = end
00114       end += 104
00115       (_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])
00116       return self
00117     except struct.error as e:
00118       raise genpy.DeserializationError(e) #most likely buffer underfill
00119 
00120 
00121   def serialize_numpy(self, buff, numpy):
00122     """
00123     serialize message with numpy array types into buffer
00124     :param buff: buffer, ``StringIO``
00125     :param numpy: numpy python module
00126     """
00127     try:
00128       _x = self
00129       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))
00130     except struct.error as se: self._check_types(se)
00131     except TypeError as te: self._check_types(te)
00132 
00133   def deserialize_numpy(self, str, numpy):
00134     """
00135     unpack serialized message in str into this message instance using numpy for array types
00136     :param str: byte array of serialized message, ``str``
00137     :param numpy: numpy python module
00138     """
00139     try:
00140       end = 0
00141       _x = self
00142       start = end
00143       end += 104
00144       (_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])
00145       return self
00146     except struct.error as e:
00147       raise genpy.DeserializationError(e) #most likely buffer underfill
00148 
00149 _struct_I = genpy.struct_I
00150 _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