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: Onion part 1b #10162

Merged
merged 4 commits into from
Apr 2, 2019
Merged

Plane: Onion part 1b #10162

merged 4 commits into from
Apr 2, 2019

Conversation

magicrub
Copy link
Contributor

@magicrub magicrub commented Jan 3, 2019

This replaces #10107 by rolling back a couple of the changes that held mode properties. It should be more "obviously correct" with structure-only changes. Next part will be where we are doing more fancy things with the mode classes. Let's get the structure in place and merged into master so we can then more easily discuss how to do all the optimization stuff with using the mode classes.

I marked this WIP because I plan to break the commits up a little better and add some comments. No source code changes are planned. This PR is here to get more eyes on this and get some testing happening. It would be a HUGE help if @Naterater could do some flight tests with this in all the flight modes. Ping us if you need a binary!

ArduPlane/avoidance_adsb.h Show resolved Hide resolved
#include "mode.h"
#include "Plane.h"

bool ModeAcro::_enter()
Copy link
Contributor

Choose a reason for hiding this comment

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

bool is interesting.

Traditionally on Plane we never fail to enter a mode....

Copy link
Contributor Author

Choose a reason for hiding this comment

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

... not when we're done with the onion!

Copy link
Contributor

Choose a reason for hiding this comment

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

we do fail to enter Q modes actually, though it works by switching back to previous_mode

@magicrub
Copy link
Contributor Author

magicrub commented Jan 3, 2019

arduplane.zip
I've attached the apj file but renamed it to zip to post here. Git hash is a81772cb34

@tridge
Copy link
Contributor

tridge commented Jan 8, 2019

need to fix commit msg on the major commit

@amilcarlucas
Copy link
Contributor

For reference, the Flight modes are defined in Mavlink enums:
https://mavlink.io/en/messages/ardupilotmega.html#COPTER_MODE

@magicrub magicrub force-pushed the plane_onion3_flat branch 2 times, most recently from 9a21ef5 to 4bd5eeb Compare January 14, 2019 20:33
@magicrub magicrub removed the WIP label Jan 14, 2019
@magicrub
Copy link
Contributor Author

@amilcarlucas For Plane modes, we have this. Just like the other vehicles.

@magicrub
Copy link
Contributor Author

rebased on master and updated commit msg

@amilcarlucas
Copy link
Contributor

I whould like to see that re-written as
#include mavlink.h enum Number { MANUAL = Ardupilotmega::PLANE_MODE_MANUAL, CIRCLE = Ardupilotmega::PLANE_MODE_CIRCLE, STABILIZE = Ardupilotmega::PLANE_MODE_STABILIZE, TRAINING = Ardupilotmega::PLANE_MODE_TRAINING, ...

That way it is clear that they need to be in sync with mavlink AND still allows one to add a new mode by appending it to the bottom of the list without the = sign.

@magicrub
Copy link
Contributor Author

@amilcarlucas fair request. However, all vehicles need that change. Let's leave that for another PR.

@amilcarlucas
Copy link
Contributor

@magicrub OK, I'll do a PR once this one goes in.

@OXINARF
Copy link
Member

OXINARF commented Jan 15, 2019

@magicrub @amilcarlucas We've been craving for an AP_Telemetry library forever, tying things more into MAVLink only makes that job harder, not easier... The flight mode numbers have its origin in ArduPilot, not in MAVLink.

@magicrub
Copy link
Contributor Author

rebased again. I looked at adding comments on mode.h but I just don't see where adding any would help. All comments also match rover/copter. Please don't hold this PR to a higher standard than rover/copter mode system.

@peterbarker
Copy link
Contributor

peterbarker commented Jan 15, 2019 via email

@rmackay9
Copy link
Contributor

rmackay9 commented Jan 16, 2019

@magicrub, I should just stay quiet but I'm excited about this PR.. I guess you said on the dev call that you wanted to do some more testing or are you happy for this to go in now? I see the WIP label is gone..

@amilcarlucas
Copy link
Contributor

@OXINARF we can cross that bridge once we get there :)
And we can at that point, replace the assignments with static_asserts.

@amilcarlucas
Copy link
Contributor

Needs a rebase

@magicrub
Copy link
Contributor Author

rebased

@magicrub magicrub force-pushed the plane_onion3_flat branch 3 times, most recently from 437d982 to 2fa5cdd Compare January 25, 2019 14:21
@magicrub
Copy link
Contributor Author

During the lat devcall @tridge offered to help test, although he'll be unavailable for the next week so it will have to wait until he gets back. Meanwhile, I've been rebasing it every few days.

@magicrub magicrub force-pushed the plane_onion3_flat branch 2 times, most recently from 6195297 to be031c5 Compare January 31, 2019 15:07
@Naterater
Copy link
Contributor

Hey @magicrub, what's the status of this?

@magicrub
Copy link
Contributor Author

I just rebased this. @peterbarker and I will be flying it here in Canberra dev conference. Plan is to pound on it and get it merged this weekend

@magicrub magicrub force-pushed the plane_onion3_flat branch 2 times, most recently from 9a4e816 to e78eda4 Compare March 22, 2019 04:01
@magicrub
Copy link
Contributor Author

This was just flown on two aircraft at CMAC, owned by @peterbarker and @tridge . So, things are looking promising for a merge very soon!

@magicrub
Copy link
Contributor Author

rebased. I've also added the DevTopic tag. Let's leave that tag on until this merges

@magicrub
Copy link
Contributor Author

This needs some eyeballs on it. Can a few other devs PLEASE take a look at this?

}
break;
// we failed entering new mode, roll back to old
previous_mode = &old_previous_mode;
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 re-enter the old mode, as enter a mode has significant side effects? (IE navigation target etc).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, quadplane is the black duck here. It's the only thing that can fail a set_mode. I don't have a quadplane to test thoroughly. Can you test it for me?

Copy link
Contributor

Choose a reason for hiding this comment

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

@magicrub, I'd vote for testing it in SITL..

@tridge tridge merged commit fbe483c into ArduPilot:master Apr 2, 2019
@magicrub
Copy link
Contributor Author

magicrub commented Apr 2, 2019

I think @tridge 's baby hit the merge button on accident!

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

Successfully merging this pull request may close these issues.

8 participants