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