Functions |
byte | get_num_logs (void) |
void | start_new_log (byte num_existing_logs) |
void | get_log_boundaries (byte log_num, int &start_page, int &end_page) |
int | find_last_log_page (int bottom_page) |
void | Log_Write_IMU (float gyro_x, float gyro_y, float gyro_z, float accel_x, float accel_y, float accel_z) |
void | Log_Write_GPS (long log_day, long log_hour, long log_minute, long log_second, long log_latitude, long log_longitude, long log_altitude, long log_ground_speed, long log_ground_course) |
void | Log_Write_Barometer (float temp, float press) |
void | Log_Write_RC (int elevator, int rudder, int throttle, int ch4, int ch5, int ch6, int ch7, int ch8) |
void | Log_Write_Airspeed (float a) |
void | Log_Write_Magnetometer (float h, float r, float p, float y) |
void | Log_Write_Controls_Rudder (float kpRud, float kpRudGm, float kdRud, float kdRudGm, float kiRud, float kiRudGm, float iRud, float delta) |
void | Log_Write_Controls_Elevator (float kpEle, float kpEleGm, float kpRp, float kiEle, float kiEleGm, float iEle, float delta) |
void | Log_Write_Controls_Throttle (float kpThr, float kpThrGm, float kiThr, float kiThrGm, float iThr, float delAlt, float delta) |
void | Log_Write_State (boolean drop_status, int logging_switch, boolean windProfile, float avgWindNS, float avgWindEW, float driftNS, float driftEW) |
void | Log_Write_Navigation (long latc, long lonc, long delLat, long delLon, float psic, float psierror, float phic, long dropThresh) |
Flash memory logging functions.
- Author:
- Michael Posner (CIS, MEAM '12)
-
Timothy Hennelly (ESE '12)
-
Jacob Orloff (MEAM '12)
logging file, mostly copied from ArduPilot. this allows us to write to the flash memory. when a logging Write() function is changed here, make sure its appropriate Read() counterpart is changed in the default code you use to download the log. (it will give an Error Reading END_BYTE error if the read() formate doesnt match the format that the data was written in below) Note: Instead of modifying the DataFlash library to write floats (kinda hard), instead a hack is to multiply the float value by 10^5 or whatever, then cast to long in the Write() function and write it using the long writing function. Then, in the Read() function, cast back to float and divide by 10^5.
Definition in file log.pde.
void Log_Write_GPS |
( |
long |
log_day, |
|
|
long |
log_hour, |
|
|
long |
log_minute, |
|
|
long |
log_second, |
|
|
long |
log_latitude, |
|
|
long |
log_longitude, |
|
|
long |
log_altitude, |
|
|
long |
log_ground_speed, |
|
|
long |
log_ground_course |
|
) |
| |
modified function from ArduPilot Mega. Logs GPS data. Note that the GPS library already returns longitude and latitude as their actual values * 10^7, as well as the altitude, ground speed, and ground course as their actual values * 100, so there's no need to multiply before saving as longs.
- Parameters:
-
log_day | the number of the day of the week (0=Sun, 1=Mon, ... 6=Sat) |
log_hour | the hour of the current day (0 - 23) |
log_minute | the minute of the current hour (0 - 59) |
log_second | the second of the current minute (0-59) |
log_latitude | the GPS latitude, multiplied by 10^7 (this is necessary to log in long format while keeping significant digits) |
log_longitude | the GPS longitude, multiplied by 10^7 (this is necessary to log in long format while keeping significant digits) |
log_altitude | the altitude in cm (m * 100) |
log_ground_speed | the ground speed in cm/s (m/s * 100) |
log_ground_course | the ground course in hundredths of a degree (deg * 100) |
Definition at line 238 of file log.pde.
void Log_Write_IMU |
( |
float |
gyro_x, |
|
|
float |
gyro_y, |
|
|
float |
gyro_z, |
|
|
float |
accel_x, |
|
|
float |
accel_y, |
|
|
float |
accel_z |
|
) |
| |
modified function from ArduPilot Mega. Logs IMU data. Be careful when casting from float to long! long is an integer type and cannot store decimals. so this function takes in floats, but since the flash library can't write floats (I looked into modifying it, but this hack is easier), I multiply the float by 10000 and then cast to a long. Then the corresponding Read function divides by 10000 before writing to the text file.
Definition at line 207 of file log.pde.