mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-26 01:17:51 +08:00
Commander: Introduce global_position_relaxed (#24280)
To separate accuracy requirements for VTOL hover and cruise. - global_position_relaxed refers to having a valid horizontal velocity aid source in the estimator and a set global reference position, but poses no requirements on the accuracy of the provided position estimate. - Auto flight modes Mission, Loiter and RTL, while in fixed-wing mode, only require the relaxed global position going forward - COM_POS_FS_EPH is thus no longer used on fixed-wing vehicles (resp. VTOL in FW) - rename failsafe_flags.local_position_accuracy_low to failsafe_flags.position_accuracy_low --------- Signed-off-by: RomanBapst <bapstroman@gmail.com> Signed-off-by: Silvan Fuhrer <silvan@auterion.com> Co-authored-by: Silvan <silvan@auterion.com>
This commit is contained in:
+1
-1
@@ -81,7 +81,7 @@ set(msg_files
|
||||
EstimatorStates.msg
|
||||
EstimatorStatus.msg
|
||||
EstimatorStatusFlags.msg
|
||||
Event.msg
|
||||
versioned/Event.msg
|
||||
FigureEightStatus.msg
|
||||
FailsafeFlags.msg
|
||||
FailureDetectorStatus.msg
|
||||
|
||||
@@ -12,6 +12,7 @@ uint32 mode_req_local_alt
|
||||
uint32 mode_req_local_position
|
||||
uint32 mode_req_local_position_relaxed
|
||||
uint32 mode_req_global_position
|
||||
uint32 mode_req_global_position_relaxed
|
||||
uint32 mode_req_mission
|
||||
uint32 mode_req_offboard_signal
|
||||
uint32 mode_req_home_position
|
||||
@@ -29,6 +30,7 @@ bool local_position_invalid # Local position estimate invalid
|
||||
bool local_position_invalid_relaxed # Local position with reduced accuracy requirements invalid (e.g. flying with optical flow)
|
||||
bool local_velocity_invalid # Local velocity estimate invalid
|
||||
bool global_position_invalid # Global position estimate invalid
|
||||
bool global_position_invalid_relaxed # Global position estimate invalid with relaxed accuracy requirements
|
||||
bool auto_mission_missing # No mission available
|
||||
bool offboard_control_signal_lost # Offboard signal lost
|
||||
bool home_position_invalid # No home position available
|
||||
@@ -48,7 +50,7 @@ bool mission_failure # Mission failure
|
||||
bool vtol_fixed_wing_system_failure # vehicle in fixed-wing system failure failsafe mode (after quad-chute)
|
||||
bool wind_limit_exceeded # Wind limit exceeded
|
||||
bool flight_time_limit_exceeded # Maximum flight time exceeded
|
||||
bool local_position_accuracy_low # Local position estimate has dropped below threshold, but is currently still declared valid
|
||||
bool position_accuracy_low # Position estimate has dropped below threshold, but is currently still declared valid
|
||||
bool navigator_failure # Navigator failed to execute a mode
|
||||
|
||||
# Failure detector
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
uint32 MESSAGE_VERSION = 0
|
||||
|
||||
uint64 timestamp # time since system start (microseconds)
|
||||
|
||||
uint8 request_id
|
||||
uint8 registration_id
|
||||
|
||||
uint8 HEALTH_COMPONENT_INDEX_NONE = 0
|
||||
|
||||
uint8 health_component_index # HEALTH_COMPONENT_INDEX_*
|
||||
bool health_component_is_present
|
||||
bool health_component_warning
|
||||
bool health_component_error
|
||||
|
||||
bool can_arm_and_run # whether arming is possible, and if it's a navigation mode, if it can run
|
||||
|
||||
uint8 num_events
|
||||
|
||||
EventV0[5] events
|
||||
|
||||
# Mode requirements
|
||||
bool mode_req_angular_velocity
|
||||
bool mode_req_attitude
|
||||
bool mode_req_local_alt
|
||||
bool mode_req_local_position
|
||||
bool mode_req_local_position_relaxed
|
||||
bool mode_req_global_position
|
||||
bool mode_req_mission
|
||||
bool mode_req_home_position
|
||||
bool mode_req_prevent_arming
|
||||
bool mode_req_manual_control
|
||||
|
||||
|
||||
uint8 ORB_QUEUE_LENGTH = 4
|
||||
@@ -0,0 +1,14 @@
|
||||
# this message is required here in the msg_old folder because other msg are depending on it
|
||||
# Events interface
|
||||
|
||||
uint32 MESSAGE_VERSION = 0
|
||||
|
||||
uint64 timestamp # time since system start (microseconds)
|
||||
|
||||
uint32 id # Event ID
|
||||
uint16 event_sequence # Event sequence number
|
||||
uint8[25] arguments # (optional) arguments, depend on event id
|
||||
|
||||
uint8 log_levels # Log levels: 4 bits MSB: internal, 4 bits LSB: external
|
||||
|
||||
uint8 ORB_QUEUE_LENGTH = 16
|
||||
@@ -13,3 +13,5 @@
|
||||
#include "translation_vehicle_status_v1.h"
|
||||
#include "translation_airspeed_validated_v1.h"
|
||||
#include "translation_vehicle_attitude_setpoint_v1.h"
|
||||
#include "translation_arming_check_reply_v1.h"
|
||||
#include "translation_event_v1.h"
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
/****************************************************************************
|
||||
* Copyright (c) 2025 PX4 Development Team.
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
// Translate ArmingCheckReply v0 <--> v1
|
||||
#include <px4_msgs_old/msg/arming_check_reply_v0.hpp>
|
||||
#include <px4_msgs/msg/arming_check_reply.hpp>
|
||||
#include "translation_event_v1.h"
|
||||
|
||||
class ArmingCheckReplyV1Translation {
|
||||
public:
|
||||
using MessageOlder = px4_msgs_old::msg::ArmingCheckReplyV0;
|
||||
static_assert(MessageOlder::MESSAGE_VERSION == 0);
|
||||
|
||||
using MessageNewer = px4_msgs::msg::ArmingCheckReply;
|
||||
static_assert(MessageNewer::MESSAGE_VERSION == 1);
|
||||
|
||||
static constexpr const char* kTopic = "/fmu/in/arming_check_reply";
|
||||
|
||||
static void fromOlder(const MessageOlder &msg_older, MessageNewer &msg_newer) {
|
||||
msg_newer.timestamp = msg_older.timestamp;
|
||||
|
||||
msg_newer.request_id = msg_older.request_id;
|
||||
msg_newer.registration_id = msg_older.registration_id;
|
||||
|
||||
msg_newer.health_component_index = msg_older.health_component_index;
|
||||
msg_newer.health_component_is_present = msg_older.health_component_is_present;
|
||||
msg_newer.health_component_warning = msg_older.health_component_warning;
|
||||
msg_newer.health_component_error = msg_older.health_component_error;
|
||||
|
||||
msg_newer.can_arm_and_run = msg_older.can_arm_and_run;
|
||||
|
||||
|
||||
for (std::size_t i = 0; i < msg_newer.events.size();i++) {
|
||||
EventV1Translation::fromOlder(msg_older.events.at(i), msg_newer.events.at(i));
|
||||
}
|
||||
|
||||
|
||||
msg_newer.mode_req_angular_velocity = msg_older.mode_req_angular_velocity;
|
||||
msg_newer.mode_req_attitude = msg_older.mode_req_attitude;
|
||||
msg_newer.mode_req_local_alt = msg_older.mode_req_local_alt;
|
||||
msg_newer.mode_req_local_position = msg_older.mode_req_local_position;
|
||||
msg_newer.mode_req_local_position_relaxed = msg_older.mode_req_local_position_relaxed;
|
||||
msg_newer.mode_req_global_position = msg_older.mode_req_global_position;
|
||||
msg_newer.mode_req_global_position_relaxed = false;
|
||||
msg_newer.mode_req_mission = msg_older.mode_req_mission;
|
||||
msg_newer.mode_req_home_position = msg_older.mode_req_home_position;
|
||||
msg_newer.mode_req_prevent_arming = msg_older.mode_req_prevent_arming;
|
||||
msg_newer.mode_req_manual_control = msg_older.mode_req_manual_control;
|
||||
|
||||
}
|
||||
|
||||
static void toOlder(const MessageNewer &msg_newer, MessageOlder &msg_older) {
|
||||
msg_older.timestamp = msg_newer.timestamp;
|
||||
|
||||
msg_older.request_id = msg_newer.request_id;
|
||||
msg_older.registration_id = msg_newer.registration_id;
|
||||
|
||||
msg_older.health_component_index = msg_newer.health_component_index;
|
||||
msg_older.health_component_is_present = msg_newer.health_component_is_present;
|
||||
msg_older.health_component_warning = msg_newer.health_component_warning;
|
||||
msg_older.health_component_error = msg_newer.health_component_error;
|
||||
|
||||
msg_older.can_arm_and_run = msg_newer.can_arm_and_run;
|
||||
|
||||
for (std::size_t i = 0; i < msg_older.events.size();i++) {
|
||||
EventV1Translation::toOlder(msg_newer.events.at(i), msg_older.events.at(i));
|
||||
}
|
||||
|
||||
msg_older.mode_req_angular_velocity = msg_newer.mode_req_angular_velocity;
|
||||
msg_older.mode_req_attitude = msg_newer.mode_req_attitude;
|
||||
msg_older.mode_req_local_alt = msg_newer.mode_req_local_alt;
|
||||
msg_older.mode_req_local_position = msg_newer.mode_req_local_position;
|
||||
msg_older.mode_req_global_position = msg_newer.mode_req_global_position;
|
||||
msg_older.mode_req_mission = msg_newer.mode_req_mission;
|
||||
msg_older.mode_req_home_position = msg_newer.mode_req_home_position;
|
||||
msg_older.mode_req_prevent_arming = msg_newer.mode_req_prevent_arming;
|
||||
msg_older.mode_req_manual_control = msg_newer.mode_req_manual_control;
|
||||
}
|
||||
};
|
||||
|
||||
REGISTER_TOPIC_TRANSLATION_DIRECT(ArmingCheckReplyV1Translation);
|
||||
@@ -0,0 +1,38 @@
|
||||
/****************************************************************************
|
||||
* Copyright (c) 2025 PX4 Development Team.
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
// Translate Event v0 <--> v1
|
||||
#include <px4_msgs_old/msg/event_v0.hpp>
|
||||
#include <px4_msgs/msg/event.hpp>
|
||||
|
||||
class EventV1Translation {
|
||||
public:
|
||||
using MessageOlder = px4_msgs_old::msg::EventV0;
|
||||
static_assert(MessageOlder::MESSAGE_VERSION == 0);
|
||||
|
||||
using MessageNewer = px4_msgs::msg::Event;
|
||||
static_assert(MessageNewer::MESSAGE_VERSION == 1);
|
||||
|
||||
static constexpr const char* kTopic = "fmu/out/event";
|
||||
|
||||
static void fromOlder(const MessageOlder &msg_older, MessageNewer &msg_newer) {
|
||||
msg_newer.timestamp = msg_older.timestamp;
|
||||
msg_newer.id = msg_older.id;
|
||||
msg_newer.event_sequence = msg_older.event_sequence;
|
||||
msg_newer.arguments = msg_older.arguments;
|
||||
msg_newer.log_levels = msg_older.log_levels;
|
||||
}
|
||||
|
||||
static void toOlder(const MessageNewer &msg_newer, MessageOlder &msg_older) {
|
||||
msg_older.timestamp = msg_newer.timestamp;
|
||||
msg_older.id = msg_newer.id;
|
||||
msg_older.event_sequence = msg_newer.event_sequence;
|
||||
msg_older.arguments = msg_newer.arguments;
|
||||
msg_older.log_levels = msg_newer.log_levels;
|
||||
}
|
||||
};
|
||||
|
||||
REGISTER_TOPIC_TRANSLATION_DIRECT(EventV1Translation);
|
||||
@@ -1,4 +1,4 @@
|
||||
uint32 MESSAGE_VERSION = 0
|
||||
uint32 MESSAGE_VERSION = 1
|
||||
|
||||
uint64 timestamp # time since system start (microseconds)
|
||||
|
||||
@@ -25,6 +25,7 @@ bool mode_req_local_alt
|
||||
bool mode_req_local_position
|
||||
bool mode_req_local_position_relaxed
|
||||
bool mode_req_global_position
|
||||
bool mode_req_global_position_relaxed
|
||||
bool mode_req_mission
|
||||
bool mode_req_home_position
|
||||
bool mode_req_prevent_arming
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
# Events interface
|
||||
uint32 MESSAGE_VERSION = 1
|
||||
|
||||
uint64 timestamp # time since system start (microseconds)
|
||||
|
||||
uint32 id # Event ID
|
||||
Reference in New Issue
Block a user