_Gear.py
Go to the documentation of this file.
00001 """autogenerated by genpy from art_msgs/Gear.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 Gear(genpy.Message):
00009   _md5sum = "29fb8bb2d87a1850e27a57ff47d6dd35"
00010   _type = "art_msgs/Gear"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """# ART vehicle transmission gear numbers
00013 #
00014 # Used by several different messages.
00015 
00016 # $Id: Gear.msg 1539 2011-05-09 04:09:20Z jack.oquin $
00017 
00018 # Gear numbers. 
00019 #
00020 # Naught means: reset all Shifter relays; no change of CarDrive gear.
00021 uint8 Naught = 0
00022 uint8 Park = 1
00023 uint8 Reverse = 2
00024 uint8 Neutral = 3
00025 uint8 Drive = 4
00026 uint8 N_gears = 5
00027 
00028 uint8 value             # requested or reported gear number
00029 
00030 """
00031   # Pseudo-constants
00032   Naught = 0
00033   Park = 1
00034   Reverse = 2
00035   Neutral = 3
00036   Drive = 4
00037   N_gears = 5
00038 
00039   __slots__ = ['value']
00040   _slot_types = ['uint8']
00041 
00042   def __init__(self, *args, **kwds):
00043     """
00044     Constructor. Any message fields that are implicitly/explicitly
00045     set to None will be assigned a default value. The recommend
00046     use is keyword arguments as this is more robust to future message
00047     changes.  You cannot mix in-order arguments and keyword arguments.
00048 
00049     The available fields are:
00050        value
00051 
00052     :param args: complete set of field values, in .msg order
00053     :param kwds: use keyword arguments corresponding to message field names
00054     to set specific fields.
00055     """
00056     if args or kwds:
00057       super(Gear, self).__init__(*args, **kwds)
00058       #message fields cannot be None, assign default values for those that are
00059       if self.value is None:
00060         self.value = 0
00061     else:
00062       self.value = 0
00063 
00064   def _get_types(self):
00065     """
00066     internal API method
00067     """
00068     return self._slot_types
00069 
00070   def serialize(self, buff):
00071     """
00072     serialize message into buffer
00073     :param buff: buffer, ``StringIO``
00074     """
00075     try:
00076       buff.write(_struct_B.pack(self.value))
00077     except struct.error as se: self._check_types(se)
00078     except TypeError as te: self._check_types(te)
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       end = 0
00087       start = end
00088       end += 1
00089       (self.value,) = _struct_B.unpack(str[start:end])
00090       return self
00091     except struct.error as e:
00092       raise genpy.DeserializationError(e) #most likely buffer underfill
00093 
00094 
00095   def serialize_numpy(self, buff, numpy):
00096     """
00097     serialize message with numpy array types into buffer
00098     :param buff: buffer, ``StringIO``
00099     :param numpy: numpy python module
00100     """
00101     try:
00102       buff.write(_struct_B.pack(self.value))
00103     except struct.error as se: self._check_types(se)
00104     except TypeError as te: self._check_types(te)
00105 
00106   def deserialize_numpy(self, str, numpy):
00107     """
00108     unpack serialized message in str into this message instance using numpy for array types
00109     :param str: byte array of serialized message, ``str``
00110     :param numpy: numpy python module
00111     """
00112     try:
00113       end = 0
00114       start = end
00115       end += 1
00116       (self.value,) = _struct_B.unpack(str[start:end])
00117       return self
00118     except struct.error as e:
00119       raise genpy.DeserializationError(e) #most likely buffer underfill
00120 
00121 _struct_I = genpy.struct_I
00122 _struct_B = struct.Struct("<B")


art_msgs
Author(s): Jack O'Quin
autogenerated on Fri Jan 3 2014 11:08:05