$search
00001 """autogenerated by genmsg_py from RC.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 import std_msgs.msg 00006 00007 class RC(roslib.message.Message): 00008 _md5sum = "2691c2fe8c5ab2323146bdd8dd2e449e" 00009 _type = "hector_uav_msgs/RC" 00010 _has_header = True #flag to mark the presence of a Header object 00011 _full_text = """Header header 00012 00013 uint8 ROLL = 1 00014 uint8 PITCH = 2 00015 uint8 YAW = 3 00016 uint8 STEER = 4 00017 uint8 HEIGHT = 5 00018 uint8 THRUST = 6 00019 uint8 BRAKE = 7 00020 00021 uint8 status 00022 bool valid 00023 00024 float32[] axis 00025 uint8[] axis_function 00026 00027 int8[] swit 00028 uint8[] swit_function 00029 00030 ================================================================================ 00031 MSG: std_msgs/Header 00032 # Standard metadata for higher-level stamped data types. 00033 # This is generally used to communicate timestamped data 00034 # in a particular coordinate frame. 00035 # 00036 # sequence ID: consecutively increasing ID 00037 uint32 seq 00038 #Two-integer timestamp that is expressed as: 00039 # * stamp.secs: seconds (stamp_secs) since epoch 00040 # * stamp.nsecs: nanoseconds since stamp_secs 00041 # time-handling sugar is provided by the client library 00042 time stamp 00043 #Frame this data is associated with 00044 # 0: no frame 00045 # 1: global frame 00046 string frame_id 00047 00048 """ 00049 # Pseudo-constants 00050 ROLL = 1 00051 PITCH = 2 00052 YAW = 3 00053 STEER = 4 00054 HEIGHT = 5 00055 THRUST = 6 00056 BRAKE = 7 00057 00058 __slots__ = ['header','status','valid','axis','axis_function','swit','swit_function'] 00059 _slot_types = ['Header','uint8','bool','float32[]','uint8[]','int8[]','uint8[]'] 00060 00061 def __init__(self, *args, **kwds): 00062 """ 00063 Constructor. Any message fields that are implicitly/explicitly 00064 set to None will be assigned a default value. The recommend 00065 use is keyword arguments as this is more robust to future message 00066 changes. You cannot mix in-order arguments and keyword arguments. 00067 00068 The available fields are: 00069 header,status,valid,axis,axis_function,swit,swit_function 00070 00071 @param args: complete set of field values, in .msg order 00072 @param kwds: use keyword arguments corresponding to message field names 00073 to set specific fields. 00074 """ 00075 if args or kwds: 00076 super(RC, self).__init__(*args, **kwds) 00077 #message fields cannot be None, assign default values for those that are 00078 if self.header is None: 00079 self.header = std_msgs.msg._Header.Header() 00080 if self.status is None: 00081 self.status = 0 00082 if self.valid is None: 00083 self.valid = False 00084 if self.axis is None: 00085 self.axis = [] 00086 if self.axis_function is None: 00087 self.axis_function = '' 00088 if self.swit is None: 00089 self.swit = [] 00090 if self.swit_function is None: 00091 self.swit_function = '' 00092 else: 00093 self.header = std_msgs.msg._Header.Header() 00094 self.status = 0 00095 self.valid = False 00096 self.axis = [] 00097 self.axis_function = '' 00098 self.swit = [] 00099 self.swit_function = '' 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 00111 @type buff: StringIO 00112 """ 00113 try: 00114 _x = self 00115 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00116 _x = self.header.frame_id 00117 length = len(_x) 00118 buff.write(struct.pack('<I%ss'%length, length, _x)) 00119 _x = self 00120 buff.write(_struct_2B.pack(_x.status, _x.valid)) 00121 length = len(self.axis) 00122 buff.write(_struct_I.pack(length)) 00123 pattern = '<%sf'%length 00124 buff.write(struct.pack(pattern, *self.axis)) 00125 _x = self.axis_function 00126 length = len(_x) 00127 # - if encoded as a list instead, serialize as bytes instead of string 00128 if type(_x) in [list, tuple]: 00129 buff.write(struct.pack('<I%sB'%length, length, *_x)) 00130 else: 00131 buff.write(struct.pack('<I%ss'%length, length, _x)) 00132 length = len(self.swit) 00133 buff.write(_struct_I.pack(length)) 00134 pattern = '<%sb'%length 00135 buff.write(struct.pack(pattern, *self.swit)) 00136 _x = self.swit_function 00137 length = len(_x) 00138 # - if encoded as a list instead, serialize as bytes instead of string 00139 if type(_x) in [list, tuple]: 00140 buff.write(struct.pack('<I%sB'%length, length, *_x)) 00141 else: 00142 buff.write(struct.pack('<I%ss'%length, length, _x)) 00143 except struct.error as se: self._check_types(se) 00144 except TypeError as te: self._check_types(te) 00145 00146 def deserialize(self, str): 00147 """ 00148 unpack serialized message in str into this message instance 00149 @param str: byte array of serialized message 00150 @type str: str 00151 """ 00152 try: 00153 if self.header is None: 00154 self.header = std_msgs.msg._Header.Header() 00155 end = 0 00156 _x = self 00157 start = end 00158 end += 12 00159 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00160 start = end 00161 end += 4 00162 (length,) = _struct_I.unpack(str[start:end]) 00163 start = end 00164 end += length 00165 self.header.frame_id = str[start:end] 00166 _x = self 00167 start = end 00168 end += 2 00169 (_x.status, _x.valid,) = _struct_2B.unpack(str[start:end]) 00170 self.valid = bool(self.valid) 00171 start = end 00172 end += 4 00173 (length,) = _struct_I.unpack(str[start:end]) 00174 pattern = '<%sf'%length 00175 start = end 00176 end += struct.calcsize(pattern) 00177 self.axis = struct.unpack(pattern, str[start:end]) 00178 start = end 00179 end += 4 00180 (length,) = _struct_I.unpack(str[start:end]) 00181 start = end 00182 end += length 00183 self.axis_function = str[start:end] 00184 start = end 00185 end += 4 00186 (length,) = _struct_I.unpack(str[start:end]) 00187 pattern = '<%sb'%length 00188 start = end 00189 end += struct.calcsize(pattern) 00190 self.swit = struct.unpack(pattern, 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.swit_function = str[start:end] 00197 return self 00198 except struct.error as e: 00199 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00200 00201 00202 def serialize_numpy(self, buff, numpy): 00203 """ 00204 serialize message with numpy array types into buffer 00205 @param buff: buffer 00206 @type buff: StringIO 00207 @param numpy: numpy python module 00208 @type numpy module 00209 """ 00210 try: 00211 _x = self 00212 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) 00213 _x = self.header.frame_id 00214 length = len(_x) 00215 buff.write(struct.pack('<I%ss'%length, length, _x)) 00216 _x = self 00217 buff.write(_struct_2B.pack(_x.status, _x.valid)) 00218 length = len(self.axis) 00219 buff.write(_struct_I.pack(length)) 00220 pattern = '<%sf'%length 00221 buff.write(self.axis.tostring()) 00222 _x = self.axis_function 00223 length = len(_x) 00224 # - if encoded as a list instead, serialize as bytes instead of string 00225 if type(_x) in [list, tuple]: 00226 buff.write(struct.pack('<I%sB'%length, length, *_x)) 00227 else: 00228 buff.write(struct.pack('<I%ss'%length, length, _x)) 00229 length = len(self.swit) 00230 buff.write(_struct_I.pack(length)) 00231 pattern = '<%sb'%length 00232 buff.write(self.swit.tostring()) 00233 _x = self.swit_function 00234 length = len(_x) 00235 # - if encoded as a list instead, serialize as bytes instead of string 00236 if type(_x) in [list, tuple]: 00237 buff.write(struct.pack('<I%sB'%length, length, *_x)) 00238 else: 00239 buff.write(struct.pack('<I%ss'%length, length, _x)) 00240 except struct.error as se: self._check_types(se) 00241 except TypeError as te: self._check_types(te) 00242 00243 def deserialize_numpy(self, str, numpy): 00244 """ 00245 unpack serialized message in str into this message instance using numpy for array types 00246 @param str: byte array of serialized message 00247 @type str: str 00248 @param numpy: numpy python module 00249 @type numpy: module 00250 """ 00251 try: 00252 if self.header is None: 00253 self.header = std_msgs.msg._Header.Header() 00254 end = 0 00255 _x = self 00256 start = end 00257 end += 12 00258 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end]) 00259 start = end 00260 end += 4 00261 (length,) = _struct_I.unpack(str[start:end]) 00262 start = end 00263 end += length 00264 self.header.frame_id = str[start:end] 00265 _x = self 00266 start = end 00267 end += 2 00268 (_x.status, _x.valid,) = _struct_2B.unpack(str[start:end]) 00269 self.valid = bool(self.valid) 00270 start = end 00271 end += 4 00272 (length,) = _struct_I.unpack(str[start:end]) 00273 pattern = '<%sf'%length 00274 start = end 00275 end += struct.calcsize(pattern) 00276 self.axis = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length) 00277 start = end 00278 end += 4 00279 (length,) = _struct_I.unpack(str[start:end]) 00280 start = end 00281 end += length 00282 self.axis_function = str[start:end] 00283 start = end 00284 end += 4 00285 (length,) = _struct_I.unpack(str[start:end]) 00286 pattern = '<%sb'%length 00287 start = end 00288 end += struct.calcsize(pattern) 00289 self.swit = numpy.frombuffer(str[start:end], dtype=numpy.int8, count=length) 00290 start = end 00291 end += 4 00292 (length,) = _struct_I.unpack(str[start:end]) 00293 start = end 00294 end += length 00295 self.swit_function = str[start:end] 00296 return self 00297 except struct.error as e: 00298 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00299 00300 _struct_I = roslib.message.struct_I 00301 _struct_3I = struct.Struct("<3I") 00302 _struct_2B = struct.Struct("<2B")