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