mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-06 11:58:53 +08:00
addressed comments from review
Signed-off-by: Roman <bapstroman@gmail.com>
This commit is contained in:
@@ -129,7 +129,7 @@ public:
|
||||
/**
|
||||
* Sets an external yaw handler. The active flight task can use the yaw handler to implement a different yaw control strategy.
|
||||
*/
|
||||
void set_yaw_handler(WeatherVane *ext_yaw_handler) {_current_task.task->set_yaw_handler(ext_yaw_handler);}
|
||||
void setYawHandler(WeatherVane *ext_yaw_handler) {_current_task.task->setYawHandler(ext_yaw_handler);}
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -193,7 +193,11 @@ bool FlightTaskAuto::_evaluateTriplets()
|
||||
}
|
||||
|
||||
// set heading
|
||||
if (_type == WaypointType::follow_target && _sub_triplet_setpoint->get().current.yawspeed_valid) {
|
||||
if (_ext_yaw_handler != nullptr && _ext_yaw_handler->is_active()) {
|
||||
_yaw_setpoint = _yaw;
|
||||
_yawspeed_setpoint = _ext_yaw_handler->get_weathervane_yawrate();
|
||||
|
||||
} else if (_type == WaypointType::follow_target && _sub_triplet_setpoint->get().current.yawspeed_valid) {
|
||||
_yawspeed_setpoint = _sub_triplet_setpoint->get().current.yawspeed;
|
||||
_yaw_setpoint = NAN;
|
||||
|
||||
|
||||
@@ -78,6 +78,11 @@ public:
|
||||
bool activate() override;
|
||||
bool updateInitialize() override;
|
||||
|
||||
/**
|
||||
* Sets an external yaw handler which can be used to implement a different yaw control strategy.
|
||||
*/
|
||||
void setYawHandler(WeatherVane *ext_yaw_handler) override {_ext_yaw_handler = ext_yaw_handler;}
|
||||
|
||||
protected:
|
||||
void _setDefaultConstraints() override;
|
||||
float _getMaxCruiseSpeed() {return MPC_XY_CRUISE.get();} /**< getter for default cruise speed */
|
||||
@@ -122,6 +127,9 @@ private:
|
||||
float _reference_altitude = NAN; /**< Altitude relative to ground. */
|
||||
hrt_abstime _time_stamp_reference = 0; /**< time stamp when last reference update occured. */
|
||||
|
||||
WeatherVane *_ext_yaw_handler =
|
||||
nullptr; /**< external weathervane library, used to implement a yaw control law that turns the vehicle nose into the wind */
|
||||
|
||||
bool _evaluateTriplets(); /**< Checks and sets triplets. */
|
||||
bool _isFinite(const position_setpoint_s &sp); /**< Checks if all waypoint triplets are finite. */
|
||||
bool _evaluateGlobalReference(); /**< Check is global reference is available. */
|
||||
|
||||
@@ -62,12 +62,6 @@ bool FlightTaskAutoMapper::update()
|
||||
_reset();
|
||||
}
|
||||
|
||||
// check if an external yaw handler is active and if yes, let it compute the yaw setpoints
|
||||
if (_ext_yaw_handler != nullptr && _ext_yaw_handler->is_active()) {
|
||||
_yaw_setpoint = _yaw;
|
||||
_yawspeed_setpoint = _ext_yaw_handler->get_weathervane_yawrate();
|
||||
}
|
||||
|
||||
// The only time a thrust set-point is sent out is during
|
||||
// idle. Hence, reset thrust set-point to NAN in case the
|
||||
// vehicle exits idle.
|
||||
|
||||
@@ -50,11 +50,6 @@ public:
|
||||
bool activate() override;
|
||||
bool update() override;
|
||||
|
||||
/**
|
||||
* Sets an external yaw handler which can be used to implement a different yaw control strategy.
|
||||
*/
|
||||
void set_yaw_handler(WeatherVane *ext_yaw_handler) override {_ext_yaw_handler = ext_yaw_handler;}
|
||||
|
||||
protected:
|
||||
|
||||
float _alt_above_ground{0.0f}; /**< If home provided, then it is altitude above home, otherwise it is altitude above local position reference. */
|
||||
@@ -78,8 +73,6 @@ protected:
|
||||
void updateParams() override; /**< See ModuleParam class */
|
||||
|
||||
private:
|
||||
WeatherVane *_ext_yaw_handler =
|
||||
nullptr; /**< external weathervane library, used to implement a yaw control law that turns the vehicle nose into the wind */
|
||||
|
||||
void _reset(); /**< Resets member variables to current vehicle state */
|
||||
WaypointType _type_previous{WaypointType::idle}; /**< Previous type of current target triplet. */
|
||||
|
||||
@@ -145,7 +145,7 @@ public:
|
||||
* Sets an external yaw handler which can be used by any flight task to implement a different yaw control strategy.
|
||||
* This method does nothing, each flighttask which wants to use the yaw handler needs to override this method.
|
||||
*/
|
||||
virtual void set_yaw_handler(WeatherVane *ext_yaw_handler) {};
|
||||
virtual void setYawHandler(WeatherVane *ext_yaw_handler) {};
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
/**
|
||||
* Sets an external yaw handler which can be used to implement a different yaw control strategy.
|
||||
*/
|
||||
void set_yaw_handler(WeatherVane *ext_yaw_handler) override {_ext_yaw_handler = ext_yaw_handler;}
|
||||
void setYawHandler(WeatherVane *ext_yaw_handler) override {_ext_yaw_handler = ext_yaw_handler;}
|
||||
|
||||
protected:
|
||||
virtual void _updateSetpoints(); /**< updates all setpoints*/
|
||||
|
||||
@@ -625,7 +625,7 @@ MulticopterPositionControl::task_main()
|
||||
// setpoints from flighttask
|
||||
vehicle_local_position_setpoint_s setpoint;
|
||||
|
||||
_flight_tasks.set_yaw_handler(&_wv_controller);
|
||||
_flight_tasks.setYawHandler(&_wv_controller);
|
||||
|
||||
// update task
|
||||
if (!_flight_tasks.update()) {
|
||||
|
||||
Reference in New Issue
Block a user