Skip to content

Extracts MPState object logic into Vehicle. Implements wait_ready. - #401

Merged
tcr3dr merged 14 commits into
masterfrom
tcr-statemerge
Nov 3, 2015
Merged

tcr3dr merged 14 commits into
masterfrom
tcr-statemerge

Conversation

@tcr3dr

@tcr3dr tcr3dr commented Nov 3, 2015

Copy link
Copy Markdown
Contributor

This is a pretty heavy PR, but also the last major refactor I have planned.

Rather than obtusely split parameter logic between a MAVLink handler and a Vehicle object, the Vehicle object (through "message" handlers and "event loop" handlers) now implements all of its own core logic inside the class. There is still some slightly awkward coupling going on between the classes, but there's far less of it, and the code to manage properties is all in one place.

As a side effect of this, we're now able to track the status of most attributes, and as such have a working wait_ready implementation on the vehicle that serves as the basis for await_param (which should be deprecated and replaced) as well as other methods like wait_valid, etc.

Additionally, we get rid of the MAVLink rx handlers and only expose the on_message primitive, which acts as our MAVLink interaction story. Ideally, we can abstract the message contruction story as well, though I haven't put much thought into it.

@tcr3dr

tcr3dr commented Nov 3, 2015

Copy link
Copy Markdown
Contributor Author

See #319, #342 for more discussion.

@tcr3dr
tcr3dr force-pushed the tcr-statemerge branch 2 times, most recently from c4c9a2a to 534085d Compare November 3, 2015 05:24
@hamishwillee

Copy link
Copy Markdown
Contributor

Looks a lot simpler. What, if any testing/documentation do you "know" you need form me?

This merge misses a lot of the documentation changes we "temporarily lost" this morning - e.g I replaced use of flush() everywhere and had started to use home_location. I am assuming that will be fixed up?

I guess we will in particular need to document the use of wait_ready in the migrating guide.

Comment thread dronekit/lib/__init__.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

in this case this should be def location_callback(vehicle, attr_name): see attr_name instead of location, attr_name is a string

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

NICE CATCH.

@mrpollo

mrpollo commented Nov 3, 2015

Copy link
Copy Markdown
Member

lots of changes, left some comments but non blocking on merge, this looks good 👍

tcr3dr added a commit that referenced this pull request Nov 3, 2015
Extracts MPState object logic into Vehicle. Implements wait_ready.
@tcr3dr
tcr3dr merged commit aa294f0 into master Nov 3, 2015
@tcr3dr
tcr3dr deleted the tcr-statemerge branch November 3, 2015 18:33
@hamishwillee

Copy link
Copy Markdown
Contributor

@tcr3dr Hey, but the docs still don't include my previous updates - e.g.

        for cmd in cmds[1:]:  #skip first item as it is home waypoint.
             missionlist.append(cmd)                     missionlist.append(cmd)

The slice is no longer needed and was removed.

Do I need to go through all the examples and re-verify my changes went in?

@tcr3dr

tcr3dr commented Nov 3, 2015

Copy link
Copy Markdown
Contributor Author

@hamishwillee Hm. It may have been overwritten by git due to its proximity to a wait_valid invocation; my fault, though I can't find the original commit now where it was changed.

Can you find the commit in which it was modified? It should be this "lost" commit or one of it's parents, if I recall: 8958a38 Or was it a different PR?

@hamishwillee

Copy link
Copy Markdown
Contributor

@tcr3dr The specific case I pointed to (cmds slicing) was fixed in dd7058a - but the changes in 8958a38 need to be in there too (both of these were the problem commits that disappeared yesterday morning).

@tcr3dr

tcr3dr commented Nov 3, 2015

Copy link
Copy Markdown
Contributor Author

@hamishwillee I think the commits got pulled in. If you look in that commit, the [1:] slice was just accidentally left in: https://github.com/dronekit/dronekit-python/blob/dd7058a5677fc85fc19f24d9e9aacd83899efc42/docs/guide/auto_mode.rst

@hamishwillee

Copy link
Copy Markdown
Contributor

Excellent - sorry, I'll fix that!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants