ardupilot/Tools/Replay/LogReader.h

82 lines
2.5 KiB
C
Raw Normal View History

2015-06-29 02:59:53 -03:00
#include "VehicleType.h"
#include "DataFlashFileReader.h"
#include "LR_MsgHandler.h"
class LogReader : public DataFlashFileReader
{
public:
2015-07-07 02:13:51 -03:00
LogReader(AP_AHRS &_ahrs, AP_InertialSensor &_ins, AP_Baro &_baro, Compass &_compass, AP_GPS &_gps, AP_Airspeed &_airspeed, DataFlash_Class &_dataflash, const struct LogStructure *structure, uint8_t num_types, const char **&nottypes);
bool wait_type(const char *type);
2014-01-05 01:37:47 -04:00
const Vector3f &get_attitude(void) const { return attitude; }
const Vector3f &get_ahr2_attitude(void) const { return ahr2_attitude; }
2014-01-05 01:37:47 -04:00
const Vector3f &get_inavpos(void) const { return inavpos; }
const Vector3f &get_sim_attitude(void) const { return sim_attitude; }
const float &get_relalt(void) const { return rel_altitude; }
2015-06-26 02:12:17 -03:00
const LR_MsgHandler::CheckState &get_check_state(void) const { return check_state; }
VehicleType::vehicle_type vehicle;
bool set_parameter(const char *name, float value);
void set_accel_mask(uint8_t mask) { accel_mask = mask; }
void set_gyro_mask(uint8_t mask) { gyro_mask = mask; }
2015-06-16 01:26:07 -03:00
void set_use_imt(bool _use_imt) { use_imt = _use_imt; }
void set_save_chek_messages(bool _save_chek_messages) { save_chek_messages = _save_chek_messages; }
uint64_t last_timestamp_us(void) const { return last_timestamp_usec; }
virtual bool handle_log_format_msg(const struct log_Format &f);
virtual bool handle_msg(const struct log_Format &f, uint8_t *msg);
2015-07-07 02:13:51 -03:00
static bool in_list(const char *type, const char *list[]);
protected:
virtual void end_format_msgs(void) override;
private:
2014-04-21 05:11:20 -03:00
AP_AHRS &ahrs;
AP_InertialSensor &ins;
2015-01-05 07:28:06 -04:00
AP_Baro &baro;
Compass &compass;
2014-03-31 04:46:01 -03:00
AP_GPS &gps;
AP_Airspeed &airspeed;
DataFlash_Class &dataflash;
uint8_t accel_mask;
uint8_t gyro_mask;
2015-06-16 01:26:07 -03:00
bool use_imt = true;
uint32_t ground_alt_cm;
class LR_MsgHandler *msgparser[LOGREADER_MAX_FORMATS] {};
Vector3f attitude;
Vector3f ahr2_attitude;
Vector3f sim_attitude;
2014-01-05 01:37:47 -04:00
Vector3f inavpos;
float rel_altitude;
uint64_t last_timestamp_usec;
// mapping from original msgid to output msgid
uint8_t mapped_msgid[256] {};
// next available msgid for mapping
uint8_t next_msgid = 1;
const struct LogStructure *structure;
uint8_t num_types;
2015-06-26 02:12:17 -03:00
LR_MsgHandler::CheckState check_state;
bool installed_vehicle_specific_parsers;
2015-07-07 02:13:51 -03:00
const char **&nottypes;
bool save_chek_messages;
2015-07-07 02:13:51 -03:00
void maybe_install_vehicle_specific_parsers();
uint8_t map_fmt_type(const char *name, uint8_t intype);
bool save_message_type(const char *name);
};