00001 """autogenerated by genpy from art_msgs/Shifter.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006
00007 import std_msgs.msg
00008
00009 class Shifter(genpy.Message):
00010 _md5sum = "dddb61d8575e01ea7857ef1b3a7b941c"
00011 _type = "art_msgs/Shifter"
00012 _has_header = True
00013 _full_text = """# ART shifter message
00014 #
00015 # Used to both request and report gear shifts.
00016
00017 # $Id: Shifter.msg 644 2010-09-28 03:19:07Z jack.oquin $
00018
00019 # Our Arens Controls hardware mechanism requires holding the shift
00020 # relay on for one second before resetting it. A command node must
00021 # request the desired gear, then wait a second before sending the
00022 # Reset command. To be safe, it should check that the shift actually
00023 # occurred before continuing.
00024
00025 Header header # standard ROS message header
00026
00027 # gear numbers
00028 uint8 Reset = 0 # request reset of shifter relays
00029 uint8 Park = 1
00030 uint8 Reverse = 2
00031 uint8 Neutral = 3
00032 uint8 Drive = 4
00033
00034 uint8 gear # requested or reported gear number
00035 uint8 relays # current relay values
00036
00037 ================================================================================
00038 MSG: std_msgs/Header
00039 # Standard metadata for higher-level stamped data types.
00040 # This is generally used to communicate timestamped data
00041 # in a particular coordinate frame.
00042 #
00043 # sequence ID: consecutively increasing ID
00044 uint32 seq
00045 #Two-integer timestamp that is expressed as:
00046 # * stamp.secs: seconds (stamp_secs) since epoch
00047 # * stamp.nsecs: nanoseconds since stamp_secs
00048 # time-handling sugar is provided by the client library
00049 time stamp
00050 #Frame this data is associated with
00051 # 0: no frame
00052 # 1: global frame
00053 string frame_id
00054
00055 """
00056
00057 Reset = 0
00058 Park = 1
00059 Reverse = 2
00060 Neutral = 3
00061 Drive = 4
00062
00063 __slots__ = ['header','gear','relays']
00064 _slot_types = ['std_msgs/Header','uint8','uint8']
00065
00066 def __init__(self, *args, **kwds):
00067 """
00068 Constructor. Any message fields that are implicitly/explicitly
00069 set to None will be assigned a default value. The recommend
00070 use is keyword arguments as this is more robust to future message
00071 changes. You cannot mix in-order arguments and keyword arguments.
00072
00073 The available fields are:
00074 header,gear,relays
00075
00076 :param args: complete set of field values, in .msg order
00077 :param kwds: use keyword arguments corresponding to message field names
00078 to set specific fields.
00079 """
00080 if args or kwds:
00081 super(Shifter, self).__init__(*args, **kwds)
00082
00083 if self.header is None:
00084 self.header = std_msgs.msg.Header()
00085 if self.gear is None:
00086 self.gear = 0
00087 if self.relays is None:
00088 self.relays = 0
00089 else:
00090 self.header = std_msgs.msg.Header()
00091 self.gear = 0
00092 self.relays = 0
00093
00094 def _get_types(self):
00095 """
00096 internal API method
00097 """
00098 return self._slot_types
00099
00100 def serialize(self, buff):
00101 """
00102 serialize message into buffer
00103 :param buff: buffer, ``StringIO``
00104 """
00105 try:
00106 _x = self
00107 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00108 _x = self.header.frame_id
00109 length = len(_x)
00110 if python3 or type(_x) == unicode:
00111 _x = _x.encode('utf-8')
00112 length = len(_x)
00113 buff.write(struct.pack('<I%ss'%length, length, _x))
00114 _x = self
00115 buff.write(_struct_2B.pack(_x.gear, _x.relays))
00116 except struct.error as se: self._check_types(se)
00117 except TypeError as te: self._check_types(te)
00118
00119 def deserialize(self, str):
00120 """
00121 unpack serialized message in str into this message instance
00122 :param str: byte array of serialized message, ``str``
00123 """
00124 try:
00125 if self.header is None:
00126 self.header = std_msgs.msg.Header()
00127 end = 0
00128 _x = self
00129 start = end
00130 end += 12
00131 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00132 start = end
00133 end += 4
00134 (length,) = _struct_I.unpack(str[start:end])
00135 start = end
00136 end += length
00137 if python3:
00138 self.header.frame_id = str[start:end].decode('utf-8')
00139 else:
00140 self.header.frame_id = str[start:end]
00141 _x = self
00142 start = end
00143 end += 2
00144 (_x.gear, _x.relays,) = _struct_2B.unpack(str[start:end])
00145 return self
00146 except struct.error as e:
00147 raise genpy.DeserializationError(e)
00148
00149
00150 def serialize_numpy(self, buff, numpy):
00151 """
00152 serialize message with numpy array types into buffer
00153 :param buff: buffer, ``StringIO``
00154 :param numpy: numpy python module
00155 """
00156 try:
00157 _x = self
00158 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00159 _x = self.header.frame_id
00160 length = len(_x)
00161 if python3 or type(_x) == unicode:
00162 _x = _x.encode('utf-8')
00163 length = len(_x)
00164 buff.write(struct.pack('<I%ss'%length, length, _x))
00165 _x = self
00166 buff.write(_struct_2B.pack(_x.gear, _x.relays))
00167 except struct.error as se: self._check_types(se)
00168 except TypeError as te: self._check_types(te)
00169
00170 def deserialize_numpy(self, str, numpy):
00171 """
00172 unpack serialized message in str into this message instance using numpy for array types
00173 :param str: byte array of serialized message, ``str``
00174 :param numpy: numpy python module
00175 """
00176 try:
00177 if self.header is None:
00178 self.header = std_msgs.msg.Header()
00179 end = 0
00180 _x = self
00181 start = end
00182 end += 12
00183 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00184 start = end
00185 end += 4
00186 (length,) = _struct_I.unpack(str[start:end])
00187 start = end
00188 end += length
00189 if python3:
00190 self.header.frame_id = str[start:end].decode('utf-8')
00191 else:
00192 self.header.frame_id = str[start:end]
00193 _x = self
00194 start = end
00195 end += 2
00196 (_x.gear, _x.relays,) = _struct_2B.unpack(str[start:end])
00197 return self
00198 except struct.error as e:
00199 raise genpy.DeserializationError(e)
00200
00201 _struct_I = genpy.struct_I
00202 _struct_3I = struct.Struct("<3I")
00203 _struct_2B = struct.Struct("<2B")