00001 """autogenerated by genpy from ethercat_hardware/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 = "3734a66334bc2033448f9c561d39c5e0"
00010 _type = "ethercat_hardware/MotorTraceSample"
00011 _has_header = False
00012 _full_text = """float64 timestamp
00013 bool enabled
00014 float64 supply_voltage
00015 float64 measured_motor_voltage
00016 float64 programmed_pwm
00017 float64 executed_current
00018 float64 measured_current
00019 float64 velocity
00020 float64 encoder_position
00021 uint32 encoder_error_count
00022 float64 motor_voltage_error_limit
00023 float64 filtered_motor_voltage_error
00024 float64 filtered_abs_motor_voltage_error
00025 float64 filtered_measured_voltage_error
00026 float64 filtered_abs_measured_voltage_error
00027 float64 filtered_current_error
00028 float64 filtered_abs_current_error
00029 """
00030 __slots__ = ['timestamp','enabled','supply_voltage','measured_motor_voltage','programmed_pwm','executed_current','measured_current','velocity','encoder_position','encoder_error_count','motor_voltage_error_limit','filtered_motor_voltage_error','filtered_abs_motor_voltage_error','filtered_measured_voltage_error','filtered_abs_measured_voltage_error','filtered_current_error','filtered_abs_current_error']
00031 _slot_types = ['float64','bool','float64','float64','float64','float64','float64','float64','float64','uint32','float64','float64','float64','float64','float64','float64','float64']
00032
00033 def __init__(self, *args, **kwds):
00034 """
00035 Constructor. Any message fields that are implicitly/explicitly
00036 set to None will be assigned a default value. The recommend
00037 use is keyword arguments as this is more robust to future message
00038 changes. You cannot mix in-order arguments and keyword arguments.
00039
00040 The available fields are:
00041 timestamp,enabled,supply_voltage,measured_motor_voltage,programmed_pwm,executed_current,measured_current,velocity,encoder_position,encoder_error_count,motor_voltage_error_limit,filtered_motor_voltage_error,filtered_abs_motor_voltage_error,filtered_measured_voltage_error,filtered_abs_measured_voltage_error,filtered_current_error,filtered_abs_current_error
00042
00043 :param args: complete set of field values, in .msg order
00044 :param kwds: use keyword arguments corresponding to message field names
00045 to set specific fields.
00046 """
00047 if args or kwds:
00048 super(MotorTraceSample, self).__init__(*args, **kwds)
00049
00050 if self.timestamp is None:
00051 self.timestamp = 0.
00052 if self.enabled is None:
00053 self.enabled = False
00054 if self.supply_voltage is None:
00055 self.supply_voltage = 0.
00056 if self.measured_motor_voltage is None:
00057 self.measured_motor_voltage = 0.
00058 if self.programmed_pwm is None:
00059 self.programmed_pwm = 0.
00060 if self.executed_current is None:
00061 self.executed_current = 0.
00062 if self.measured_current is None:
00063 self.measured_current = 0.
00064 if self.velocity is None:
00065 self.velocity = 0.
00066 if self.encoder_position is None:
00067 self.encoder_position = 0.
00068 if self.encoder_error_count is None:
00069 self.encoder_error_count = 0
00070 if self.motor_voltage_error_limit is None:
00071 self.motor_voltage_error_limit = 0.
00072 if self.filtered_motor_voltage_error is None:
00073 self.filtered_motor_voltage_error = 0.
00074 if self.filtered_abs_motor_voltage_error is None:
00075 self.filtered_abs_motor_voltage_error = 0.
00076 if self.filtered_measured_voltage_error is None:
00077 self.filtered_measured_voltage_error = 0.
00078 if self.filtered_abs_measured_voltage_error is None:
00079 self.filtered_abs_measured_voltage_error = 0.
00080 if self.filtered_current_error is None:
00081 self.filtered_current_error = 0.
00082 if self.filtered_abs_current_error is None:
00083 self.filtered_abs_current_error = 0.
00084 else:
00085 self.timestamp = 0.
00086 self.enabled = False
00087 self.supply_voltage = 0.
00088 self.measured_motor_voltage = 0.
00089 self.programmed_pwm = 0.
00090 self.executed_current = 0.
00091 self.measured_current = 0.
00092 self.velocity = 0.
00093 self.encoder_position = 0.
00094 self.encoder_error_count = 0
00095 self.motor_voltage_error_limit = 0.
00096 self.filtered_motor_voltage_error = 0.
00097 self.filtered_abs_motor_voltage_error = 0.
00098 self.filtered_measured_voltage_error = 0.
00099 self.filtered_abs_measured_voltage_error = 0.
00100 self.filtered_current_error = 0.
00101 self.filtered_abs_current_error = 0.
00102
00103 def _get_types(self):
00104 """
00105 internal API method
00106 """
00107 return self._slot_types
00108
00109 def serialize(self, buff):
00110 """
00111 serialize message into buffer
00112 :param buff: buffer, ``StringIO``
00113 """
00114 try:
00115 _x = self
00116 buff.write(_struct_dB7dI7d.pack(_x.timestamp, _x.enabled, _x.supply_voltage, _x.measured_motor_voltage, _x.programmed_pwm, _x.executed_current, _x.measured_current, _x.velocity, _x.encoder_position, _x.encoder_error_count, _x.motor_voltage_error_limit, _x.filtered_motor_voltage_error, _x.filtered_abs_motor_voltage_error, _x.filtered_measured_voltage_error, _x.filtered_abs_measured_voltage_error, _x.filtered_current_error, _x.filtered_abs_current_error))
00117 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00118 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00119
00120 def deserialize(self, str):
00121 """
00122 unpack serialized message in str into this message instance
00123 :param str: byte array of serialized message, ``str``
00124 """
00125 try:
00126 end = 0
00127 _x = self
00128 start = end
00129 end += 125
00130 (_x.timestamp, _x.enabled, _x.supply_voltage, _x.measured_motor_voltage, _x.programmed_pwm, _x.executed_current, _x.measured_current, _x.velocity, _x.encoder_position, _x.encoder_error_count, _x.motor_voltage_error_limit, _x.filtered_motor_voltage_error, _x.filtered_abs_motor_voltage_error, _x.filtered_measured_voltage_error, _x.filtered_abs_measured_voltage_error, _x.filtered_current_error, _x.filtered_abs_current_error,) = _struct_dB7dI7d.unpack(str[start:end])
00131 self.enabled = bool(self.enabled)
00132 return self
00133 except struct.error as e:
00134 raise genpy.DeserializationError(e)
00135
00136
00137 def serialize_numpy(self, buff, numpy):
00138 """
00139 serialize message with numpy array types into buffer
00140 :param buff: buffer, ``StringIO``
00141 :param numpy: numpy python module
00142 """
00143 try:
00144 _x = self
00145 buff.write(_struct_dB7dI7d.pack(_x.timestamp, _x.enabled, _x.supply_voltage, _x.measured_motor_voltage, _x.programmed_pwm, _x.executed_current, _x.measured_current, _x.velocity, _x.encoder_position, _x.encoder_error_count, _x.motor_voltage_error_limit, _x.filtered_motor_voltage_error, _x.filtered_abs_motor_voltage_error, _x.filtered_measured_voltage_error, _x.filtered_abs_measured_voltage_error, _x.filtered_current_error, _x.filtered_abs_current_error))
00146 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00147 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00148
00149 def deserialize_numpy(self, str, numpy):
00150 """
00151 unpack serialized message in str into this message instance using numpy for array types
00152 :param str: byte array of serialized message, ``str``
00153 :param numpy: numpy python module
00154 """
00155 try:
00156 end = 0
00157 _x = self
00158 start = end
00159 end += 125
00160 (_x.timestamp, _x.enabled, _x.supply_voltage, _x.measured_motor_voltage, _x.programmed_pwm, _x.executed_current, _x.measured_current, _x.velocity, _x.encoder_position, _x.encoder_error_count, _x.motor_voltage_error_limit, _x.filtered_motor_voltage_error, _x.filtered_abs_motor_voltage_error, _x.filtered_measured_voltage_error, _x.filtered_abs_measured_voltage_error, _x.filtered_current_error, _x.filtered_abs_current_error,) = _struct_dB7dI7d.unpack(str[start:end])
00161 self.enabled = bool(self.enabled)
00162 return self
00163 except struct.error as e:
00164 raise genpy.DeserializationError(e)
00165
00166 _struct_I = genpy.struct_I
00167 _struct_dB7dI7d = struct.Struct("<dB7dI7d")