2013-12-29 07:56:54 -04:00
|
|
|
#include <AP_HAL.h>
|
|
|
|
#include <AP_Common.h>
|
|
|
|
#include <AP_Math.h>
|
|
|
|
#include <AP_Airspeed.h>
|
|
|
|
#include <AP_Compass.h>
|
|
|
|
#include <AP_GPS.h>
|
|
|
|
#include <AP_Compass.h>
|
|
|
|
#include <AP_Baro.h>
|
|
|
|
#include <AP_InertialSensor.h>
|
|
|
|
#include <DataFlash.h>
|
|
|
|
|
|
|
|
#include "LogReader.h"
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
|
|
|
extern const AP_HAL::HAL& hal;
|
|
|
|
|
2014-02-17 18:11:46 -04:00
|
|
|
LogReader::LogReader(AP_InertialSensor &_ins, AP_Baro_HIL &_baro, AP_Compass_HIL &_compass, GPS *&_gps, AP_Airspeed &_airspeed) :
|
2014-01-04 20:39:43 -04:00
|
|
|
vehicle(VEHICLE_UNKNOWN),
|
2013-12-29 07:56:54 -04:00
|
|
|
fd(-1),
|
|
|
|
ins(_ins),
|
|
|
|
baro(_baro),
|
|
|
|
compass(_compass),
|
2014-02-17 18:11:46 -04:00
|
|
|
gps(_gps),
|
2014-03-01 17:00:13 -04:00
|
|
|
airspeed(_airspeed),
|
|
|
|
accel_mask(3),
|
|
|
|
gyro_mask(3)
|
2013-12-29 07:56:54 -04:00
|
|
|
{}
|
|
|
|
|
|
|
|
bool LogReader::open_log(const char *logfile)
|
|
|
|
{
|
|
|
|
fd = ::open(logfile, O_RDONLY);
|
|
|
|
if (fd == -1) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-01-04 20:39:43 -04:00
|
|
|
struct PACKED log_Plane_Compass {
|
2013-12-29 07:56:54 -04:00
|
|
|
LOG_PACKET_HEADER;
|
|
|
|
uint32_t time_ms;
|
|
|
|
int16_t mag_x;
|
|
|
|
int16_t mag_y;
|
|
|
|
int16_t mag_z;
|
|
|
|
int16_t offset_x;
|
|
|
|
int16_t offset_y;
|
|
|
|
int16_t offset_z;
|
|
|
|
};
|
|
|
|
|
2014-01-04 20:39:43 -04:00
|
|
|
struct PACKED log_Copter_Compass {
|
2013-12-29 07:56:54 -04:00
|
|
|
LOG_PACKET_HEADER;
|
2014-02-25 05:56:53 -04:00
|
|
|
uint32_t time_ms;
|
2014-01-04 20:39:43 -04:00
|
|
|
int16_t mag_x;
|
|
|
|
int16_t mag_y;
|
|
|
|
int16_t mag_z;
|
|
|
|
int16_t offset_x;
|
|
|
|
int16_t offset_y;
|
|
|
|
int16_t offset_z;
|
|
|
|
int16_t motor_offset_x;
|
|
|
|
int16_t motor_offset_y;
|
|
|
|
int16_t motor_offset_z;
|
2013-12-29 07:56:54 -04:00
|
|
|
};
|
|
|
|
|
2014-01-04 20:39:43 -04:00
|
|
|
struct PACKED log_Plane_Attitude {
|
2013-12-29 07:56:54 -04:00
|
|
|
LOG_PACKET_HEADER;
|
|
|
|
uint32_t time_ms;
|
|
|
|
int16_t roll;
|
|
|
|
int16_t pitch;
|
|
|
|
uint16_t yaw;
|
|
|
|
uint16_t error_rp;
|
|
|
|
uint16_t error_yaw;
|
|
|
|
};
|
|
|
|
|
2014-02-17 18:11:46 -04:00
|
|
|
struct PACKED log_AIRSPEED {
|
|
|
|
LOG_PACKET_HEADER;
|
|
|
|
uint32_t timestamp;
|
|
|
|
float airspeed;
|
|
|
|
float diffpressure;
|
|
|
|
int16_t temperature;
|
|
|
|
};
|
|
|
|
|
2014-01-04 20:39:43 -04:00
|
|
|
struct PACKED log_Copter_Attitude {
|
|
|
|
LOG_PACKET_HEADER;
|
2014-02-25 05:56:53 -04:00
|
|
|
uint32_t time_ms;
|
2014-01-04 20:39:43 -04:00
|
|
|
int16_t control_roll;
|
|
|
|
int16_t roll;
|
|
|
|
int16_t control_pitch;
|
|
|
|
int16_t pitch;
|
|
|
|
uint16_t control_yaw;
|
|
|
|
uint16_t yaw;
|
|
|
|
};
|
|
|
|
|
2014-02-25 05:56:53 -04:00
|
|
|
struct PACKED log_Copter_Nav_Tuning {
|
2014-01-05 01:37:47 -04:00
|
|
|
LOG_PACKET_HEADER;
|
2014-02-25 05:56:53 -04:00
|
|
|
uint32_t time_ms;
|
|
|
|
float desired_pos_x;
|
|
|
|
float desired_pos_y;
|
|
|
|
float pos_x;
|
|
|
|
float pos_y;
|
|
|
|
float desired_vel_x;
|
|
|
|
float desired_vel_y;
|
|
|
|
float vel_x;
|
|
|
|
float vel_y;
|
|
|
|
float desired_accel_x;
|
|
|
|
float desired_accel_y;
|
2014-01-05 01:37:47 -04:00
|
|
|
};
|
|
|
|
|
2014-03-06 02:50:50 -04:00
|
|
|
struct PACKED log_Rover_Attitude {
|
|
|
|
LOG_PACKET_HEADER;
|
|
|
|
uint32_t time_ms;
|
|
|
|
int16_t roll;
|
|
|
|
int16_t pitch;
|
|
|
|
uint16_t yaw;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct PACKED log_Rover_Compass {
|
|
|
|
LOG_PACKET_HEADER;
|
|
|
|
uint32_t time_ms;
|
|
|
|
int16_t mag_x;
|
|
|
|
int16_t mag_y;
|
|
|
|
int16_t mag_z;
|
|
|
|
int16_t offset_x;
|
|
|
|
int16_t offset_y;
|
|
|
|
int16_t offset_z;
|
|
|
|
int16_t motor_offset_x;
|
|
|
|
int16_t motor_offset_y;
|
|
|
|
int16_t motor_offset_z;
|
|
|
|
};
|
|
|
|
|
2014-01-04 20:39:43 -04:00
|
|
|
void LogReader::process_plane(uint8_t type, uint8_t *data, uint16_t length)
|
|
|
|
{
|
|
|
|
switch (type) {
|
|
|
|
case LOG_PLANE_COMPASS_MSG: {
|
|
|
|
struct log_Plane_Compass msg;
|
|
|
|
if(sizeof(msg) != length) {
|
2014-02-25 05:56:53 -04:00
|
|
|
printf("Bad plane COMPASS length\n");
|
2014-01-04 20:39:43 -04:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
memcpy(&msg, data, sizeof(msg));
|
|
|
|
wait_timestamp(msg.time_ms);
|
|
|
|
compass.setHIL(Vector3i(msg.mag_x - msg.offset_x, msg.mag_y - msg.offset_y, msg.mag_z - msg.offset_z));
|
|
|
|
compass.set_offsets(msg.offset_x, msg.offset_y, msg.offset_z);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case LOG_PLANE_ATTITUDE_MSG: {
|
|
|
|
struct log_Plane_Attitude msg;
|
|
|
|
if(sizeof(msg) != length) {
|
|
|
|
printf("Bad ATTITUDE length\n");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
memcpy(&msg, data, sizeof(msg));
|
|
|
|
wait_timestamp(msg.time_ms);
|
|
|
|
attitude = Vector3f(msg.roll*0.01f, msg.pitch*0.01f, msg.yaw*0.01f);
|
|
|
|
break;
|
|
|
|
}
|
2014-01-05 01:37:47 -04:00
|
|
|
|
2014-02-17 18:11:46 -04:00
|
|
|
case LOG_PLANE_AIRSPEED_MSG: {
|
|
|
|
struct log_AIRSPEED msg;
|
2014-01-05 01:37:47 -04:00
|
|
|
if(sizeof(msg) != length) {
|
2014-02-17 18:11:46 -04:00
|
|
|
printf("Bad AIRSPEED length\n");
|
2014-01-05 01:37:47 -04:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
memcpy(&msg, data, sizeof(msg));
|
2014-02-17 18:11:46 -04:00
|
|
|
wait_timestamp(msg.timestamp);
|
|
|
|
airspeed.setHIL(msg.airspeed, msg.diffpressure, msg.temperature);
|
2014-01-05 01:37:47 -04:00
|
|
|
break;
|
|
|
|
}
|
2014-01-04 20:39:43 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-06 02:50:50 -04:00
|
|
|
void LogReader::process_rover(uint8_t type, uint8_t *data, uint16_t length)
|
|
|
|
{
|
|
|
|
switch (type) {
|
|
|
|
case LOG_ROVER_COMPASS_MSG: {
|
|
|
|
struct log_Rover_Compass msg;
|
|
|
|
if(sizeof(msg) != length) {
|
|
|
|
printf("Bad rover COMPASS length\n");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
memcpy(&msg, data, sizeof(msg));
|
|
|
|
wait_timestamp(msg.time_ms);
|
|
|
|
compass.setHIL(Vector3i(msg.mag_x - msg.offset_x, msg.mag_y - msg.offset_y, msg.mag_z - msg.offset_z));
|
|
|
|
compass.set_offsets(msg.offset_x, msg.offset_y, msg.offset_z);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case LOG_ROVER_ATTITUDE_MSG: {
|
|
|
|
struct log_Rover_Attitude msg;
|
|
|
|
if(sizeof(msg) != length) {
|
|
|
|
printf("Bad ATTITUDE length\n");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
memcpy(&msg, data, sizeof(msg));
|
|
|
|
wait_timestamp(msg.time_ms);
|
|
|
|
attitude = Vector3f(msg.roll*0.01f, msg.pitch*0.01f, msg.yaw*0.01f);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-04 20:39:43 -04:00
|
|
|
void LogReader::process_copter(uint8_t type, uint8_t *data, uint16_t length)
|
|
|
|
{
|
|
|
|
switch (type) {
|
|
|
|
case LOG_COPTER_COMPASS_MSG: {
|
|
|
|
struct log_Copter_Compass msg;
|
|
|
|
if(sizeof(msg) != length) {
|
2014-02-25 05:56:53 -04:00
|
|
|
printf("Bad copter COMPASS length %u expected %u\n", (unsigned)length, (unsigned)sizeof(msg));
|
2014-01-04 20:39:43 -04:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
memcpy(&msg, data, sizeof(msg));
|
2014-02-25 05:56:53 -04:00
|
|
|
wait_timestamp(msg.time_ms);
|
2014-01-04 20:39:43 -04:00
|
|
|
compass.setHIL(Vector3i(msg.mag_x - msg.offset_x, msg.mag_y - msg.offset_y, msg.mag_z - msg.offset_z));
|
|
|
|
compass.set_offsets(msg.offset_x, msg.offset_y, msg.offset_z);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case LOG_COPTER_ATTITUDE_MSG: {
|
|
|
|
struct log_Copter_Attitude msg;
|
|
|
|
if(sizeof(msg) != length) {
|
|
|
|
printf("Bad ATTITUDE length\n");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
memcpy(&msg, data, sizeof(msg));
|
2014-02-25 05:56:53 -04:00
|
|
|
wait_timestamp(msg.time_ms);
|
2014-01-04 20:39:43 -04:00
|
|
|
attitude = Vector3f(msg.roll*0.01f, msg.pitch*0.01f, msg.yaw*0.01f);
|
|
|
|
break;
|
|
|
|
}
|
2014-01-05 01:37:47 -04:00
|
|
|
|
2014-02-25 05:56:53 -04:00
|
|
|
case LOG_COPTER_NAV_TUNING_MSG: {
|
|
|
|
struct log_Copter_Nav_Tuning msg;
|
2014-01-05 01:37:47 -04:00
|
|
|
if(sizeof(msg) != length) {
|
2014-02-25 05:56:53 -04:00
|
|
|
printf("Bad copter NAV_TUNING length\n");
|
2014-01-05 01:37:47 -04:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
memcpy(&msg, data, sizeof(msg));
|
2014-02-25 05:56:53 -04:00
|
|
|
wait_timestamp(msg.time_ms);
|
|
|
|
inavpos = Vector3f(msg.pos_x * 0.01f,
|
|
|
|
msg.pos_y * 0.01f,
|
|
|
|
0);
|
2014-01-05 01:37:47 -04:00
|
|
|
break;
|
|
|
|
}
|
2014-01-04 20:39:43 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-01 00:15:46 -04:00
|
|
|
bool LogReader::set_parameter(const char *name, float value)
|
|
|
|
{
|
|
|
|
enum ap_var_type var_type;
|
|
|
|
AP_Param *vp = AP_Param::find(name, &var_type);
|
|
|
|
if (vp == NULL) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (var_type == AP_PARAM_FLOAT) {
|
|
|
|
((AP_Float *)vp)->set(value);
|
|
|
|
::printf("Set %s to %f\n", name, value);
|
|
|
|
} else if (var_type == AP_PARAM_INT32) {
|
|
|
|
((AP_Int32 *)vp)->set(value);
|
|
|
|
::printf("Set %s to %d\n", name, (int)value);
|
|
|
|
} else if (var_type == AP_PARAM_INT16) {
|
|
|
|
((AP_Int16 *)vp)->set(value);
|
|
|
|
::printf("Set %s to %d\n", name, (int)value);
|
|
|
|
} else if (var_type == AP_PARAM_INT8) {
|
|
|
|
((AP_Int8 *)vp)->set(value);
|
|
|
|
::printf("Set %s to %d\n", name, (int)value);
|
|
|
|
} else {
|
|
|
|
// we don't support mavlink set on this parameter
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-12-29 07:56:54 -04:00
|
|
|
bool LogReader::update(uint8_t &type)
|
|
|
|
{
|
|
|
|
uint8_t hdr[3];
|
|
|
|
if (::read(fd, hdr, 3) != 3) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (hdr[0] != HEAD_BYTE1 || hdr[1] != HEAD_BYTE2) {
|
2014-01-04 20:39:43 -04:00
|
|
|
printf("bad log header\n");
|
2013-12-29 07:56:54 -04:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hdr[2] == LOG_FORMAT_MSG) {
|
|
|
|
struct log_Format &f = formats[num_formats];
|
|
|
|
memcpy(&f, hdr, 3);
|
|
|
|
if (::read(fd, &f.type, sizeof(f)-3) != sizeof(f)-3) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
num_formats++;
|
|
|
|
type = f.type;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8_t i;
|
|
|
|
for (i=0; i<num_formats; i++) {
|
|
|
|
if (formats[i].type == hdr[2]) break;
|
|
|
|
}
|
|
|
|
if (i == num_formats) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
const struct log_Format &f = formats[i];
|
|
|
|
|
|
|
|
uint8_t data[f.length];
|
|
|
|
memcpy(data, hdr, 3);
|
|
|
|
if (::read(fd, &data[3], f.length-3) != f.length-3) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (f.type) {
|
2014-01-04 20:39:43 -04:00
|
|
|
case LOG_MESSAGE_MSG: {
|
|
|
|
struct log_Message msg;
|
|
|
|
if(sizeof(msg) != f.length) {
|
|
|
|
printf("Bad MESSAGE length\n");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
memcpy(&msg, data, sizeof(msg));
|
|
|
|
if (strncmp(msg.msg, "ArduPlane", strlen("ArduPlane")) == 0) {
|
|
|
|
vehicle = VEHICLE_PLANE;
|
|
|
|
::printf("Detected Plane\n");
|
|
|
|
} else if (strncmp(msg.msg, "ArduCopter", strlen("ArduCopter")) == 0) {
|
|
|
|
vehicle = VEHICLE_COPTER;
|
|
|
|
::printf("Detected Copter\n");
|
2014-03-06 02:50:50 -04:00
|
|
|
} else if (strncmp(msg.msg, "ArduRover", strlen("ArduRover")) == 0) {
|
2014-01-04 20:39:43 -04:00
|
|
|
vehicle = VEHICLE_ROVER;
|
|
|
|
::printf("Detected Rover\n");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2013-12-29 07:56:54 -04:00
|
|
|
case LOG_IMU_MSG: {
|
|
|
|
struct log_IMU msg;
|
2014-01-04 20:39:43 -04:00
|
|
|
if(sizeof(msg) != f.length) {
|
|
|
|
printf("Bad IMU length\n");
|
|
|
|
exit(1);
|
|
|
|
}
|
2013-12-29 07:56:54 -04:00
|
|
|
memcpy(&msg, data, sizeof(msg));
|
|
|
|
wait_timestamp(msg.timestamp);
|
2014-03-01 17:00:13 -04:00
|
|
|
if (gyro_mask & 1) {
|
|
|
|
ins.set_gyro(0, Vector3f(msg.gyro_x, msg.gyro_y, msg.gyro_z));
|
|
|
|
}
|
|
|
|
if (accel_mask & 1) {
|
|
|
|
ins.set_accel(0, Vector3f(msg.accel_x, msg.accel_y, msg.accel_z));
|
|
|
|
}
|
2014-02-22 17:17:55 -04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case LOG_IMU2_MSG: {
|
|
|
|
struct log_IMU msg;
|
|
|
|
if(sizeof(msg) != f.length) {
|
|
|
|
printf("Bad IMU2 length\n");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
memcpy(&msg, data, sizeof(msg));
|
|
|
|
wait_timestamp(msg.timestamp);
|
2014-03-01 17:00:13 -04:00
|
|
|
if (gyro_mask & 2) {
|
|
|
|
ins.set_gyro(1, Vector3f(msg.gyro_x, msg.gyro_y, msg.gyro_z));
|
|
|
|
}
|
|
|
|
if (accel_mask & 2) {
|
|
|
|
ins.set_accel(1, Vector3f(msg.accel_x, msg.accel_y, msg.accel_z));
|
|
|
|
}
|
2013-12-29 07:56:54 -04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case LOG_GPS_MSG: {
|
|
|
|
struct log_GPS msg;
|
2014-01-04 20:39:43 -04:00
|
|
|
if(sizeof(msg) != f.length) {
|
|
|
|
printf("Bad GPS length\n");
|
|
|
|
exit(1);
|
|
|
|
}
|
2013-12-29 07:56:54 -04:00
|
|
|
memcpy(&msg, data, sizeof(msg));
|
|
|
|
wait_timestamp(msg.apm_time);
|
2014-02-25 06:10:49 -04:00
|
|
|
gps->setHIL(msg.status==3?GPS::FIX_3D:GPS::FIX_NONE,
|
|
|
|
msg.apm_time,
|
2013-12-29 07:56:54 -04:00
|
|
|
msg.latitude*1.0e-7f,
|
|
|
|
msg.longitude*1.0e-7f,
|
|
|
|
msg.altitude*1.0e-2f,
|
|
|
|
msg.ground_speed*1.0e-2f,
|
|
|
|
msg.ground_course*1.0e-2f,
|
|
|
|
0,
|
2014-02-25 06:10:49 -04:00
|
|
|
msg.num_sats);
|
2013-12-29 18:32:20 -04:00
|
|
|
if (msg.status == 3 && ground_alt_cm == 0) {
|
|
|
|
ground_alt_cm = msg.altitude;
|
|
|
|
}
|
2014-02-22 17:17:55 -04:00
|
|
|
rel_altitude = msg.rel_altitude*0.01f;
|
2013-12-29 07:56:54 -04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-01-03 01:07:39 -04:00
|
|
|
case LOG_SIMSTATE_MSG: {
|
|
|
|
struct log_AHRS msg;
|
2014-01-04 20:39:43 -04:00
|
|
|
if(sizeof(msg) != f.length) {
|
|
|
|
printf("Bad SIMSTATE length\n");
|
|
|
|
exit(1);
|
|
|
|
}
|
2014-01-03 01:07:39 -04:00
|
|
|
memcpy(&msg, data, sizeof(msg));
|
|
|
|
wait_timestamp(msg.time_ms);
|
|
|
|
sim_attitude = Vector3f(msg.roll*0.01f, msg.pitch*0.01f, msg.yaw*0.01f);
|
|
|
|
break;
|
|
|
|
}
|
2014-01-04 20:39:43 -04:00
|
|
|
|
2014-02-17 18:11:46 -04:00
|
|
|
case LOG_BARO_MSG: {
|
|
|
|
struct log_BARO msg;
|
|
|
|
if(sizeof(msg) != f.length) {
|
|
|
|
printf("Bad LOG_BARO length\n");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
memcpy(&msg, data, sizeof(msg));
|
|
|
|
wait_timestamp(msg.timestamp);
|
|
|
|
baro.setHIL(msg.pressure, msg.temperature*0.01f);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-03-01 00:15:46 -04:00
|
|
|
case LOG_PARAMETER_MSG: {
|
|
|
|
struct log_Parameter msg;
|
|
|
|
if(sizeof(msg) != f.length) {
|
|
|
|
printf("Bad LOG_PARAMETER length\n");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
memcpy(&msg, data, sizeof(msg));
|
|
|
|
set_parameter(msg.name, msg.value);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-01-04 20:39:43 -04:00
|
|
|
default:
|
|
|
|
if (vehicle == VEHICLE_PLANE) {
|
|
|
|
process_plane(f.type, data, f.length);
|
|
|
|
} else if (vehicle == VEHICLE_COPTER) {
|
|
|
|
process_copter(f.type, data, f.length);
|
2014-03-06 02:50:50 -04:00
|
|
|
} else if (vehicle == VEHICLE_ROVER) {
|
|
|
|
process_rover(f.type, data, f.length);
|
2014-01-04 20:39:43 -04:00
|
|
|
}
|
|
|
|
break;
|
2013-12-29 07:56:54 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
type = f.type;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void LogReader::wait_timestamp(uint32_t timestamp)
|
|
|
|
{
|
2014-02-26 04:34:01 -04:00
|
|
|
hal.scheduler->stop_clock(timestamp*1000UL);
|
2013-12-29 07:56:54 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool LogReader::wait_type(uint8_t wtype)
|
|
|
|
{
|
|
|
|
while (true) {
|
|
|
|
uint8_t type;
|
|
|
|
if (!update(type)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (wtype == type) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|