00001 """autogenerated by genpy from dynamixel_msgs/MotorStateList.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 dynamixel_msgs.msg
00008
00009 class MotorStateList(genpy.Message):
00010 _md5sum = "9e94ccf6563ca78afce19eb097f9343c"
00011 _type = "dynamixel_msgs/MotorStateList"
00012 _has_header = False
00013 _full_text = """MotorState[] motor_states
00014
00015 ================================================================================
00016 MSG: dynamixel_msgs/MotorState
00017 float64 timestamp # motor state is at this time
00018 int32 id # motor id
00019 int32 goal # commanded position (in encoder units)
00020 int32 position # current position (in encoder units)
00021 int32 error # difference between current and goal positions
00022 int32 speed # current speed (0.111 rpm per unit)
00023 float64 load # current load - ratio of applied torque over maximum torque
00024 float64 voltage # current voltage (V)
00025 int32 temperature # current temperature (degrees Celsius)
00026 bool moving # whether the motor is currently in motion
00027
00028 """
00029 __slots__ = ['motor_states']
00030 _slot_types = ['dynamixel_msgs/MotorState[]']
00031
00032 def __init__(self, *args, **kwds):
00033 """
00034 Constructor. Any message fields that are implicitly/explicitly
00035 set to None will be assigned a default value. The recommend
00036 use is keyword arguments as this is more robust to future message
00037 changes. You cannot mix in-order arguments and keyword arguments.
00038
00039 The available fields are:
00040 motor_states
00041
00042 :param args: complete set of field values, in .msg order
00043 :param kwds: use keyword arguments corresponding to message field names
00044 to set specific fields.
00045 """
00046 if args or kwds:
00047 super(MotorStateList, self).__init__(*args, **kwds)
00048
00049 if self.motor_states is None:
00050 self.motor_states = []
00051 else:
00052 self.motor_states = []
00053
00054 def _get_types(self):
00055 """
00056 internal API method
00057 """
00058 return self._slot_types
00059
00060 def serialize(self, buff):
00061 """
00062 serialize message into buffer
00063 :param buff: buffer, ``StringIO``
00064 """
00065 try:
00066 length = len(self.motor_states)
00067 buff.write(_struct_I.pack(length))
00068 for val1 in self.motor_states:
00069 _x = val1
00070 buff.write(_struct_d5i2diB.pack(_x.timestamp, _x.id, _x.goal, _x.position, _x.error, _x.speed, _x.load, _x.voltage, _x.temperature, _x.moving))
00071 except struct.error as se: self._check_types(se)
00072 except TypeError as te: self._check_types(te)
00073
00074 def deserialize(self, str):
00075 """
00076 unpack serialized message in str into this message instance
00077 :param str: byte array of serialized message, ``str``
00078 """
00079 try:
00080 if self.motor_states is None:
00081 self.motor_states = None
00082 end = 0
00083 start = end
00084 end += 4
00085 (length,) = _struct_I.unpack(str[start:end])
00086 self.motor_states = []
00087 for i in range(0, length):
00088 val1 = dynamixel_msgs.msg.MotorState()
00089 _x = val1
00090 start = end
00091 end += 49
00092 (_x.timestamp, _x.id, _x.goal, _x.position, _x.error, _x.speed, _x.load, _x.voltage, _x.temperature, _x.moving,) = _struct_d5i2diB.unpack(str[start:end])
00093 val1.moving = bool(val1.moving)
00094 self.motor_states.append(val1)
00095 return self
00096 except struct.error as e:
00097 raise genpy.DeserializationError(e)
00098
00099
00100 def serialize_numpy(self, buff, numpy):
00101 """
00102 serialize message with numpy array types into buffer
00103 :param buff: buffer, ``StringIO``
00104 :param numpy: numpy python module
00105 """
00106 try:
00107 length = len(self.motor_states)
00108 buff.write(_struct_I.pack(length))
00109 for val1 in self.motor_states:
00110 _x = val1
00111 buff.write(_struct_d5i2diB.pack(_x.timestamp, _x.id, _x.goal, _x.position, _x.error, _x.speed, _x.load, _x.voltage, _x.temperature, _x.moving))
00112 except struct.error as se: self._check_types(se)
00113 except TypeError as te: self._check_types(te)
00114
00115 def deserialize_numpy(self, str, numpy):
00116 """
00117 unpack serialized message in str into this message instance using numpy for array types
00118 :param str: byte array of serialized message, ``str``
00119 :param numpy: numpy python module
00120 """
00121 try:
00122 if self.motor_states is None:
00123 self.motor_states = None
00124 end = 0
00125 start = end
00126 end += 4
00127 (length,) = _struct_I.unpack(str[start:end])
00128 self.motor_states = []
00129 for i in range(0, length):
00130 val1 = dynamixel_msgs.msg.MotorState()
00131 _x = val1
00132 start = end
00133 end += 49
00134 (_x.timestamp, _x.id, _x.goal, _x.position, _x.error, _x.speed, _x.load, _x.voltage, _x.temperature, _x.moving,) = _struct_d5i2diB.unpack(str[start:end])
00135 val1.moving = bool(val1.moving)
00136 self.motor_states.append(val1)
00137 return self
00138 except struct.error as e:
00139 raise genpy.DeserializationError(e)
00140
00141 _struct_I = genpy.struct_I
00142 _struct_d5i2diB = struct.Struct("<d5i2diB")