mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-03 20:40:36 +08:00
FlightTaskAuto: add comments and fix variable naming convention
This commit is contained in:
@@ -201,11 +201,10 @@ bool FlightTaskAuto::_evaluateTriplets()
|
||||
}
|
||||
|
||||
// Calculate the current vehicle state and check if it has updated.
|
||||
State _previous_state = _current_state;
|
||||
State previous_state = _current_state;
|
||||
_current_state = _getCurrentState();
|
||||
bool state_update = (_current_state != _previous_state) ? true : false;
|
||||
|
||||
if (triplet_update || state_update) {
|
||||
if (triplet_update || (_current_state != previous_state)) {
|
||||
_updateInternalWaypoints();
|
||||
}
|
||||
|
||||
@@ -276,6 +275,7 @@ State FlightTaskAuto::_getCurrentState()
|
||||
Vector2f u_prev_to_target = Vector2f(&(_triplet_target - _triplet_prev_wp)(0)).unit_or_zero();
|
||||
Vector2f pos_to_target = Vector2f(&(_triplet_target - _position)(0));
|
||||
Vector2f prev_to_pos = Vector2f(&(_position - _triplet_prev_wp)(0));
|
||||
// Calculate the closest point to the vehicle position on the line prev_wp - target
|
||||
_closest_pt = Vector2f(&_triplet_prev_wp(0)) + u_prev_to_target * (prev_to_pos * u_prev_to_target);
|
||||
|
||||
State return_state = State::none;
|
||||
|
||||
@@ -109,11 +109,10 @@ private:
|
||||
|
||||
uORB::Subscription<position_setpoint_triplet_s> *_sub_triplet_setpoint{nullptr};
|
||||
|
||||
matrix::Vector3f _triplet_target;
|
||||
matrix::Vector3f _triplet_prev_wp;
|
||||
matrix::Vector3f _triplet_next_wp;
|
||||
matrix::Vector2f _closest_pt;
|
||||
|
||||
matrix::Vector3f _triplet_target; /**< current triplet from navigator which may differ from the intenal one (_target) depending on the vehicle state. */
|
||||
matrix::Vector3f _triplet_prev_wp; /**< previous triplet from navigator which may differ from the intenal one (_prev_wp) depending on the vehicle state.*/
|
||||
matrix::Vector3f _triplet_next_wp; /**< next triplet from navigator which may differ from the intenal one (_next_wp) depending on the vehicle state.*/
|
||||
matrix::Vector2f _closest_pt; /**< closest point to the vehicle position on the line previous - target */
|
||||
|
||||
map_projection_reference_s _reference_position{}; /**< Structure used to project lat/lon setpoint into local frame. */
|
||||
float _reference_altitude = NAN; /**< Altitude relative to ground. */
|
||||
@@ -123,5 +122,5 @@ private:
|
||||
bool _isFinite(const position_setpoint_s sp); /**< Checks if all waypoint triplets are finite. */
|
||||
bool _evaluateGlobalReference(); /**< Check is global reference is available. */
|
||||
float _getVelocityFromAngle(const float angle); /**< Computes the speed at target depending on angle. */
|
||||
State _getCurrentState();
|
||||
State _getCurrentState(); /**< Computes the current vehicle state based on the vehicle position and navigator triplets. */
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user