mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-25 01:33:34 +08:00
fw l1 controller: added a flag to indicate if navigation has updated
- can be used to check if l1 controller ran during a cycle Signed-off-by: RomanBapst <bapstroman@gmail.com>
This commit is contained in:
committed by
Silvan Fuhrer
parent
e2f048f608
commit
ae5d3103f4
@@ -76,6 +76,8 @@ void
|
|||||||
ECL_L1_Pos_Controller::navigate_waypoints(const Vector2d &vector_A, const Vector2d &vector_B,
|
ECL_L1_Pos_Controller::navigate_waypoints(const Vector2d &vector_A, const Vector2d &vector_B,
|
||||||
const Vector2d &vector_curr_position, const Vector2f &ground_speed_vector)
|
const Vector2d &vector_curr_position, const Vector2f &ground_speed_vector)
|
||||||
{
|
{
|
||||||
|
_has_guidance_updated = true;
|
||||||
|
|
||||||
/* this follows the logic presented in [1] */
|
/* this follows the logic presented in [1] */
|
||||||
float eta = 0.0f;
|
float eta = 0.0f;
|
||||||
|
|
||||||
@@ -211,6 +213,8 @@ void
|
|||||||
ECL_L1_Pos_Controller::navigate_loiter(const Vector2d &vector_A, const Vector2d &vector_curr_position, float radius,
|
ECL_L1_Pos_Controller::navigate_loiter(const Vector2d &vector_A, const Vector2d &vector_curr_position, float radius,
|
||||||
int8_t loiter_direction, const Vector2f &ground_speed_vector)
|
int8_t loiter_direction, const Vector2f &ground_speed_vector)
|
||||||
{
|
{
|
||||||
|
_has_guidance_updated = true;
|
||||||
|
|
||||||
/* the complete guidance logic in this section was proposed by [2] */
|
/* the complete guidance logic in this section was proposed by [2] */
|
||||||
|
|
||||||
/* calculate the gains for the PD loop (circle tracking) */
|
/* calculate the gains for the PD loop (circle tracking) */
|
||||||
@@ -312,6 +316,8 @@ ECL_L1_Pos_Controller::navigate_loiter(const Vector2d &vector_A, const Vector2d
|
|||||||
void ECL_L1_Pos_Controller::navigate_heading(float navigation_heading, float current_heading,
|
void ECL_L1_Pos_Controller::navigate_heading(float navigation_heading, float current_heading,
|
||||||
const Vector2f &ground_speed_vector)
|
const Vector2f &ground_speed_vector)
|
||||||
{
|
{
|
||||||
|
_has_guidance_updated = true;
|
||||||
|
|
||||||
/* the complete guidance logic in this section was proposed by [2] */
|
/* the complete guidance logic in this section was proposed by [2] */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -348,6 +354,8 @@ void ECL_L1_Pos_Controller::navigate_heading(float navigation_heading, float cur
|
|||||||
|
|
||||||
void ECL_L1_Pos_Controller::navigate_level_flight(float current_heading)
|
void ECL_L1_Pos_Controller::navigate_level_flight(float current_heading)
|
||||||
{
|
{
|
||||||
|
_has_guidance_updated = true;
|
||||||
|
|
||||||
/* the logic in this section is trivial, but originally proposed by [2] */
|
/* the logic in this section is trivial, but originally proposed by [2] */
|
||||||
|
|
||||||
/* reset all heading / error measures resulting in zero roll */
|
/* reset all heading / error measures resulting in zero roll */
|
||||||
|
|||||||
@@ -203,6 +203,10 @@ public:
|
|||||||
*/
|
*/
|
||||||
void set_dt(float dt) { _dt = dt;}
|
void set_dt(float dt) { _dt = dt;}
|
||||||
|
|
||||||
|
void reset_has_guidance_updated() { _has_guidance_updated = false; }
|
||||||
|
|
||||||
|
bool has_guidance_updated() { return _has_guidance_updated; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
float _lateral_accel{0.0f}; ///< Lateral acceleration setpoint in m/s^2
|
float _lateral_accel{0.0f}; ///< Lateral acceleration setpoint in m/s^2
|
||||||
@@ -224,6 +228,9 @@ private:
|
|||||||
float _roll_slew_rate{0.0f}; ///< roll angle setpoint slew rate limit in rad/s
|
float _roll_slew_rate{0.0f}; ///< roll angle setpoint slew rate limit in rad/s
|
||||||
float _dt{0}; ///< control loop time in seconds
|
float _dt{0}; ///< control loop time in seconds
|
||||||
|
|
||||||
|
bool _has_guidance_updated =
|
||||||
|
false; ///< this flag is set to true by any of the guidance methods. This flag has to be manually reset using has_guidance_updated_reset()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a 2D vector from WGS84 to planar coordinates.
|
* Convert a 2D vector from WGS84 to planar coordinates.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user