mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-08 06:41:36 +08:00
rename to just FightTaskl
This commit is contained in:
@@ -40,7 +40,7 @@
|
||||
set(flight_tasks_all)
|
||||
list(APPEND flight_tasks_all
|
||||
Auto
|
||||
AutoPrecisionLanding
|
||||
PrecisionLanding
|
||||
Descend
|
||||
Failsafe
|
||||
ManualAcceleration
|
||||
|
||||
@@ -179,7 +179,7 @@ void FlightModeManager::start_flight_task()
|
||||
// Take-over landing from navigator if precision landing is enabled
|
||||
should_disable_task = false;
|
||||
|
||||
if (switchTask(FlightTaskIndex::AutoPrecisionLanding) != FlightTaskError::NoError) {
|
||||
if (switchTask(FlightTaskIndex::PrecisionLanding) != FlightTaskError::NoError) {
|
||||
PX4_INFO("Switching to precland flight task");
|
||||
task_failure = true;
|
||||
}
|
||||
|
||||
+4
-4
@@ -31,9 +31,9 @@
|
||||
#
|
||||
############################################################################
|
||||
|
||||
px4_add_library(FlightTaskAutoPrecisionLanding
|
||||
FlightTaskAutoPrecisionLanding.cpp
|
||||
px4_add_library(FlightTaskPrecisionLanding
|
||||
FlightTaskPrecisionLanding.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(FlightTaskAutoPrecisionLanding PUBLIC FlightTaskAuto)
|
||||
target_include_directories(FlightTaskAutoPrecisionLanding PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_link_libraries(FlightTaskPrecisionLanding PUBLIC FlightTask)
|
||||
target_include_directories(FlightTaskPrecisionLanding PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
+11
-10
@@ -32,15 +32,16 @@
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file FlightTaskAutoPrecisionLanding.cpp
|
||||
* @file FlightTaskPrecisionLanding.cpp
|
||||
*
|
||||
*/
|
||||
|
||||
#include "FlightTaskAutoPrecisionLanding.hpp"
|
||||
#include "FlightTaskPrecisionLanding.hpp"
|
||||
#include <mathlib/mathlib.h>
|
||||
|
||||
using namespace matrix;
|
||||
|
||||
bool FlightTaskAutoPrecisionLanding::activate(const trajectory_setpoint_s &last_setpoint)
|
||||
bool FlightTaskPrecisionLanding::activate(const trajectory_setpoint_s &last_setpoint)
|
||||
{
|
||||
bool ret = FlightTask::activate(last_setpoint);
|
||||
PX4_INFO("precland activated");
|
||||
@@ -57,19 +58,19 @@ bool FlightTaskAutoPrecisionLanding::activate(const trajectory_setpoint_s &last_
|
||||
return ret;
|
||||
}
|
||||
|
||||
void FlightTaskAutoPrecisionLanding::do_state_transition(PRECLAND_STATE new_state)
|
||||
void FlightTaskPrecisionLanding::do_state_transition(PRECLAND_STATE new_state)
|
||||
{
|
||||
_precland_state = new_state;
|
||||
_state_start_time = hrt_absolute_time();
|
||||
}
|
||||
|
||||
bool FlightTaskAutoPrecisionLanding::inside_acceptance_radius()
|
||||
bool FlightTaskPrecisionLanding::inside_acceptance_radius()
|
||||
{
|
||||
// TODO: Reuse what FlightTaskAuto has...
|
||||
return Vector3f(_position_setpoint - _position).norm() <= _param_pld_hacc_rad.get();
|
||||
// TODO: Reuse what FlightTask has...
|
||||
return matrix::Vector3f(_position_setpoint - _position).norm() <= _param_pld_hacc_rad.get();
|
||||
}
|
||||
|
||||
bool FlightTaskAutoPrecisionLanding::precision_target_available()
|
||||
bool FlightTaskPrecisionLanding::precision_target_available()
|
||||
{
|
||||
// TODO: Add timeout
|
||||
const bool ever_received = _landing_target_pose.timestamp != 0;
|
||||
@@ -77,9 +78,9 @@ bool FlightTaskAutoPrecisionLanding::precision_target_available()
|
||||
return ever_received && !timed_out;
|
||||
}
|
||||
|
||||
bool FlightTaskAutoPrecisionLanding::update()
|
||||
bool FlightTaskPrecisionLanding::update()
|
||||
{
|
||||
// Get setpoints from FlightTaskAuto and later override if necessary
|
||||
// Get setpoints from FlightTask and later override if necessary
|
||||
bool ret = FlightTask::update();
|
||||
|
||||
// Fetch uorb
|
||||
+7
-6
@@ -32,14 +32,14 @@
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file FlightTaskAutoPrecisionLanding.hpp
|
||||
* @file FlightTaskPrecisionLanding.hpp
|
||||
*
|
||||
* Flight task for better precision landing
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "FlightTaskAuto.hpp"
|
||||
#include "FlightTask.hpp"
|
||||
#include <uORB/PublicationMulti.hpp>
|
||||
#include <uORB/topics/landing_target_pose.h>
|
||||
#include <uORB/topics/precision_landing_status.h>
|
||||
@@ -48,16 +48,17 @@
|
||||
#include <uORB/topics/follow_target_estimator.h>
|
||||
// #include <lib/ecl/geo/geo.h>
|
||||
#include <mathlib/mathlib.h>
|
||||
#include <lib/matrix/matrix/math.hpp>
|
||||
|
||||
// TODO: Get the correct define from some header
|
||||
#define SEC2USEC 1000000.0f
|
||||
#define HOVER_SPEED_THRESHOLD 0.20f // If drone has speed under this value it is considered to be hovering in place
|
||||
|
||||
class FlightTaskAutoPrecisionLanding : public FlightTask
|
||||
class FlightTaskPrecisionLanding : public FlightTask
|
||||
{
|
||||
public:
|
||||
FlightTaskAutoPrecisionLanding() = default;
|
||||
virtual ~FlightTaskAutoPrecisionLanding() = default;
|
||||
FlightTaskPrecisionLanding() = default;
|
||||
virtual ~FlightTaskPrecisionLanding() = default;
|
||||
|
||||
bool activate(const trajectory_setpoint_s &last_setpoint) override;
|
||||
|
||||
@@ -102,7 +103,7 @@ private:
|
||||
int _search_count = 0;
|
||||
float _initial_yaw;
|
||||
float _target_yaw;
|
||||
Vector3f _initial_position;
|
||||
matrix::Vector3f _initial_position;
|
||||
|
||||
orb_advert_t _mavlink_log_pub{nullptr};
|
||||
matrix::Vector3f _precision_target_ned = {NAN, NAN, NAN};
|
||||
Reference in New Issue
Block a user