From 4ae650883ca729a6022f81f30f7a6a447e424582 Mon Sep 17 00:00:00 2001 From: Emiliano Alonzo Date: Wed, 17 Jun 2020 13:03:41 -0300 Subject: [PATCH 1/2] How to use custom dialect with pymavlink installed pip Add instructions to use custom dialect python file in code running pymavlink installed with pip --- en/mavgen_python/README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/en/mavgen_python/README.md b/en/mavgen_python/README.md index 266f1451e..43772b9fd 100644 --- a/en/mavgen_python/README.md +++ b/en/mavgen_python/README.md @@ -47,6 +47,24 @@ You will also need to include them in *pymavlink* and install them locally on yo The libraries can then be used in the same way as those installed using *pip*. +### Using custom dialect with pymavlink installed pip + +An other way to use a custom dialect with a standar instalation of *pymavlink* with *pip* is +1. [Generate](../getting_started/generate_libraries.md) the Python libraries for your dialect. +1. Copy the generated **.py** dialect file into folder you have the code (for example: customDialect.py) +1. You need to change one import on the generated file + ```python + # from ...generator.mavcrc import x25crc + from pymavlink.generator.mavcrc import x25crc + ``` +1. And finally use the new dialect in the code + ```python + import pymavlink.mavutil as mavutil + import customDialec # the file is customDialect.py + + mavutil.mavlink = customDialec + mav = mavutil.mavlink_connection(...) + ``` ## Using the Libraries From 975e80e62ab46f05e8b3e221b4e86f11534b6673 Mon Sep 17 00:00:00 2001 From: Hamish Willee Date: Thu, 18 Jun 2020 11:42:19 +1000 Subject: [PATCH 2/2] Update README.md --- en/mavgen_python/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/en/mavgen_python/README.md b/en/mavgen_python/README.md index 43772b9fd..062f9986c 100644 --- a/en/mavgen_python/README.md +++ b/en/mavgen_python/README.md @@ -49,7 +49,7 @@ The libraries can then be used in the same way as those installed using *pip*. ### Using custom dialect with pymavlink installed pip -An other way to use a custom dialect with a standar instalation of *pymavlink* with *pip* is +Another way to use a custom dialect with a standard installation of *pymavlink* with *pip* is 1. [Generate](../getting_started/generate_libraries.md) the Python libraries for your dialect. 1. Copy the generated **.py** dialect file into folder you have the code (for example: customDialect.py) 1. You need to change one import on the generated file