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


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