mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-01 21:48:28 -04:00
Replay: added MAG2 message
This commit is contained in:
parent
9f05e54d90
commit
a356ad1c79
@ -31,6 +31,7 @@
|
|||||||
#include "MsgHandler_AHR2.h"
|
#include "MsgHandler_AHR2.h"
|
||||||
#include "MsgHandler_ATT.h"
|
#include "MsgHandler_ATT.h"
|
||||||
#include "MsgHandler_MAG.h"
|
#include "MsgHandler_MAG.h"
|
||||||
|
#include "MsgHandler_MAG2.h"
|
||||||
#include "MsgHandler_NTUN_Copter.h"
|
#include "MsgHandler_NTUN_Copter.h"
|
||||||
#include "MsgHandler_ARSP.h"
|
#include "MsgHandler_ARSP.h"
|
||||||
|
|
||||||
@ -182,6 +183,9 @@ bool LogReader::update(char type[5])
|
|||||||
} else if (streq(name, "MAG")) {
|
} else if (streq(name, "MAG")) {
|
||||||
msgparser[f.type] = new MsgHandler_MAG(formats[f.type], dataflash,
|
msgparser[f.type] = new MsgHandler_MAG(formats[f.type], dataflash,
|
||||||
last_timestamp_usec, compass);
|
last_timestamp_usec, compass);
|
||||||
|
} else if (streq(name, "MAG2")) {
|
||||||
|
msgparser[f.type] = new MsgHandler_MAG2(formats[f.type], dataflash,
|
||||||
|
last_timestamp_usec, compass);
|
||||||
} else if (streq(name, "NTUN")) {
|
} else if (streq(name, "NTUN")) {
|
||||||
// the label "NTUN" is used by rover, copter and plane -
|
// the label "NTUN" is used by rover, copter and plane -
|
||||||
// and they all look different! creation of a parser is
|
// and they all look different! creation of a parser is
|
||||||
|
@ -7,6 +7,5 @@ void MsgHandler_ARSP::process_message(uint8_t *msg)
|
|||||||
airspeed.setHIL(require_field_float(msg, "Airspeed"),
|
airspeed.setHIL(require_field_float(msg, "Airspeed"),
|
||||||
require_field_float(msg, "DiffPress"),
|
require_field_float(msg, "DiffPress"),
|
||||||
require_field_float(msg, "Temp"));
|
require_field_float(msg, "Temp"));
|
||||||
|
dataflash.WriteBlock(msg, f.length);
|
||||||
dataflash.Log_Write_Airspeed(airspeed);
|
|
||||||
}
|
}
|
||||||
|
@ -6,5 +6,5 @@ void MsgHandler_BARO::process_message(uint8_t *msg)
|
|||||||
baro.setHIL(0,
|
baro.setHIL(0,
|
||||||
require_field_float(msg, "Press"),
|
require_field_float(msg, "Press"),
|
||||||
require_field_int16_t(msg, "Temp") * 0.01f);
|
require_field_int16_t(msg, "Temp") * 0.01f);
|
||||||
dataflash.Log_Write_Baro(baro);
|
dataflash.WriteBlock(msg, f.length);
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,6 @@ void MsgHandler_GPS_Base::update_from_msg_gps(uint8_t gps_offset, uint8_t *msg,
|
|||||||
rel_altitude = 0.01f * require_field_int32_t(msg, "RelAlt");
|
rel_altitude = 0.01f * require_field_int32_t(msg, "RelAlt");
|
||||||
}
|
}
|
||||||
|
|
||||||
dataflash.Log_Write_GPS(gps, gps_offset, rel_altitude);
|
dataflash.WriteBlock(msg, f.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,5 +17,5 @@ void MsgHandler_IMU_Base::update_from_msg_imu(uint8_t imu_offset, uint8_t *msg)
|
|||||||
ins.set_accel(imu_offset, accel2);
|
ins.set_accel(imu_offset, accel2);
|
||||||
}
|
}
|
||||||
|
|
||||||
dataflash.Log_Write_IMU(ins);
|
dataflash.WriteBlock(msg, f.length);
|
||||||
}
|
}
|
||||||
|
6
Tools/Replay/MsgHandler_MAG2.cpp
Normal file
6
Tools/Replay/MsgHandler_MAG2.cpp
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#include "MsgHandler_MAG2.h"
|
||||||
|
|
||||||
|
void MsgHandler_MAG2::process_message(uint8_t *msg)
|
||||||
|
{
|
||||||
|
update_from_msg_compass(1, msg);
|
||||||
|
}
|
11
Tools/Replay/MsgHandler_MAG2.h
Normal file
11
Tools/Replay/MsgHandler_MAG2.h
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#include "MsgHandler_MAG_Base.h"
|
||||||
|
|
||||||
|
class MsgHandler_MAG2 : public MsgHandler_MAG_Base
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MsgHandler_MAG2(log_Format &_f, DataFlash_Class &_dataflash,
|
||||||
|
uint64_t &_last_timestamp_usec, Compass &_compass)
|
||||||
|
: MsgHandler_MAG_Base(_f, _dataflash, _last_timestamp_usec,_compass) {};
|
||||||
|
|
||||||
|
virtual void process_message(uint8_t *msg);
|
||||||
|
};
|
@ -14,6 +14,6 @@ void MsgHandler_MAG_Base::update_from_msg_compass(uint8_t compass_offset, uint8_
|
|||||||
// mag_offset is a vector indicating the compass' calibration...
|
// mag_offset is a vector indicating the compass' calibration...
|
||||||
compass.set_offsets(compass_offset, mag_offset);
|
compass.set_offsets(compass_offset, mag_offset);
|
||||||
|
|
||||||
dataflash.Log_Write_Compass(compass);
|
dataflash.WriteBlock(msg, f.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
#ifndef MSGHANDLER_MAG_BASE_H
|
||||||
|
#define MSGHANDLER_MAG_BASE_H
|
||||||
|
|
||||||
#include "MsgHandler.h"
|
#include "MsgHandler.h"
|
||||||
|
|
||||||
class MsgHandler_MAG_Base : public MsgHandler
|
class MsgHandler_MAG_Base : public MsgHandler
|
||||||
@ -13,3 +16,5 @@ protected:
|
|||||||
private:
|
private:
|
||||||
Compass &compass;
|
Compass &compass;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif // MSGHANDLER_MAG_BASE
|
||||||
|
Loading…
Reference in New Issue
Block a user