38 #include "generated/airframe.h"
48 #ifndef FILE_LOGGER_PATH
49 #define FILE_LOGGER_PATH /data/video/usb
65 fprintf(file,
"time,");
66 fprintf(file,
"pos_x,pos_y,pos_z,");
67 fprintf(file,
"vel_x,vel_y,vel_z,");
68 fprintf(file,
"att_phi,att_theta,att_psi,");
69 fprintf(file,
"rate_p,rate_q,rate_r,");
71 fprintf(file,
"cmd_thrust,cmd_roll,cmd_pitch,cmd_yaw\n");
73 fprintf(file,
"h_ctl_aileron_setpoint,h_ctl_elevator_setpoint\n");
90 fprintf(file,
"%f,%f,%f,", pos->
x, pos->
y, pos->
z);
91 fprintf(file,
"%f,%f,%f,", vel->
x, vel->
y, vel->
z);
92 fprintf(file,
"%f,%f,%f,", att->
phi, att->
theta, att->
psi);
93 fprintf(file,
"%f,%f,%f,", rates->
p, rates->
q, rates->
r);
95 fprintf(file,
"%d,%d,%d,%d\n",
109 char save_dir_cmd[256];
111 if (system(save_dir_cmd) != 0) {
112 printf(
"[file_logger] Could not create log file directory %s.\n", STRINGIFY(
FILE_LOGGER_PATH));
119 time_t now = time(0);
121 tstruct = *localtime(&now);
122 strftime(date_time,
sizeof(date_time),
"%Y%m%d-%H%M%S", &tstruct);
132 sprintf(filename,
"%s/%s_%05d.csv", STRINGIFY(
FILE_LOGGER_PATH), date_time, counter);
138 printf(
"[file_logger] ERROR opening log file %s!\n", filename);
142 printf(
"[file_logger] Start logging to %s...\n", filename);
static struct FloatEulers * stateGetNedToBodyEulers_f(void)
Get vehicle body attitude euler angles (float).
pprz_t h_ctl_elevator_setpoint
pprz_t h_ctl_aileron_setpoint
static float get_sys_time_float(void)
Get the time in seconds since startup.
void file_logger_periodic(void)
Log the values to a csv file.
Fixed wing horizontal control.
void file_logger_stop(void)
Stop the logger an nicely close the file.
vector in North East Down coordinates Units: meters
static struct NedCoor_f * stateGetSpeedNed_f(void)
Get ground speed in local NED coordinates (float).
Architecture independent timing functions.
static struct FloatRates * stateGetBodyRates_f(void)
Get vehicle body angular rate (float).
static void file_logger_write_header(FILE *file)
Logging functions.
API to get/set the generic vehicle states.
File logger for Linux based autopilots.
General stabilization interface for rotorcrafts.
int32_t stabilization_cmd[COMMANDS_NB]
Stabilization commands.
#define FILE_LOGGER_PATH
Set the default File logger path to the USB drive.
static struct NedCoor_f * stateGetPositionNed_f(void)
Get position in local NED coordinates (float).
static FILE * file_logger
The file pointer.
static void file_logger_write_row(FILE *file)
Write CSV row Write values at this timestamp to log file.
void file_logger_start(void)
Start the file logger and open a new file.
Fixed wing horizontal adaptive control.