Skip to content
Snippets Groups Projects
Commit d6b6a1d0 authored by Roman's avatar Roman Committed by Lorenz Meier
Browse files

addressed comments from review


Signed-off-by: default avatarRoman <bapstroman@gmail.com>
parent 4ad11484
No related branches found
No related tags found
No related merge requests found
......@@ -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()) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment