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