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

Plane: tailsitter start forward transition from initial pitch #16294

Merged
merged 1 commit into from Jan 18, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 2 additions & 5 deletions ArduPlane/quadplane.cpp
Expand Up @@ -1903,10 +1903,7 @@ void QuadPlane::update_transition(void)
// in half the transition time
float transition_rate = tailsitter.transition_angle / float(transition_time_ms/2);
uint32_t dt = now - transition_start_ms;
float pitch_cd;
pitch_cd = constrain_float((-transition_rate * dt)*100, -8500, 0);
// if already pitched forward at start of transition, wait until curve catches up
plane.nav_pitch_cd = (pitch_cd > transition_initial_pitch)? transition_initial_pitch : pitch_cd;
plane.nav_pitch_cd = constrain_float(transition_initial_pitch - (transition_rate * dt)*100, -8500, 8500);
Copy link
Contributor

Choose a reason for hiding this comment

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

don't you need to take initial pitch into account when calculating the transition rate here?

Copy link
Member Author

Choose a reason for hiding this comment

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

sorry, I don't follow?

Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't the transition_rate calculation assume initial pitch is zero?

Copy link
Member Author

Choose a reason for hiding this comment

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

We have the true initial pitch in the calculation,transition_initial_pitch

plane.nav_roll_cd = 0;
check_attitude_relax();
attitude_control->input_euler_angle_roll_pitch_euler_rate_yaw(plane.nav_roll_cd,
Expand Down Expand Up @@ -2028,7 +2025,7 @@ void QuadPlane::update(void)
*/
transition_state = TRANSITION_ANGLE_WAIT_FW;
transition_start_ms = now;
transition_initial_pitch= constrain_float(ahrs_view->pitch_sensor,-8500,0);
transition_initial_pitch = constrain_float(ahrs_view->pitch_sensor,-8500,8500);
} else {
/*
setup for airspeed wait for later
Expand Down