Browse Source

Replay: cope with FRAM messages

use them to trigger ahrs updates
master
Andrew Tridgell 10 years ago
parent
commit
2007d2b6eb
  1. 3
      Tools/Replay/LogReader.cpp
  2. 6
      Tools/Replay/MsgHandler.cpp
  3. 10
      Tools/Replay/MsgHandler.h
  4. 16
      Tools/Replay/Replay.pde

3
Tools/Replay/LogReader.cpp

@ -200,6 +200,9 @@ bool LogReader::update(char type[5]) @@ -200,6 +200,9 @@ bool LogReader::update(char type[5])
msgparser[f.type] = new MsgHandler_ARSP(formats[f.type], dataflash,
last_timestamp_usec,
airspeed);
} else if (streq(name, "FRAM")) {
msgparser[f.type] = new MsgHandler_FRAM(formats[f.type], dataflash,
last_timestamp_usec);
} else {
::printf(" No parser for (%s)\n", name);
}

6
Tools/Replay/MsgHandler.cpp

@ -345,6 +345,12 @@ void MsgHandler_ARSP::process_message(uint8_t *msg) @@ -345,6 +345,12 @@ void MsgHandler_ARSP::process_message(uint8_t *msg)
dataflash.WriteBlock(msg, f.length);
}
void MsgHandler_FRAM::process_message(uint8_t *msg)
{
wait_timestamp_from_msg(msg);
dataflash.WriteBlock(msg, f.length);
}
void MsgHandler_ATT::process_message(uint8_t *msg)
{

10
Tools/Replay/MsgHandler.h

@ -206,6 +206,16 @@ private: @@ -206,6 +206,16 @@ private:
AP_Airspeed &airspeed;
};
class MsgHandler_FRAM : public MsgHandler
{
public:
MsgHandler_FRAM(log_Format &_f, DataFlash_Class &_dataflash,
uint64_t &_last_timestamp_usec) :
MsgHandler(_f, _dataflash, _last_timestamp_usec) { };
virtual void process_message(uint8_t *msg);
};
class MsgHandler_ATT : public MsgHandler
{

16
Tools/Replay/Replay.pde

@ -103,6 +103,7 @@ static uint16_t update_rate = 50; @@ -103,6 +103,7 @@ static uint16_t update_rate = 50;
static uint32_t arm_time_ms;
static bool ahrs_healthy;
static bool have_imu2;
static bool have_fram;
static uint8_t num_user_parameters;
static struct {
@ -316,10 +317,23 @@ static void read_sensors(const char *type) @@ -316,10 +317,23 @@ static void read_sensors(const char *type)
::printf("Barometer initialised\n");
barometer.update_calibration();
}
}
bool run_ahrs = false;
if (streq(type,"FRAM")) {
if (!have_fram) {
have_fram = true;
printf("Have FRAM framing\n");
}
run_ahrs = true;
}
// special handling of IMU messages as these trigger an ahrs.update()
if ((streq(type,"IMU") && !have_imu2) || (streq(type, "IMU2") && have_imu2)) {
if (!have_fram &&
((streq(type,"IMU") && !have_imu2) || (streq(type, "IMU2") && have_imu2))) {
run_ahrs = true;
}
if (run_ahrs) {
ahrs.update();
if (ahrs.get_home().lat != 0) {
inertial_nav.update(ins.get_delta_time());

Loading…
Cancel
Save