Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FlightTaskManualAltitude: Follow altitude limit given by the estimator #13958

Merged
merged 6 commits into from
Feb 3, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
FlightTaskManualAltitude: Follow altitude limit given by the estimator
bresch committed Jan 15, 2020
commit 121db15657c8f372707a95db52b935ddefe052fc
Original file line number Diff line number Diff line change
@@ -61,6 +61,16 @@ bool FlightTaskManualAltitude::activate(vehicle_local_position_setpoint_s last_s

_constraints.tilt = math::radians(_param_mpc_man_tilt_max.get());

_updateConstraintsFromEstimator();

_max_speed_up = _constraints.speed_up;
_min_speed_down = _constraints.speed_down;
Copy link
Member

@MaEtUgR MaEtUgR Jan 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_min_speed_down = _constraints.speed_down;
_max_speed_down = _constraints.speed_down;

The name confuses me since if I read min_speed_down I'm assuming you have to fly a certain minimum speed to descend... well, it wasn't your decision.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally agree, I made a 2nd commit to rename that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MaEtUgR Can you approve again please?


return ret;
}

void FlightTaskManualAltitude::_updateConstraintsFromEstimator()
{
if (PX4_ISFINITE(_sub_vehicle_local_position.get().hagl_min)) {
_constraints.min_distance_to_ground = _sub_vehicle_local_position.get().hagl_min;

@@ -74,11 +84,6 @@ bool FlightTaskManualAltitude::activate(vehicle_local_position_setpoint_s last_s
} else {
_constraints.max_distance_to_ground = INFINITY;
}

_max_speed_up = _constraints.speed_up;
_min_speed_down = _constraints.speed_down;

return ret;
}

void FlightTaskManualAltitude::_scaleSticks()
@@ -359,6 +364,7 @@ bool FlightTaskManualAltitude::_checkTakeoff()

bool FlightTaskManualAltitude::update()
{
_updateConstraintsFromEstimator();
_scaleSticks();
_updateSetpoints();
_constraints.want_takeoff = _checkTakeoff();
Original file line number Diff line number Diff line change
@@ -56,6 +56,7 @@ class FlightTaskManualAltitude : public FlightTaskManual
virtual void _updateSetpoints(); /**< updates all setpoints */
virtual void _scaleSticks(); /**< scales sticks to velocity in z */
bool _checkTakeoff() override;
void _updateConstraintsFromEstimator();

/**
* rotates vector into local frame