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

Generating dialects in arbitrary directory on the fly #596

Closed
basil-huber opened this issue Nov 28, 2021 · 2 comments · Fixed by #617
Closed

Generating dialects in arbitrary directory on the fly #596

basil-huber opened this issue Nov 28, 2021 · 2 comments · Fixed by #617

Comments

@basil-huber
Copy link

Hi folks,

As I understand it, custom dialects can be generated on the fly when creating a connection with mavlink_connection(..., dialect=mydialect). However, this requires the definitions to be just next to the pymavlink directory, which is quite a dark place when installing pymavlink through pip.

As an example, I have a python package which depends on pymavlink and used a custom dialect. It would be really nice to be able to simply put install_requires=['pymavlink] and then call

os.environ['MDEF'] = r'path/to/my/definitions'
mavlink_conn = mavutil.mavlink_connection(..., dialect='mydialect')

Cheers,
Basil

basil-huber added a commit to basil-huber/pymavlink that referenced this issue Nov 28, 2021
Message definition location for mavgen_python_dialect can be set using MDEF environment variable.
This fixes ArduPilot#596
@basil-huber
Copy link
Author

basil-huber commented Nov 28, 2021

  I just discovered that I can achieve the same with os.environ['MAVLINK_DIALECT'] = path/to/my/dir.

@peterbarker
Copy link
Contributor

@basil-huber I've created the link PR to attempt to fix this one. Works in my local testing.

Your XML directory does need to be structured to include the "v1.0" for this to work.

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