00001 """autogenerated by genmsg_py from MotorStateList.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005 import dynamixel_msgs.msg
00006
00007 class MotorStateList(roslib.message.Message):
00008 _md5sum = "9e94ccf6563ca78afce19eb097f9343c"
00009 _type = "dynamixel_msgs/MotorStateList"
00010 _has_header = False
00011 _full_text = """MotorState[] motor_states
00012
00013 ================================================================================
00014 MSG: dynamixel_msgs/MotorState
00015 float64 timestamp # motor state is at this time
00016 int32 id # motor id
00017 int32 goal # commanded position (in encoder units)
00018 int32 position # current position (in encoder units)
00019 int32 error # difference between current and goal positions
00020 int32 speed # current speed (0.111 rpm per unit)
00021 float64 load # current load - ratio of applied torque over maximum torque
00022 float64 voltage # current voltage (V)
00023 int32 temperature # current temperature (degrees Celsius)
00024 bool moving # whether the motor is currently in motion
00025
00026 """
00027 __slots__ = ['motor_states']
00028 _slot_types = ['dynamixel_msgs/MotorState[]']
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 motor_states
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(MotorStateList, self).__init__(*args, **kwds)
00046
00047 if self.motor_states is None:
00048 self.motor_states = []
00049 else:
00050 self.motor_states = []
00051
00052 def _get_types(self):
00053 """
00054 internal API method
00055 """
00056 return self._slot_types
00057
00058 def serialize(self, buff):
00059 """
00060 serialize message into buffer
00061 @param buff: buffer
00062 @type buff: StringIO
00063 """
00064 try:
00065 length = len(self.motor_states)
00066 buff.write(_struct_I.pack(length))
00067 for val1 in self.motor_states:
00068 _x = val1
00069 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))
00070 except struct.error, se: self._check_types(se)
00071 except TypeError, te: self._check_types(te)
00072
00073 def deserialize(self, str):
00074 """
00075 unpack serialized message in str into this message instance
00076 @param str: byte array of serialized message
00077 @type str: str
00078 """
00079 try:
00080 end = 0
00081 start = end
00082 end += 4
00083 (length,) = _struct_I.unpack(str[start:end])
00084 self.motor_states = []
00085 for i in xrange(0, length):
00086 val1 = dynamixel_msgs.msg.MotorState()
00087 _x = val1
00088 start = end
00089 end += 49
00090 (_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])
00091 val1.moving = bool(val1.moving)
00092 self.motor_states.append(val1)
00093 return self
00094 except struct.error, e:
00095 raise roslib.message.DeserializationError(e)
00096
00097
00098 def serialize_numpy(self, buff, numpy):
00099 """
00100 serialize message with numpy array types into buffer
00101 @param buff: buffer
00102 @type buff: StringIO
00103 @param numpy: numpy python module
00104 @type numpy 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, se: self._check_types(se)
00113 except TypeError, 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
00119 @type str: str
00120 @param numpy: numpy python module
00121 @type numpy: module
00122 """
00123 try:
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 xrange(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, e:
00139 raise roslib.message.DeserializationError(e)
00140
00141 _struct_I = roslib.message.struct_I
00142 _struct_d5i2diB = struct.Struct("<d5i2diB")