"%.2f,%.2f,%.2f," + "%.3f,%.3f,%.3f," + "%.3f,%.3f,%.3f," + "%.1f,%d,%d,%d," + "%d,%d,%d,%d,%d,%d\n" ) #return format % data return dump % data if __name__ == "__main__": fcs.init(sys.argv[1]) infile = open(sys.argv[2], 'rb') if len(sys.argv) > 2 else sys.stdin outfile = open(sys.argv[3], 'wb') if len(sys.argv) > 3 else sys.stdout print "t,alt,alt_ref,n,e,d,xte,ate,tas,tas_ref,gs,heading,heading_ref,yaw,yaw_ref,pitch,pitch_ref,roll,roll_ref,vyaw,vpitch,vroll,wind,wind_n,wind_e,t,l,r,tp,lp,rp,objval,cycles,errors,resets,path,last_gps,mode1,flags,err,release" i = 0 for logf in plog.iterlogs(infile): try: outfile.write(tick(i, logf)) outfile.flush() except Exception: raise i += 1 infile.close() outfile.close()
dump = ("%d," + "%.3f,%.3f," + "%.2f,%.2f,%.2f,%.2f,%.2f," + "%.2f,%.2f,%.2f," + "%.1f,%.1f," + "%.1f,%.1f," + "%.1f,%.1f," + "%.1f,%.1f," + "%.1f,%.1f,%.1f," + "%.2f,%.2f,%.2f," + "%.3f,%.3f,%.3f," + "%.3f,%.3f,%.3f," + "%.1f,%d,%d,%d," + "%d,%d,%d,%d,%d,%d\n") #return format % data return dump % data if __name__ == "__main__": fcs.init(sys.argv[1]) infile = open(sys.argv[2], 'rb') if len(sys.argv) > 2 else sys.stdin outfile = open(sys.argv[3], 'wb') if len(sys.argv) > 3 else sys.stdout print "t,alt,alt_ref,n,e,d,xte,ate,tas,tas_ref,gs,heading,heading_ref,yaw,yaw_ref,pitch,pitch_ref,roll,roll_ref,vyaw,vpitch,vroll,wind,wind_n,wind_e,t,l,r,tp,lp,rp,objval,cycles,errors,resets,path,last_gps,mode1,flags,err,release" i = 0 for logf in plog.iterlogs(infile): try: outfile.write(tick(i, logf)) outfile.flush() except Exception: raise i += 1 infile.close() outfile.close()
args = parser.parse_args() path_id = [] path_data = [] path_airspeed = [] path_throttle = [] path_left_elevon = [] path_right_elevon = [] path_obj_val = [] ref_path = [] ref_path_airspeed = [] last_ref_point = None last_path = 0 last_auto = 0 with open(args.infile, 'r') as infile: for t, rec in enumerate(plog.iterlogs(infile)): if t % 50: #t % 1000: continue path = None point = None attitude = None airspeed = None ref_point = None ref_attitude = None ref_airspeed = None velocity = None wind = None control_pos = None auto = None control_cycles = None
(state_attitude[1], math.degrees(control_refp.get("pitch", 0))) + (state_attitude[2], math.degrees(control_refp.get("roll", 0))) + (control_values[0], control_values[1], control_values[2]) + (control_obj_val, control_cycles, control_errors, control_resets) + (control_path, last_gps, control_mode[1], control_nav_version)) if __name__ == "__main__": if not sys.argv or len(sys.argv) < 2: print "Usage: serialdump /PATH/TO/DEVICE" sys.exit(1) start_t = time.time() conn = serial.Serial(sys.argv[1], 57600, timeout=None) for logl in plog.iterlogs(conn): try: result = tick(time.time() - start_t, logl) if result: print result except Exception: raise control_config = ConfigParser.RawConfigParser() control_config.read('dynamics.conf') control_params = [ control_config.getint('default', 'roll_due_to_control'), control_config.getint('default', 'roll_due_to_beta'), control_config.getint('default', 'roll_due_to_roll_rate'), control_config.getint('default', 'pitch_due_to_control'), control_config.getint('default', 'yaw_due_to_control'),
(state_attitude[2], math.degrees(control_refp.get("roll", 0))) + (control_values[0], control_values[1], control_values[2]) + (control_obj_val, control_cycles, control_errors, control_resets) + (control_path, last_gps, control_mode[1], control_nav_version) ) if __name__ == "__main__": if not sys.argv or len(sys.argv) < 2: print "Usage: serialdump /PATH/TO/DEVICE" sys.exit(1) start_t = time.time() conn = serial.Serial(sys.argv[1], 57600, timeout=None) for logl in plog.iterlogs(conn): try: result = tick(time.time() - start_t, logl) if result: print result except Exception: raise control_config = ConfigParser.RawConfigParser() control_config.read('dynamics.conf') control_params = [ control_config.getint('default', 'roll_due_to_control'), control_config.getint('default', 'roll_due_to_beta'), control_config.getint('default', 'roll_due_to_roll_rate'), control_config.getint('default', 'pitch_due_to_control'), control_config.getint('default', 'yaw_due_to_control'),