00001 """autogenerated by genpy from art_msgs/IOadrState.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 IOadrState(genpy.Message):
00010 _md5sum = "990cf1675736cc78e57b4a0463dd540e"
00011 _type = "art_msgs/IOadrState"
00012 _has_header = True
00013 _full_text = """# NCD IOADR8x controller state message for ART vehicle
00014
00015 # $Id: IOadrState.msg 644 2010-09-28 03:19:07Z jack.oquin $
00016
00017 Header header
00018
00019 # constant bit values for relays and digitalB inputs
00020 uint8 ENABLED = 1
00021 uint8 RUN = 2
00022 uint8 FLASHER = 4
00023 uint8 ALARM = 8
00024 uint8 LASER_FRONT = 16
00025 uint8 LASER_TOP = 32
00026 uint8 TURN_LEFT = 64
00027 uint8 TURN_RIGHT = 128
00028
00029 uint8 relays # current relays settings
00030
00031 uint8 digitalB # digital input B
00032
00033 # generally, voltages[0] is the steering position sensor
00034 int32 N_VOLTAGES = 3 # number of analog voltages
00035 float32[3] voltages # analog voltages [A, B, C]
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 ENABLED = 1
00058 RUN = 2
00059 FLASHER = 4
00060 ALARM = 8
00061 LASER_FRONT = 16
00062 LASER_TOP = 32
00063 TURN_LEFT = 64
00064 TURN_RIGHT = 128
00065 N_VOLTAGES = 3
00066
00067 __slots__ = ['header','relays','digitalB','voltages']
00068 _slot_types = ['std_msgs/Header','uint8','uint8','float32[3]']
00069
00070 def __init__(self, *args, **kwds):
00071 """
00072 Constructor. Any message fields that are implicitly/explicitly
00073 set to None will be assigned a default value. The recommend
00074 use is keyword arguments as this is more robust to future message
00075 changes. You cannot mix in-order arguments and keyword arguments.
00076
00077 The available fields are:
00078 header,relays,digitalB,voltages
00079
00080 :param args: complete set of field values, in .msg order
00081 :param kwds: use keyword arguments corresponding to message field names
00082 to set specific fields.
00083 """
00084 if args or kwds:
00085 super(IOadrState, self).__init__(*args, **kwds)
00086
00087 if self.header is None:
00088 self.header = std_msgs.msg.Header()
00089 if self.relays is None:
00090 self.relays = 0
00091 if self.digitalB is None:
00092 self.digitalB = 0
00093 if self.voltages is None:
00094 self.voltages = [0.,0.,0.]
00095 else:
00096 self.header = std_msgs.msg.Header()
00097 self.relays = 0
00098 self.digitalB = 0
00099 self.voltages = [0.,0.,0.]
00100
00101 def _get_types(self):
00102 """
00103 internal API method
00104 """
00105 return self._slot_types
00106
00107 def serialize(self, buff):
00108 """
00109 serialize message into buffer
00110 :param buff: buffer, ``StringIO``
00111 """
00112 try:
00113 _x = self
00114 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00115 _x = self.header.frame_id
00116 length = len(_x)
00117 if python3 or type(_x) == unicode:
00118 _x = _x.encode('utf-8')
00119 length = len(_x)
00120 buff.write(struct.pack('<I%ss'%length, length, _x))
00121 _x = self
00122 buff.write(_struct_2B.pack(_x.relays, _x.digitalB))
00123 buff.write(_struct_3f.pack(*self.voltages))
00124 except struct.error as se: self._check_types(se)
00125 except TypeError as te: self._check_types(te)
00126
00127 def deserialize(self, str):
00128 """
00129 unpack serialized message in str into this message instance
00130 :param str: byte array of serialized message, ``str``
00131 """
00132 try:
00133 if self.header is None:
00134 self.header = std_msgs.msg.Header()
00135 end = 0
00136 _x = self
00137 start = end
00138 end += 12
00139 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00140 start = end
00141 end += 4
00142 (length,) = _struct_I.unpack(str[start:end])
00143 start = end
00144 end += length
00145 if python3:
00146 self.header.frame_id = str[start:end].decode('utf-8')
00147 else:
00148 self.header.frame_id = str[start:end]
00149 _x = self
00150 start = end
00151 end += 2
00152 (_x.relays, _x.digitalB,) = _struct_2B.unpack(str[start:end])
00153 start = end
00154 end += 12
00155 self.voltages = _struct_3f.unpack(str[start:end])
00156 return self
00157 except struct.error as e:
00158 raise genpy.DeserializationError(e)
00159
00160
00161 def serialize_numpy(self, buff, numpy):
00162 """
00163 serialize message with numpy array types into buffer
00164 :param buff: buffer, ``StringIO``
00165 :param numpy: numpy python module
00166 """
00167 try:
00168 _x = self
00169 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00170 _x = self.header.frame_id
00171 length = len(_x)
00172 if python3 or type(_x) == unicode:
00173 _x = _x.encode('utf-8')
00174 length = len(_x)
00175 buff.write(struct.pack('<I%ss'%length, length, _x))
00176 _x = self
00177 buff.write(_struct_2B.pack(_x.relays, _x.digitalB))
00178 buff.write(self.voltages.tostring())
00179 except struct.error as se: self._check_types(se)
00180 except TypeError as te: self._check_types(te)
00181
00182 def deserialize_numpy(self, str, numpy):
00183 """
00184 unpack serialized message in str into this message instance using numpy for array types
00185 :param str: byte array of serialized message, ``str``
00186 :param numpy: numpy python module
00187 """
00188 try:
00189 if self.header is None:
00190 self.header = std_msgs.msg.Header()
00191 end = 0
00192 _x = self
00193 start = end
00194 end += 12
00195 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00196 start = end
00197 end += 4
00198 (length,) = _struct_I.unpack(str[start:end])
00199 start = end
00200 end += length
00201 if python3:
00202 self.header.frame_id = str[start:end].decode('utf-8')
00203 else:
00204 self.header.frame_id = str[start:end]
00205 _x = self
00206 start = end
00207 end += 2
00208 (_x.relays, _x.digitalB,) = _struct_2B.unpack(str[start:end])
00209 start = end
00210 end += 12
00211 self.voltages = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=3)
00212 return self
00213 except struct.error as e:
00214 raise genpy.DeserializationError(e)
00215
00216 _struct_I = genpy.struct_I
00217 _struct_3I = struct.Struct("<3I")
00218 _struct_3f = struct.Struct("<3f")
00219 _struct_2B = struct.Struct("<2B")