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: update tailsitter speedscaling logic #12869

Merged
merged 7 commits into from
Dec 17, 2019
Merged

Conversation

kd0aij
Copy link
Contributor

@kd0aij kd0aij commented Nov 23, 2019

add tailsitter gain scaling option mask and logging
apply roll limit in tailsitter bodyframe roll control
add define for future exclusion of tailsitter gainscaling debug code/logging
tailsitter bodyframe roll and qacro input scaling bugfixes:
respect Q_TAILSIT_RLL_MX and roll/yaw scale parameters in bodyframe roll modes
fix unintended swap of Q_ACRO_RLL/YAW_RATE params in QACRO mode

This is a subset of flight test code (#12869)
It contains the speed scaling method which has been flight tested by @losawing on both dual-motor tailsitter (frame class 10) and quad (frame class 1 with Q_TAILSIT_MOTMX=0xF) "copter" tailsitter vehicles. It omits the gain interpolation method and other non-tailsitter related changes in order to simplify this PR and limit it to flight tested code.

log of SITL test of rebased PR with both (legacy) BOOST (THSCMX=2) and ATT_THR (GSCMIN=.2) scaling methods enabled (note that scale factor ranges from 0.2 to 2.0 depending on throttle and attitude) "unknown" flight mode is QACRO:
image

@IamPete1
Copy link
Member

Flys the borco OK, I do think it might be better to do it in one go like this branch, I think the logic is eser to follow.

https://github.com/IamPete1/ardupilot/tree/gainscailing

@kd0aij
Copy link
Contributor Author

kd0aij commented Nov 24, 2019

@IamPete1 Thanks for testing.

I decided to try this because it incorporates only the changes which @losawing has flight tested.
That way there's less chance that it changes behavior for him and it's also a much smaller change to master. Hopefully easier to get approval that way.
Also, I was finding it difficult to follow the changes to master in the original and modified PRs myself after letting it sit for a few months, and wasn't confident that I understood them correctly :)

@IamPete1
Copy link
Member

I think its better to do in one go, that is to say once this goes in I will straight away open the interpolation PR that will rearrange all this again, better to only re-arrange it once.

At the least I think this should have the selection bitmask param in. I think also that the 'old' throttle only scaling should always be used for the tilt motors. It makes no scene on to vary them with airspeed.

Maybe I will re-base my branch so we can compare. I think that that branch is where we would both like tailsitters to end up eventually? Just need to test it with the other methods, I'm happy with how it work for the 'old' throttle method and the new interpolation stuff.

@IamPete1
Copy link
Member

IamPete1 commented Nov 24, 2019

This is the comparison, its probably a bigger change from this to that than from how it is now to this.

https://github.com/kd0aij/ardupilot/compare/pr-gsc-base...IamPete1:gainscailing_rebase?expand=1

Although I guess there are 3 commit from pid and motors stuff that could probably be dropped to a new PR.

edit: this is that (there were only two commits of none tailsitter stuff): https://github.com/kd0aij/ardupilot/compare/pr-gsc-base...IamPete1:gainscailing_rebase_tailsitter_only?expand=1

edit2: this would be the PR i think it would also add Qasist support for tailsitters https://github.com/ArduPilot/ardupilot/compare/master...IamPete1:gainscailing_rebase_tailsitter_only?expand=1

@kd0aij
Copy link
Contributor Author

kd0aij commented Nov 25, 2019

Note that commit 1294919 changes the copter tailsitter quad (plus and X) layouts to match the motor rotation directions documented for copters here: http://ardupilot.org/copter/docs/connect-escs-and-motors.html#connect-escs-and-motors and adds 2 new frame types for the previous no-yaw-torque layouts: MOTOR_FRAME_TYPE_NYT_PLUS and MOTOR_FRAME_TYPE_NYT_X

ArduPlane/quadplane.cpp Outdated Show resolved Hide resolved
ArduPlane/quadplane.cpp Outdated Show resolved Hide resolved
ArduPlane/quadplane.cpp Outdated Show resolved Hide resolved
ArduPlane/quadplane.cpp Outdated Show resolved Hide resolved
// acro_roll_rate param applies to yaw in copter frame
target_roll = plane.channel_rudder->norm_input() * acro_roll_rate * 100.0f;
target_yaw = -plane.channel_roll->norm_input() * acro_yaw_rate * 100.0f;
target_roll = plane.channel_rudder->norm_input() * acro_yaw_rate * 100.0f;
Copy link
Contributor

Choose a reason for hiding this comment

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

why change the mapping for yaw/roll here?

Copy link
Contributor Author

@kd0aij kd0aij Nov 27, 2019

Choose a reason for hiding this comment

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

rephrasing the comment: multicopter frame yaw is tailsitter body-frame roll and multicopter frame roll is tailsitter body-frame yaw

But this PR is swapping the acro_yaw_rate and acro_roll_rate which was necessary to make them refer to the right body-frame axes in QACRO mode.

ArduPlane/quadplane.h Outdated Show resolved Hide resolved
ArduPlane/quadplane.h Outdated Show resolved Hide resolved
ArduPlane/tailsitter.cpp Outdated Show resolved Hide resolved
@kd0aij kd0aij force-pushed the pr-gsc-base branch 3 times, most recently from 86cbde4 to 47f4312 Compare November 29, 2019 04:13
ArduPlane/quadplane.cpp Outdated Show resolved Hide resolved
@kd0aij
Copy link
Contributor Author

kd0aij commented Dec 1, 2019

new flight test reports with copter tailsitter by @losawing:
https://discuss.ardupilot.org/t/copter-tailsitters/45514/103
and
https://discuss.ardupilot.org/t/copter-tailsitters/45514/108

@rmackay9
Copy link
Contributor

I think we need to extend the FRAME_TYPE parameter description.. this is not a blocker though.

kd0aij and others added 3 commits December 16, 2019 20:26
add tailsitter gain scaling option mask and logging
tailsitter qassist bugfix; thanks, @IamPete
apply roll limit in tailsitter bodyframe roll control
add define for future exclusion of tailsitter gainscaling debug code/logging
tailsitter bodyframe roll and qacro input scaling bugfixes:
  respect Q_TAILSIT_RLL_MX and roll/yaw scale parameters in bodyframe roll modes
  fix unintended swap of Q_ACRO_RLL/YAW_RATE params in QACRO mode
don't scale motor tilt

Co-authored-by: IamPete1 <33176108+IamPete1@users.noreply.github.com>
…nput methods

increase allowed yaw error in tailsitter bodyframe roll modes
add combined bodyframe roll method
delete old versions of body-frame roll input methods
invert mc_controls
@kd0aij
Copy link
Contributor Author

kd0aij commented Dec 17, 2019

Updated the metadata for parameters Q_TAILSIT_INPUT and Q_FRAME_TYPE and squashed into last commit
moved speed scaler logging to a new field in QTUN

… body-frame roll input handling

fix metadata for tailsitter param GSCMSK
rework roll/yaw scaling for body-frame roll options
add constraints on body-frame roll and yaw inputs
move speed_scaler logging into QTUN message
update parameter metadata for Q_TAILSIT_INPUT and Q_FRAME_TYPE
@tridge tridge merged commit 56b2c69 into ArduPilot:master Dec 17, 2019
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.

None yet

5 participants