mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 08:28:52 +08:00
ekf2: update logger, mavlink, DDS, and replay for AuxGlobalPosition
Update integrations to use the new AuxGlobalPosition message instead of the VehicleGlobalPosition-based aux_global_position topic.
This commit is contained in:
committed by
Marco Hauswirth
parent
b346fcfa00
commit
8a9be9a8f0
@@ -43,7 +43,7 @@ AuxGlobalPosition::AuxGlobalPosition() : ModuleParams(nullptr)
|
|||||||
_id_param_values[slot] = getAgpParamInt32("ID", slot);
|
_id_param_values[slot] = getAgpParamInt32("ID", slot);
|
||||||
|
|
||||||
if (_id_param_values[slot] != 0) {
|
if (_id_param_values[slot] != 0) {
|
||||||
_sources[slot] = new AgpSource(slot, this);
|
_sources[slot] = new AgpSource(slot);
|
||||||
_n_sources++;
|
_n_sources++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-20
@@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
*
|
*
|
||||||
* Copyright (c) 2023 PX4 Development Team. All rights reserved.
|
* Copyright (c) 2023-2026 PX4 Development Team. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -33,13 +33,11 @@
|
|||||||
|
|
||||||
#include "ekf.h"
|
#include "ekf.h"
|
||||||
#include <aid_sources/aux_global_position/aux_global_position_control.hpp>
|
#include <aid_sources/aux_global_position/aux_global_position_control.hpp>
|
||||||
#include <aid_sources/aux_global_position/aux_global_position.hpp>
|
|
||||||
|
|
||||||
#if defined(CONFIG_EKF2_AUX_GLOBAL_POSITION) && defined(MODULE_NAME)
|
#if defined(CONFIG_EKF2_AUX_GLOBAL_POSITION) && defined(MODULE_NAME)
|
||||||
|
|
||||||
AgpSource::AgpSource(int slot, AuxGlobalPosition *manager)
|
AgpSource::AgpSource(int slot)
|
||||||
: _manager(manager)
|
: _slot(slot)
|
||||||
, _slot(slot)
|
|
||||||
{
|
{
|
||||||
initParams();
|
initParams();
|
||||||
advertise();
|
advertise();
|
||||||
@@ -148,7 +146,6 @@ bool AgpSource::update(Ekf &ekf, const estimator::imuSample &imu_delayed)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (fused || reset) {
|
if (fused || reset) {
|
||||||
ekf.enableControlStatusAuxGpos();
|
|
||||||
_reset_counters.lat_lon = sample.lat_lon_reset_counter;
|
_reset_counters.lat_lon = sample.lat_lon_reset_counter;
|
||||||
_state = State::kActive;
|
_state = State::kActive;
|
||||||
}
|
}
|
||||||
@@ -158,7 +155,6 @@ bool AgpSource::update(Ekf &ekf, const estimator::imuSample &imu_delayed)
|
|||||||
if (ekf.resetGlobalPositionTo(sample.latitude, sample.longitude, sample.altitude_amsl, pos_var,
|
if (ekf.resetGlobalPositionTo(sample.latitude, sample.longitude, sample.altitude_amsl, pos_var,
|
||||||
sq(sample.epv))) {
|
sq(sample.epv))) {
|
||||||
ekf.resetAidSourceStatusZeroInnovation(_aid_src);
|
ekf.resetAidSourceStatusZeroInnovation(_aid_src);
|
||||||
ekf.enableControlStatusAuxGpos();
|
|
||||||
_reset_counters.lat_lon = sample.lat_lon_reset_counter;
|
_reset_counters.lat_lon = sample.lat_lon_reset_counter;
|
||||||
_state = State::kActive;
|
_state = State::kActive;
|
||||||
}
|
}
|
||||||
@@ -183,19 +179,11 @@ bool AgpSource::update(Ekf &ekf, const estimator::imuSample &imu_delayed)
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
_state = State::kStopped;
|
_state = State::kStopped;
|
||||||
|
|
||||||
if (!_manager->anySourceFusing()) {
|
|
||||||
ekf.disableControlStatusAuxGpos();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
_state = State::kStopped;
|
_state = State::kStopped;
|
||||||
|
|
||||||
if (!_manager->anySourceFusing()) {
|
|
||||||
ekf.disableControlStatusAuxGpos();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -213,11 +201,6 @@ bool AgpSource::update(Ekf &ekf, const estimator::imuSample &imu_delayed)
|
|||||||
|
|
||||||
} else if ((_state != State::kStopped) && isTimedOut(_time_last_buffer_push, imu_delayed.time_us, (uint64_t)5e6)) {
|
} else if ((_state != State::kStopped) && isTimedOut(_time_last_buffer_push, imu_delayed.time_us, (uint64_t)5e6)) {
|
||||||
_state = State::kStopped;
|
_state = State::kStopped;
|
||||||
|
|
||||||
if (!_manager->anySourceFusing()) {
|
|
||||||
ekf.disableControlStatusAuxGpos();
|
|
||||||
}
|
|
||||||
|
|
||||||
ECL_INFO("Aux global position data stopped for slot %d", _slot);
|
ECL_INFO("Aux global position data stopped for slot %d", _slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-4
@@ -44,12 +44,11 @@
|
|||||||
#include <uORB/topics/aux_global_position.h>
|
#include <uORB/topics/aux_global_position.h>
|
||||||
|
|
||||||
class Ekf;
|
class Ekf;
|
||||||
class AuxGlobalPosition;
|
|
||||||
|
|
||||||
class AgpSource
|
class AgpSource
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AgpSource(int slot, AuxGlobalPosition *manager);
|
AgpSource(int slot);
|
||||||
~AgpSource() = default;
|
~AgpSource() = default;
|
||||||
|
|
||||||
void bufferData(const aux_global_position_s &msg, const estimator::imuSample &imu_delayed);
|
void bufferData(const aux_global_position_s &msg, const estimator::imuSample &imu_delayed);
|
||||||
@@ -101,8 +100,6 @@ private:
|
|||||||
float _test_ratio_filtered{0.f};
|
float _test_ratio_filtered{0.f};
|
||||||
uint64_t _time_last_buffer_push{0};
|
uint64_t _time_last_buffer_push{0};
|
||||||
reset_counters_s _reset_counters{};
|
reset_counters_s _reset_counters{};
|
||||||
|
|
||||||
AuxGlobalPosition *_manager;
|
|
||||||
int _slot;
|
int _slot;
|
||||||
|
|
||||||
struct ParamHandles {
|
struct ParamHandles {
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ void Ekf::controlFusionModes(const imuSample &imu_delayed)
|
|||||||
|
|
||||||
#if defined(CONFIG_EKF2_AUX_GLOBAL_POSITION) && defined(MODULE_NAME)
|
#if defined(CONFIG_EKF2_AUX_GLOBAL_POSITION) && defined(MODULE_NAME)
|
||||||
_aux_global_position.update(*this, imu_delayed);
|
_aux_global_position.update(*this, imu_delayed);
|
||||||
|
_control_status.flags.aux_gpos = _aux_global_position.anySourceFusing();
|
||||||
#endif // CONFIG_EKF2_AUX_GLOBAL_POSITION
|
#endif // CONFIG_EKF2_AUX_GLOBAL_POSITION
|
||||||
|
|
||||||
#if defined(CONFIG_EKF2_AIRSPEED)
|
#if defined(CONFIG_EKF2_AIRSPEED)
|
||||||
|
|||||||
@@ -303,9 +303,6 @@ public:
|
|||||||
const filter_control_status_u &control_status_prev() const { return _control_status_prev; }
|
const filter_control_status_u &control_status_prev() const { return _control_status_prev; }
|
||||||
const decltype(filter_control_status_u::flags) &control_status_prev_flags() const { return _control_status_prev.flags; }
|
const decltype(filter_control_status_u::flags) &control_status_prev_flags() const { return _control_status_prev.flags; }
|
||||||
|
|
||||||
void enableControlStatusAuxGpos() { _control_status.flags.aux_gpos = true; }
|
|
||||||
void disableControlStatusAuxGpos() { _control_status.flags.aux_gpos = false; }
|
|
||||||
|
|
||||||
// get EKF internal fault status
|
// get EKF internal fault status
|
||||||
const fault_status_u &fault_status() const { return _fault_status; }
|
const fault_status_u &fault_status() const { return _fault_status; }
|
||||||
const decltype(fault_status_u::flags) &fault_status_flags() const { return _fault_status.flags; }
|
const decltype(fault_status_u::flags) &fault_status_flags() const { return _fault_status.flags; }
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ void LoggedTopics::add_default_topics()
|
|||||||
add_topic_multi("vehicle_imu_status", 1000, 4);
|
add_topic_multi("vehicle_imu_status", 1000, 4);
|
||||||
add_optional_topic_multi("vehicle_magnetometer", 500, 4);
|
add_optional_topic_multi("vehicle_magnetometer", 500, 4);
|
||||||
add_topic("vehicle_optical_flow", 500);
|
add_topic("vehicle_optical_flow", 500);
|
||||||
add_topic("aux_global_position", 500);
|
add_topic_multi("aux_global_position", 500);
|
||||||
add_optional_topic("pps_capture");
|
add_optional_topic("pps_capture");
|
||||||
|
|
||||||
// additional control allocation logging
|
// additional control allocation logging
|
||||||
@@ -319,7 +319,7 @@ void LoggedTopics::add_estimator_replay_topics()
|
|||||||
add_topic("vehicle_magnetometer");
|
add_topic("vehicle_magnetometer");
|
||||||
add_topic("vehicle_status");
|
add_topic("vehicle_status");
|
||||||
add_topic("vehicle_visual_odometry");
|
add_topic("vehicle_visual_odometry");
|
||||||
add_topic("aux_global_position");
|
add_topic_multi("aux_global_position");
|
||||||
add_topic_multi("distance_sensor");
|
add_topic_multi("distance_sensor");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include <uORB/topics/vehicle_global_position.h>
|
#include <uORB/topics/aux_global_position.h>
|
||||||
|
|
||||||
class MavlinkStreamGLobalPosition : public MavlinkStream
|
class MavlinkStreamGLobalPosition : public MavlinkStream
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -54,6 +54,7 @@
|
|||||||
#include <uORB/topics/vehicle_optical_flow.h>
|
#include <uORB/topics/vehicle_optical_flow.h>
|
||||||
#include <uORB/topics/vehicle_status.h>
|
#include <uORB/topics/vehicle_status.h>
|
||||||
#include <uORB/topics/vehicle_odometry.h>
|
#include <uORB/topics/vehicle_odometry.h>
|
||||||
|
#include <uORB/topics/aux_global_position.h>
|
||||||
|
|
||||||
#include "ReplayEkf2.hpp"
|
#include "ReplayEkf2.hpp"
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ publications:
|
|||||||
|
|
||||||
- topic: /fmu/out/transponder_report
|
- topic: /fmu/out/transponder_report
|
||||||
type: px4_msgs::msg::TransponderReport
|
type: px4_msgs::msg::TransponderReport
|
||||||
|
|
||||||
# - topic: /fmu/out/vehicle_angular_velocity
|
# - topic: /fmu/out/vehicle_angular_velocity
|
||||||
# type: px4_msgs::msg::VehicleAngularVelocity
|
# type: px4_msgs::msg::VehicleAngularVelocity
|
||||||
|
|
||||||
@@ -191,7 +191,7 @@ subscriptions:
|
|||||||
type: px4_msgs::msg::ActuatorServos
|
type: px4_msgs::msg::ActuatorServos
|
||||||
|
|
||||||
- topic: /fmu/in/aux_global_position
|
- topic: /fmu/in/aux_global_position
|
||||||
type: px4_msgs::msg::VehicleGlobalPosition
|
type: px4_msgs::msg::AuxGlobalPosition
|
||||||
|
|
||||||
- topic: /fmu/in/fixed_wing_longitudinal_setpoint
|
- topic: /fmu/in/fixed_wing_longitudinal_setpoint
|
||||||
type: px4_msgs::msg::FixedWingLongitudinalSetpoint
|
type: px4_msgs::msg::FixedWingLongitudinalSetpoint
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ subscriptions:
|
|||||||
type: px4_msgs::msg::ActuatorServos
|
type: px4_msgs::msg::ActuatorServos
|
||||||
|
|
||||||
- topic: /fmu/in/aux_global_position
|
- topic: /fmu/in/aux_global_position
|
||||||
type: px4_msgs::msg::VehicleGlobalPosition
|
type: px4_msgs::msg::AuxGlobalPosition
|
||||||
|
|
||||||
# Create uORB::PublicationMulti
|
# Create uORB::PublicationMulti
|
||||||
subscriptions_multi:
|
subscriptions_multi:
|
||||||
|
|||||||
Reference in New Issue
Block a user