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