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


dynamixel_hardware_interface
Author(s): Antons Rebguns
autogenerated on Sun Oct 5 2014 23:33:10