mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-06 09:51:35 +08:00
FlightTask: comment fixes
This commit is contained in:
committed by
Lorenz Meier
parent
c6b5731086
commit
e2ac12ef2c
@@ -2,7 +2,6 @@
|
|||||||
#include <mathlib/mathlib.h>
|
#include <mathlib/mathlib.h>
|
||||||
|
|
||||||
constexpr uint64_t FlightTask::_timeout;
|
constexpr uint64_t FlightTask::_timeout;
|
||||||
|
|
||||||
/* First index of empty_setpoint corresponds to time-stamp and requires a finite number. */
|
/* First index of empty_setpoint corresponds to time-stamp and requires a finite number. */
|
||||||
const vehicle_local_position_setpoint_s FlightTask::empty_setpoint = {0, NAN, NAN, NAN, NAN, NAN, NAN, NAN, NAN, NAN, NAN, NAN, {NAN, NAN, NAN}};
|
const vehicle_local_position_setpoint_s FlightTask::empty_setpoint = {0, NAN, NAN, NAN, NAN, NAN, NAN, NAN, NAN, NAN, NAN, NAN, {NAN, NAN, NAN}};
|
||||||
|
|
||||||
@@ -60,7 +59,6 @@ bool FlightTask::_evaluateVehicleLocalPosition()
|
|||||||
_position = matrix::Vector3f(&_sub_vehicle_local_position->get().x);
|
_position = matrix::Vector3f(&_sub_vehicle_local_position->get().x);
|
||||||
_velocity = matrix::Vector3f(&_sub_vehicle_local_position->get().vx);
|
_velocity = matrix::Vector3f(&_sub_vehicle_local_position->get().vx);
|
||||||
_yaw = _sub_vehicle_local_position->get().yaw;
|
_yaw = _sub_vehicle_local_position->get().yaw;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -132,12 +132,6 @@ protected:
|
|||||||
*/
|
*/
|
||||||
void _resetSetpoints();
|
void _resetSetpoints();
|
||||||
|
|
||||||
/**
|
|
||||||
* Vehicle local position subscription
|
|
||||||
* TODO: Implement a message that is smaller than the
|
|
||||||
* current vehicle local position message
|
|
||||||
*/
|
|
||||||
uORB::Subscription<vehicle_local_position_s> *_sub_vehicle_local_position{nullptr};
|
uORB::Subscription<vehicle_local_position_s> *_sub_vehicle_local_position{nullptr};
|
||||||
|
|
||||||
bool _evaluateVehicleLocalPosition();
|
bool _evaluateVehicleLocalPosition();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
*
|
*
|
||||||
* Copyright (c) 2017 PX4 Development Team. All rights reserved.
|
* Copyright (c) 2018 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
|
||||||
@@ -45,7 +45,9 @@
|
|||||||
#include <uORB/topics/position_setpoint.h>
|
#include <uORB/topics/position_setpoint.h>
|
||||||
#include <lib/geo/geo.h>
|
#include <lib/geo/geo.h>
|
||||||
|
|
||||||
/* This enum has to agree with position_setpoint_s type definition */
|
/* This enum has to agree with position_setpoint_s type definition
|
||||||
|
* The only reason for not using the struct position_setpoint is because
|
||||||
|
* of the size */
|
||||||
enum class WaypointType : int {
|
enum class WaypointType : int {
|
||||||
position = 0,
|
position = 0,
|
||||||
velocity,
|
velocity,
|
||||||
@@ -69,27 +71,24 @@ public:
|
|||||||
bool updateInitialize() override;
|
bool updateInitialize() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
matrix::Vector3f _prev_prev_wp{}; /**< Pre-previous waypoint (local frame). This will be used for smoothing trajectories -> not used yet. */
|
||||||
matrix::Vector3f _prev_prev_wp{}; /**< Triplet previous-previous triplet. This will be used for smoothing trajectories -> not used yet. */
|
matrix::Vector3f _prev_wp{}; /**< Previous waypoint (local frame). If no previous triplet is available, the prev_wp is set to current position. */
|
||||||
matrix::Vector3f _prev_wp{}; /**< Triplet previous setpoint in local frame. If not previous triplet is available, the prev_wp is set to current position. */
|
matrix::Vector3f _target{}; /**< Target waypoint (local frame).*/
|
||||||
matrix::Vector3f _target{}; /**< Triplet target setpoint in local frame. */
|
matrix::Vector3f _next_wp{}; /**< The next waypoint after target (local frame). If no next setpoint is available, next is set to target. */
|
||||||
matrix::Vector3f _next_wp{}; /**< Triplet setpoint in local frame. If no next setpoint is available, next is set to target. */
|
float _yaw_wp{0.0f}; /**< Triplet yaw waypoint. Currently it is not a yaw-waypoint, but rather a yaw setpoint at each time stamp. */
|
||||||
float _yaw_wp{0.0f}; /**< Triplet yaw waypoint. Unfortunately navigator sends yaw setpoint continuously. It would be better if a yaw setpoint is attached
|
float _mc_cruise_speed{0.0f}; /**< Requested cruise speed. If not valid, default cruise speed is used. */
|
||||||
to triplet waypoint. This way it would be easy for multicopter to implement features where yaw does not matter. */
|
|
||||||
float _mc_cruise_speed{0.0f}; /**< Cruise speed with which multicopter flies and gets set by triplet. If no valid, default cruise speed is used. */
|
|
||||||
WaypointType _type{WaypointType::idle}; /**< Type of current target triplet. */
|
WaypointType _type{WaypointType::idle}; /**< Type of current target triplet. */
|
||||||
|
|
||||||
private:
|
private:
|
||||||
control::BlockParamFloat _mc_cruise_default; /**< Default mc cruise speed*/
|
control::BlockParamFloat _mc_cruise_default; /**< Default mc cruise speed.*/
|
||||||
map_projection_reference_s _reference; /**< Reference frame from global to local */
|
map_projection_reference_s _reference; /**< Reference frame from global to local. */
|
||||||
uORB::Subscription<position_setpoint_triplet_s> *_sub_triplet_setpoint{nullptr};
|
uORB::Subscription<position_setpoint_triplet_s> *_sub_triplet_setpoint{nullptr};
|
||||||
map_projection_reference_s _reference_position{}; /**< Structure used to project lat/lon setpoint into local frame */
|
map_projection_reference_s _reference_position{}; /**< Structure used to project lat/lon setpoint into local frame. */
|
||||||
float _reference_altitude = 0.0f; /**< Altitude relative to ground */
|
float _reference_altitude = 0.0f; /**< Altitude relative to ground. */
|
||||||
hrt_abstime _time_stamp_reference = 0; /**< time stamp when last reference update */
|
hrt_abstime _time_stamp_reference = 0; /**< time stamp when last reference update occured. */
|
||||||
|
|
||||||
bool _evaluateTriplets(); /**< Checks and sets triplets */
|
bool _evaluateTriplets(); /**< Checks and sets triplets. */
|
||||||
bool _isFinite(const position_setpoint_s sp);
|
bool _isFinite(const position_setpoint_s sp); /**< Checks if all waypoint triplets are finite. */
|
||||||
void _updateReference();
|
void _updateReference(); /**< Updates the local reference. */
|
||||||
|
void _evaluateVehicleGlobalPosition(); /**< Checks if global position is valid. */
|
||||||
void _evaluateVehicleGlobalPosition(); /**< Required for reference update */
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ bool FlightTaskAutoLine::update()
|
|||||||
bool follow_line = _type == WaypointType::loiter || _type == WaypointType::position;
|
bool follow_line = _type == WaypointType::loiter || _type == WaypointType::position;
|
||||||
bool follow_line_prev = _type_previous == WaypointType::loiter || _type_previous == WaypointType::position;
|
bool follow_line_prev = _type_previous == WaypointType::loiter || _type_previous == WaypointType::position;
|
||||||
|
|
||||||
/* 1st time that vehicle starts to follow line. Reset all setpoints to current vehicle state */
|
/* 1st time that vehicle starts to follow line. Reset all setpoints to current vehicle state. */
|
||||||
if (follow_line && !follow_line_prev) {
|
if (follow_line && !follow_line_prev) {
|
||||||
_reset();
|
_reset();
|
||||||
}
|
}
|
||||||
@@ -100,8 +100,8 @@ bool FlightTaskAutoLine::update()
|
|||||||
|
|
||||||
/* For now yaw setpoint comes directly form triplets.
|
/* For now yaw setpoint comes directly form triplets.
|
||||||
* TODO: In the future, however, yaw should be set in this
|
* TODO: In the future, however, yaw should be set in this
|
||||||
* task based on flag: yaw along path, yaw along gimbal, yaw
|
* task based on flag: yaw along path, yaw based on gimbal, yaw
|
||||||
* same as during home... */
|
* same as home yaw ... */
|
||||||
_yaw_setpoint = _yaw_wp;
|
_yaw_setpoint = _yaw_wp;
|
||||||
|
|
||||||
/* Update previous type */
|
/* Update previous type */
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
*
|
*
|
||||||
* Copyright (c) 2017 PX4 Development Team. All rights reserved.
|
* Copyright (c) 2018 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
|
||||||
|
|||||||
@@ -227,10 +227,6 @@ void PositionControl::_velocityController(const float &dt)
|
|||||||
|
|
||||||
Vector3f vel_err = _vel_sp - _vel;
|
Vector3f vel_err = _vel_sp - _vel;
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: add offboard acceleration mode
|
|
||||||
* */
|
|
||||||
|
|
||||||
/* Consider thrust in D-direction */
|
/* Consider thrust in D-direction */
|
||||||
float thrust_desired_D = Pv(2) * vel_err(2) + Dv(2) * _vel_dot(2) + _thr_int(2) - _ThrHover;
|
float thrust_desired_D = Pv(2) * vel_err(2) + Dv(2) * _vel_dot(2) + _thr_int(2) - _ThrHover;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user