mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 00:13:34 +08:00
logger: record message gaps
This commit is contained in:
@@ -421,7 +421,19 @@ bool Logger::copy_if_updated(int sub_idx, void *buffer, bool try_to_subscribe)
|
||||
bool updated = false;
|
||||
|
||||
if (sub.valid()) {
|
||||
updated = sub.update(buffer);
|
||||
if (sub.get_interval_us() == 0) {
|
||||
// record gaps in full rate (no interval) messages
|
||||
const unsigned last_generation = sub.get_last_generation();
|
||||
updated = sub.update(buffer);
|
||||
|
||||
if (updated && (sub.get_last_generation() != last_generation + 1)) {
|
||||
// error, missed a message
|
||||
_message_gaps++;
|
||||
}
|
||||
|
||||
} else {
|
||||
updated = sub.update(buffer);
|
||||
}
|
||||
|
||||
} else if (try_to_subscribe) {
|
||||
if (sub.subscribe()) {
|
||||
@@ -930,6 +942,7 @@ void Logger::publish_logger_status()
|
||||
status.total_written_kb = kb_written;
|
||||
status.write_rate_kb_s = kb_written / seconds;
|
||||
status.dropouts = _statistics[i].write_dropouts;
|
||||
status.message_gaps = _message_gaps;
|
||||
status.buffer_used_bytes = buffer_fill_count_file;
|
||||
status.buffer_size_bytes = _writer.get_buffer_size_file(log_type);
|
||||
status.num_messages = _num_subscriptions;
|
||||
|
||||
@@ -68,14 +68,13 @@ namespace logger
|
||||
static constexpr uint8_t MSG_ID_INVALID = UINT8_MAX;
|
||||
|
||||
struct LoggerSubscription : public uORB::SubscriptionInterval {
|
||||
|
||||
uint8_t msg_id{MSG_ID_INVALID};
|
||||
|
||||
LoggerSubscription() = default;
|
||||
|
||||
LoggerSubscription(ORB_ID id, uint32_t interval_ms = 0, uint8_t instance = 0) :
|
||||
uORB::SubscriptionInterval(id, interval_ms * 1000, instance)
|
||||
{}
|
||||
|
||||
uint8_t msg_id{MSG_ID_INVALID};
|
||||
};
|
||||
|
||||
class Logger : public ModuleBase<Logger>, public ModuleParams
|
||||
@@ -347,6 +346,8 @@ private:
|
||||
hrt_abstime _logger_status_last {0};
|
||||
int _lockstep_component{-1};
|
||||
|
||||
uint32_t _message_gaps{0};
|
||||
|
||||
uORB::Subscription _manual_control_setpoint_sub{ORB_ID(manual_control_setpoint)};
|
||||
uORB::Subscription _vehicle_command_sub{ORB_ID(vehicle_command)};
|
||||
uORB::Subscription _vehicle_status_sub{ORB_ID(vehicle_status)};
|
||||
|
||||
Reference in New Issue
Block a user