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

Fixed-wing pitch and roll offset clean up #16792

Merged
merged 3 commits into from
Feb 12, 2021
Merged

Conversation

sfuhrer
Copy link
Contributor

@sfuhrer sfuhrer commented Feb 8, 2021

Replaces #11845.

Describe problem solved by this pull request

  • replace minimum pitch angle set by mission item during fixed-wing takeoff by vehicle parameter (FW_TKO_PITCH_MIN)
  • apply pitch offset centrally in fw_pos_control
  • removes (unused/unnecessary) FW_RSP_OFF param

Describe your solution
The following parameters are now all referring to the same "absolute" pitch angle.

FW_P_LIM_MIN (no change for AUTO and LOITER, other modes: now absolute, before PSP_OFF was added to min after TECS)
FW_P_LIM_MAX (no change for AUTO and LOITER, other modes: now absolute, before PSP_OFF was added to max after TECS)
FW_TKO_PITCH_MIN (new param)
FW_LND_FL_PMIN (now absolute, before PSP_OFF was added after TECS)
FW_LND_FL_PMAX (now absolute, before PSP_OFF was added after TECS)
FW_MAN_P_MAX (no difference, pitch_sp = manual_input * FW_MAN_P_MAX + PSP_OFF, constrained to +/-FW_MAN_P_MAX)

"Absolute" pitch is defined as

  • for VTOL, the angle of the multicopter propeller plane relative to the ground (0 pitch for level MC flight)
  • for FW it can be more freely defined, but in general having it parallel to the wing makes most sense (adaption of FW_PSP_OFF may be necessary) (is this correct or can/should we define it closer @RomanBapst ?)

FW_PSP_OFF is the pitch angle required for level flight at trim airspeed. TECS gets the absolute pitch minus the offset, and also all the min/max parameters are used inside TECS are offset by the offset prior passing them into TECS.

Describe possible alternatives
Pass the absolute pitch angle into TECS, together with the offset parameter, and initialize the pitch (output) at the offset value.

Test data / coverage
SITL tested with VTOLs and Plane.

@sfuhrer sfuhrer requested review from dagar and RomanBapst February 8, 2021 19:33
@sfuhrer sfuhrer force-pushed the pr-FW-pitch-offset-cleanup branch from 8a036f4 to 2054b12 Compare February 8, 2021 19:34
@sfuhrer
Copy link
Contributor Author

sfuhrer commented Feb 8, 2021

Don't know exactly how/why, but this seems to fix the fixed-wing takeoff.
(#16787, #16639)
FYI @ryanjAA , please verify.

@@ -1838,17 +1836,14 @@ FixedwingPositionControl::tecs_update_pitch_throttle(const hrt_abstime &now, flo

if (_vehicle_status.engine_failure) {
/* Force the slow downwards spiral */
pitch_min_rad = M_DEG_TO_RAD_F * -1.0f;
pitch_max_rad = M_DEG_TO_RAD_F * 5.0f;
pitch_min_rad = radians(-1.0f);
Copy link
Member

@dagar dagar Feb 8, 2021

Choose a reason for hiding this comment

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

Note, we should revisit engine failure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you know of anybody that uses it actually?

Copy link
Member

Choose a reason for hiding this comment

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

I did a few years ago. I'd bet people don't even know it exists.

@dagar
Copy link
Member

dagar commented Feb 8, 2021

Thanks for finally taking care of this @sfuhrer.

FYI @Antiheavy, no more takeoff pitch via mission item (fat finger friendly).

@dagar
Copy link
Member

dagar commented Feb 8, 2021

While we're on the subject, has anyone ever actually use FW_RSP_OFF or was it added for "consistency"? It might be better to purge it.

@LorenzMeier
Copy link
Member

Purge it!

@ryanjAA
Copy link
Contributor

ryanjAA commented Feb 8, 2021

Thanks @silvan and @dagar Never used roll offset and don't really see a use.

Tested in SITL - a few things. It doesn't cause the plane to flip if it gets above 20º pitch up but its not exactly working.

It is still speeding up to ~trim speed before pitching up - I even set rwto_airspd_scl to 100 just to be sure.

Secondly you have to have the mission planning pitch set to 0 (when planning a mission) or QGC gets mad and spits out some errors (probably the intention).

On QGC 4.1.1 release when I initiate the mission I get an "unable to start mission, vehicle rejected arming" but it still arms and flies it. When I switch to QGC 4.0.11 it doesn't do that and just flies the mission.

In both cases though it still speeds up to around trim speed before pitching up but this is good that there is not more looping on takeoff.

Lastly, so how do we control the desired pitch now on takeoff? Is that RWTO_max_pitch now? On sitl having that set to 20 gives me a pitch sp of ~14º on takeoff.

@Antiheavy
Copy link
Contributor

Antiheavy commented Feb 9, 2021

FYI @Antiheavy, no more takeoff pitch via mission item (fat finger friendly).

hoooray!

has anyone ever actually use FW_RSP_OFF or was it added for "consistency"? It might be better to purge it.

I've never heard of anyone using this. I supposed I can imagine some "creative" aircraft designs that might have a use for something like this, but seems unlikely. There are already other (more preferred) ways to account for flight controller mounting angles, right?

@dagar dagar added this to the Release v1.12.0 milestone Feb 9, 2021
@CarlOlsson
Copy link
Contributor

for FW it can be more freely defined, but in general having it parallel to the wing makes most sense (adaption of FW_PSP_OFF may be necessary)

What is the benefit of not defining "zero pitch" as zero pitch angle of the autopilot? This way you can directly check the logs and set parameters based on the vehicle_attitude without subtracting/adding any offset

@sfuhrer
Copy link
Contributor Author

sfuhrer commented Feb 9, 2021

It is still speeding up to ~trim speed before pitching up - I even set rwto_airspd_scl to 100 just to be sure.

That's how it looks atm. Having never before used FWRTO I actually don't know what exactly to expect, but it seems to set the pitch setpoint correctly to the takeoff sp (FW_TKO_PITCH_MIN, in this case 15°) after reaching 130% of FW_AIRSP_MIN (1.3*10=13m/s). I don't know though why the pitch then doesn't follow the setpoint..
image

Secondly you have to have the mission planning pitch set to 0 (when planning a mission) or QGC gets mad and spits out some errors (probably the intention).

Yes that's the intention - #11845 (comment)

On QGC 4.1.1 release when I initiate the mission I get an "unable to start mission, vehicle rejected arming" but it still arms and flies it. When I switch to QGC 4.0.11 it doesn't do that and just flies the mission.

Can confirm, have the same behavior on latest QGC, doesn't seem to happen always though.

Lastly, so how do we control the desired pitch now on takeoff? Is that RWTO_max_pitch now? On sitl having that set to 20 gives me a pitch sp of ~14º on takeoff.

Mainly FW_TKO_PITCH_MIN no? Can you share some plots - as in my case it set the pitch setpoint to what I specified there.

@ryanjAA
Copy link
Contributor

ryanjAA commented Feb 11, 2021

Will provide some plots shortly. Going to take another pass at this.

@RomanBapst
Copy link
Contributor

What is the benefit of not defining "zero pitch" as zero pitch angle of the autopilot? This way you can directly check the logs and set parameters based on the vehicle_attitude without subtracting/adding any offset

@CarlOlsson Yes, I agree. I think the pitch angle reference should be the output of the estimator. For VTOL this will most likely coincide with the motor plane.
Then we use FW_PSP_OFF to specify a trim pitch value required for straight and level flight in fixed wing mode.
Then in the logs you can directly associate estimated pitch angle with all the limits you define using parameters.
E.g. if you set FW_MAN_P_MAX to 30 degrees you will see the pitch value saturate at that value in the log.

@sfuhrer Let me know what you think, maybe there is something we are missing here.

@sfuhrer
Copy link
Contributor Author

sfuhrer commented Feb 11, 2021

I think the pitch angle reference should be the output of the estimator

The question is how you mount the autopilot in the body, resp. what you define as your level horizon. For a MC/VTOL there can be no question: level horizon has to be set such that without wind, the drone stays stationary. For FW I just don't see what the analogy would be, and thus proposed the "parallel to the wing". Wikipedia defines it as "xb axis - positive out the nose of the aircraft in the plane of symmetry of the aircraft" - that may be even simpler to be used as a definition.

@sfuhrer sfuhrer force-pushed the pr-FW-pitch-offset-cleanup branch from 2054b12 to a29161c Compare February 11, 2021 18:02
@sfuhrer sfuhrer changed the title Fixed-wing pitch offset clean up Fixed-wing pitch and roll offset clean up Feb 11, 2021
@sfuhrer
Copy link
Contributor Author

sfuhrer commented Feb 11, 2021

While we're on the subject, has anyone ever actually use FW_RSP_OFF or was it added for "consistency"? It might be better to purge it.

Agree on purging it - see a29161c2d5aa533eb4a4acb73a90fe4dbbb10b80

dagar and others added 3 commits February 12, 2021 03:02
 - remove mavlink mechanism for setting minimum pitch
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
@sfuhrer sfuhrer force-pushed the pr-FW-pitch-offset-cleanup branch from a29161c to 43cba8e Compare February 12, 2021 02:04
@dagar dagar enabled auto-merge (rebase) February 12, 2021 04:59
@LorenzMeier
Copy link
Member

CI is failing - probably real!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants