mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 17:13:34 +08:00
UAVCAN: preserve original UAVCAN message timestamps
This commit is contained in:
@@ -91,11 +91,7 @@ void UavcanBarometerBridge::air_data_sub_cb(const uavcan::ReceivedDataStructure<
|
|||||||
{
|
{
|
||||||
auto report = ::baro_report();
|
auto report = ::baro_report();
|
||||||
|
|
||||||
report.timestamp = msg.getUtcTimestamp().toUSec();
|
report.timestamp = msg.getMonotonicTimestamp().toUSec();
|
||||||
if (report.timestamp == 0) {
|
|
||||||
report.timestamp = msg.getMonotonicTimestamp().toUSec();
|
|
||||||
}
|
|
||||||
|
|
||||||
report.temperature = msg.static_temperature;
|
report.temperature = msg.static_temperature;
|
||||||
report.pressure = msg.static_pressure / 100.0F; // Convert to millibar
|
report.pressure = msg.static_pressure / 100.0F; // Convert to millibar
|
||||||
|
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ void UavcanGnssBridge::gnss_fix_sub_cb(const uavcan::ReceivedDataStructure<uavca
|
|||||||
|
|
||||||
auto report = ::vehicle_gps_position_s();
|
auto report = ::vehicle_gps_position_s();
|
||||||
|
|
||||||
report.timestamp_position = hrt_absolute_time();
|
report.timestamp_position = msg.getMonotonicTimestamp().toUSec();
|
||||||
report.lat = msg.latitude_deg_1e8 / 10;
|
report.lat = msg.latitude_deg_1e8 / 10;
|
||||||
report.lon = msg.longitude_deg_1e8 / 10;
|
report.lon = msg.longitude_deg_1e8 / 10;
|
||||||
report.alt = msg.height_msl_mm;
|
report.alt = msg.height_msl_mm;
|
||||||
|
|||||||
@@ -43,8 +43,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <drivers/drv_hrt.h>
|
|
||||||
|
|
||||||
#include <uORB/uORB.h>
|
#include <uORB/uORB.h>
|
||||||
#include <uORB/topics/vehicle_gps_position.h>
|
#include <uORB/topics/vehicle_gps_position.h>
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,6 @@
|
|||||||
|
|
||||||
#include "mag.hpp"
|
#include "mag.hpp"
|
||||||
|
|
||||||
#include <drivers/drv_hrt.h>
|
|
||||||
#include <systemlib/err.h>
|
#include <systemlib/err.h>
|
||||||
|
|
||||||
static const orb_id_t MAG_TOPICS[3] = {
|
static const orb_id_t MAG_TOPICS[3] = {
|
||||||
@@ -140,7 +139,7 @@ void UavcanMagnetometerBridge::mag_sub_cb(const uavcan::ReceivedDataStructure<ua
|
|||||||
{
|
{
|
||||||
lock();
|
lock();
|
||||||
_report.range_ga = 1.3F; // Arbitrary number, doesn't really mean anything
|
_report.range_ga = 1.3F; // Arbitrary number, doesn't really mean anything
|
||||||
_report.timestamp = hrt_absolute_time();
|
_report.timestamp = msg.getMonotonicTimestamp().toUSec();
|
||||||
|
|
||||||
_report.x = (msg.magnetic_field[0] - _scale.x_offset) * _scale.x_scale;
|
_report.x = (msg.magnetic_field[0] - _scale.x_offset) * _scale.x_scale;
|
||||||
_report.y = (msg.magnetic_field[1] - _scale.y_offset) * _scale.y_scale;
|
_report.y = (msg.magnetic_field[1] - _scale.y_offset) * _scale.y_scale;
|
||||||
|
|||||||
Reference in New Issue
Block a user