_MotorCommand.py
Go to the documentation of this file.
00001 """autogenerated by genpy from corobot_msgs/MotorCommand.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 MotorCommand(genpy.Message):
00009   _md5sum = "451c087bf7cd0b5ee063409877e152e9"
00010   _type = "corobot_msgs/MotorCommand"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """# Bill Mania <bmania@coroware.com>
00013 #
00014 # Service used with the CoroWare CoroBot to move the robot
00015 # base. Originally developed for the Phidget HC Motor Controller
00016 #
00017 # leftSpeed and rightSpeed are signed integers which specify the
00018 # combined speed and direction to rotate the wheels on each side
00019 # of the robot. 0 indicates full stop. positive integers indicate
00020 # a forward rotation and larger integers indicate a higher
00021 # rotational speed.
00022 #
00023 int16 leftSpeed
00024 int16 rightSpeed
00025 #
00026 # when at least one of leftSpeed or rightSpeed is non-zero,
00027 # secondsDuration indicates for how many seconds to rotate those
00028 # wheels at the requested speed. when secondsDuration is zero,
00029 # the wheels will be rotated at the requested speed, in the
00030 # requested direction until another request is received.
00031 #
00032 uint16 secondsDuration
00033 #
00034 # the number of seconds over which to effect the change in
00035 # rotational speed from the current speed to the speed requested.
00036 # a value of zero indicates "as fast as possible". the greater
00037 # this value, the greater amount of time taken to change the
00038 # speed.
00039 uint16 acceleration
00040 
00041 """
00042   __slots__ = ['leftSpeed','rightSpeed','secondsDuration','acceleration']
00043   _slot_types = ['int16','int16','uint16','uint16']
00044 
00045   def __init__(self, *args, **kwds):
00046     """
00047     Constructor. Any message fields that are implicitly/explicitly
00048     set to None will be assigned a default value. The recommend
00049     use is keyword arguments as this is more robust to future message
00050     changes.  You cannot mix in-order arguments and keyword arguments.
00051 
00052     The available fields are:
00053        leftSpeed,rightSpeed,secondsDuration,acceleration
00054 
00055     :param args: complete set of field values, in .msg order
00056     :param kwds: use keyword arguments corresponding to message field names
00057     to set specific fields.
00058     """
00059     if args or kwds:
00060       super(MotorCommand, self).__init__(*args, **kwds)
00061       #message fields cannot be None, assign default values for those that are
00062       if self.leftSpeed is None:
00063         self.leftSpeed = 0
00064       if self.rightSpeed is None:
00065         self.rightSpeed = 0
00066       if self.secondsDuration is None:
00067         self.secondsDuration = 0
00068       if self.acceleration is None:
00069         self.acceleration = 0
00070     else:
00071       self.leftSpeed = 0
00072       self.rightSpeed = 0
00073       self.secondsDuration = 0
00074       self.acceleration = 0
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_2h2H.pack(_x.leftSpeed, _x.rightSpeed, _x.secondsDuration, _x.acceleration))
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 += 8
00103       (_x.leftSpeed, _x.rightSpeed, _x.secondsDuration, _x.acceleration,) = _struct_2h2H.unpack(str[start:end])
00104       return self
00105     except struct.error as e:
00106       raise genpy.DeserializationError(e) #most likely buffer underfill
00107 
00108 
00109   def serialize_numpy(self, buff, numpy):
00110     """
00111     serialize message with numpy array types into buffer
00112     :param buff: buffer, ``StringIO``
00113     :param numpy: numpy python module
00114     """
00115     try:
00116       _x = self
00117       buff.write(_struct_2h2H.pack(_x.leftSpeed, _x.rightSpeed, _x.secondsDuration, _x.acceleration))
00118     except struct.error as se: self._check_types(se)
00119     except TypeError as te: self._check_types(te)
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       end = 0
00129       _x = self
00130       start = end
00131       end += 8
00132       (_x.leftSpeed, _x.rightSpeed, _x.secondsDuration, _x.acceleration,) = _struct_2h2H.unpack(str[start:end])
00133       return self
00134     except struct.error as e:
00135       raise genpy.DeserializationError(e) #most likely buffer underfill
00136 
00137 _struct_I = genpy.struct_I
00138 _struct_2h2H = struct.Struct("<2h2H")


corobot_msgs
Author(s):
autogenerated on Sun Oct 5 2014 23:17:46