-
Notifications
You must be signed in to change notification settings - Fork 236
Make modules out of the plugins #207
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
Conversation
@@ -2,7 +2,7 @@ | |||
|
|||
import asyncio | |||
|
|||
from mavsdk import (CameraError, Mode) | |||
from mavsdk.camera import (CameraError, Mode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would be tempted to just do:
from mavsdk import camera
and then access it using:
camera.Mode
That's possible, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that's possible, too. Or just import mavsdk
and then use mavsdk.camera.Mode
. I think it's really up to the user 👍.
Thanks for the review! I'll try to look into the documentation side sometime next week, because I probably broke it. In the meantime I hope that @petergerten can work from this branch for the missions. |
It's a bit odd. Now I need to import |
Also in the code? In my testing, in the code I could do |
|
Doesn't seem wrong to me. Is it?
|
An issue we have in the current system (where all the files are generated in
mavsdk/generated
) is that we don't have any namespacing between them. Therefore,from mavsdk import MissionItem
could importMissionItem
fromMission
, or fromMissionRaw
. In this case, it broke theexamples/mission.py
example.I therefore made a module out of each plugin, so that
import mavsdk.mission
is a thing, and one couldfrom mavsdk.mission_raw import MissionItem as MissionRawItem
, if needed.I had to make a few changes for that:
globals()
use insystem.py
, mainly because I did not really understand how it workedmavsdk/
, because I could not make the modules thing work inmavsdk/generated/
without ending up with imports of the formfrom mavsdk.generated.mission import ...
. Maybe there is a way, I just did not find it.I tested the examples and it seems to be working for me. I would be glad if @petergerten could confirm that it fixes the mission example 😊.
I did not test against the docs generation (mainly because it's getting late), but I wanted @julianoes' opinion first.
Note: I tried to make commits that make sense for the review, so the auto-generation is isolated in two commits 😇.
Fixes #200