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

Enable acceleration setpoint based takeoff #15707

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 8 additions & 1 deletion src/lib/flight_tasks/tasks/FlightTask/FlightTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,5 +203,12 @@ bool FlightTask::_checkTakeoff()
velocity_triggered_takeoff = _velocity_setpoint(2) < -0.3f;
}

return position_triggered_takeoff || velocity_triggered_takeoff;
// upwards acceleration setpoint
bool acceleration_triggered_takeoff = false;

if (PX4_ISFINITE(_acceleration_setpoint(2))) {
acceleration_triggered_takeoff = _acceleration_setpoint(2) < -0.3f;
Copy link
Member

Choose a reason for hiding this comment

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

Can you document this magic number?

}

return position_triggered_takeoff || velocity_triggered_takeoff || acceleration_triggered_takeoff;
}
2 changes: 1 addition & 1 deletion src/modules/commander/Commander.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3322,7 +3322,7 @@ Commander::update_control_mode()
!control_mode.flag_control_acceleration_enabled;

control_mode.flag_control_climb_rate_enabled = (!offboard_control_mode.ignore_velocity ||
!offboard_control_mode.ignore_position) && !control_mode.flag_control_acceleration_enabled;
!offboard_control_mode.ignore_position);

control_mode.flag_control_position_enabled = !offboard_control_mode.ignore_position && !status.in_transition_mode &&
!control_mode.flag_control_acceleration_enabled;
Expand Down