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