_man_drv.py
Go to the documentation of this file.
00001 """autogenerated by genpy from rovio_shared/man_drv.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 man_drv(genpy.Message):
00009   _md5sum = "14675853bd9417686a1390c3fb2eaae6"
00010   _type = "rovio_shared/man_drv"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """# Constants for the 'drive' value as defined by the Rovio API
00013 int8 STOP=0
00014 int8 FORWARD=1
00015 int8 BACKWARD=2 
00016 int8 STRAIGHT_LEFT=3
00017 int8 STRAIGHT_RIGHT=4
00018 int8 ROTATE_LEFT=5
00019 int8 ROTATE_RIGHT=6
00020 int8 DIAGONAL_FORWARD_LEFT=7
00021 int8 DIAGONAL_FORWARD_RIGHT=8
00022 int8 DIAGONAL_BACKWARD_LEFT=9
00023 int8 DIAGONAL_BACKWARD_RIGHT=10
00024 int8 HEAD_UP=11
00025 int8 HEAD_DOWN=12
00026 int8 HEAD_MIDDLE=13
00027 # 14, 15, and 16 are reserved values
00028 int8 ROTATE_LEFT_20_DEG=17
00029 int8 ROTATE_RIGHT_20_DEG=18
00030 int8 MIN_DRIVE_VAL=0
00031 int8 MAX_DRIVE_VAL=18
00032 
00033 # Constants useful for the 'speed' value as defined by the Rovio API
00034 int8 FASTEST=1 
00035 int8 SLOWEST=10
00036 int8 MIN_SPEED_VAL=1
00037 int8 MAX_SPEED_VAL=10
00038 
00039 # The manual drive message contains a 'drive' and 'speed' value as defined by the Rovio API
00040 int8 drive
00041 int8 speed
00042 
00043 """
00044   # Pseudo-constants
00045   STOP = 0
00046   FORWARD = 1
00047   BACKWARD = 2
00048   STRAIGHT_LEFT = 3
00049   STRAIGHT_RIGHT = 4
00050   ROTATE_LEFT = 5
00051   ROTATE_RIGHT = 6
00052   DIAGONAL_FORWARD_LEFT = 7
00053   DIAGONAL_FORWARD_RIGHT = 8
00054   DIAGONAL_BACKWARD_LEFT = 9
00055   DIAGONAL_BACKWARD_RIGHT = 10
00056   HEAD_UP = 11
00057   HEAD_DOWN = 12
00058   HEAD_MIDDLE = 13
00059   ROTATE_LEFT_20_DEG = 17
00060   ROTATE_RIGHT_20_DEG = 18
00061   MIN_DRIVE_VAL = 0
00062   MAX_DRIVE_VAL = 18
00063   FASTEST = 1
00064   SLOWEST = 10
00065   MIN_SPEED_VAL = 1
00066   MAX_SPEED_VAL = 10
00067 
00068   __slots__ = ['drive','speed']
00069   _slot_types = ['int8','int8']
00070 
00071   def __init__(self, *args, **kwds):
00072     """
00073     Constructor. Any message fields that are implicitly/explicitly
00074     set to None will be assigned a default value. The recommend
00075     use is keyword arguments as this is more robust to future message
00076     changes.  You cannot mix in-order arguments and keyword arguments.
00077 
00078     The available fields are:
00079        drive,speed
00080 
00081     :param args: complete set of field values, in .msg order
00082     :param kwds: use keyword arguments corresponding to message field names
00083     to set specific fields.
00084     """
00085     if args or kwds:
00086       super(man_drv, self).__init__(*args, **kwds)
00087       #message fields cannot be None, assign default values for those that are
00088       if self.drive is None:
00089         self.drive = 0
00090       if self.speed is None:
00091         self.speed = 0
00092     else:
00093       self.drive = 0
00094       self.speed = 0
00095 
00096   def _get_types(self):
00097     """
00098     internal API method
00099     """
00100     return self._slot_types
00101 
00102   def serialize(self, buff):
00103     """
00104     serialize message into buffer
00105     :param buff: buffer, ``StringIO``
00106     """
00107     try:
00108       _x = self
00109       buff.write(_struct_2b.pack(_x.drive, _x.speed))
00110     except struct.error as se: self._check_types(se)
00111     except TypeError as te: self._check_types(te)
00112 
00113   def deserialize(self, str):
00114     """
00115     unpack serialized message in str into this message instance
00116     :param str: byte array of serialized message, ``str``
00117     """
00118     try:
00119       end = 0
00120       _x = self
00121       start = end
00122       end += 2
00123       (_x.drive, _x.speed,) = _struct_2b.unpack(str[start:end])
00124       return self
00125     except struct.error as e:
00126       raise genpy.DeserializationError(e) #most likely buffer underfill
00127 
00128 
00129   def serialize_numpy(self, buff, numpy):
00130     """
00131     serialize message with numpy array types into buffer
00132     :param buff: buffer, ``StringIO``
00133     :param numpy: numpy python module
00134     """
00135     try:
00136       _x = self
00137       buff.write(_struct_2b.pack(_x.drive, _x.speed))
00138     except struct.error as se: self._check_types(se)
00139     except TypeError as te: self._check_types(te)
00140 
00141   def deserialize_numpy(self, str, numpy):
00142     """
00143     unpack serialized message in str into this message instance using numpy for array types
00144     :param str: byte array of serialized message, ``str``
00145     :param numpy: numpy python module
00146     """
00147     try:
00148       end = 0
00149       _x = self
00150       start = end
00151       end += 2
00152       (_x.drive, _x.speed,) = _struct_2b.unpack(str[start:end])
00153       return self
00154     except struct.error as e:
00155       raise genpy.DeserializationError(e) #most likely buffer underfill
00156 
00157 _struct_I = genpy.struct_I
00158 _struct_2b = struct.Struct("<2b")


rovio_shared
Author(s): Russell Toris
autogenerated on Sat Dec 28 2013 17:38:45