-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Added MAVProxy in testing of a custom MAVLink message #3390
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -477,6 +477,12 @@ There are several approaches you can use to view MAVLink traffic: | |
It is much easier to generate a wireshark plugin and inspect traffic in Wireshark, than to rebuild QGroundControl with your dialect and use MAVLink Inspector. | ||
::: | ||
|
||
- Use [MAVProxy](https://ardupilot.org/mavproxy/) with an updated [Pymavlink](https://mavlink.io/en/mavgen_python/) that contains your custom messages. | ||
This is easy because updating pymavlink is just a matter of copying in your headers and rebuilding the package. | ||
It easier than building QGroundControl and similar effort to using WireShark (once tested with MAVProxy, you can still proceed to building QGroundControl if required). | ||
|
||
Instructions for the update process and how to view your custom message are given below in [Updating MAVProxy](../middleware/mavlink.md#updating-mavproxy) | ||
|
||
- [Log uORB topics](../dev_log/logging.md) associate with your MAVLink message. | ||
- View received messages in the QGroundControl [MAVLink Inspector](https://docs.qgroundcontrol.com/master/en/qgc-user-guide/analyze_view/mavlink_inspector.html). | ||
You will need to rebuild QGroundControl with the custom message definitions, [as described below](#updating-qgroundcontrol) | ||
|
@@ -519,3 +525,55 @@ However if you use your own dialect then it should include ArduPilotMega.xml (or | |
### Updating MAVSDK | ||
|
||
See the MAVSDK docs for information about how to work with [MAVLink headers and dialects](https://mavsdk.mavlink.io/main/en/cpp/guide/build.html). | ||
|
||
### Updating MAVProxy | ||
|
||
[MAVProxy](https://ardupilot.org/mavproxy/) is UAV ground station software package for MAVLink based systems written in Python. | ||
While not optimized for PX4 or widely promoted in the PX4 community, we mention it here because it is one of the easiest ground stations to update with custom messages, and is therefore one of the easiest ways to test that your custom messages are being sent. | ||
|
||
[MAVProxy](https://ardupilot.org/mavproxy/) depends on [Pymavlink](https://mavlink.io/en/mavgen_python/). | ||
The approach described below is to install MAVProxy, remove the default-installed Pymavlink, and then rebuild Pymavlink with the new messages. | ||
|
||
The steps are: | ||
|
||
1. Install MAVproxy using the command: | ||
|
||
```sh | ||
python -m pip install mavproxy | ||
``` | ||
|
||
1. Remove the Pymavlink package installed with MAVProxy: | ||
|
||
```sh | ||
python -m pip uninstall pymavlink | ||
``` | ||
|
||
1. Clone the MAVLink repository (which also contains Pymavlink) | ||
|
||
```sh | ||
git clone https://github.com/mavlink/mavlink.git --recursive | ||
cd mavlink | ||
``` | ||
|
||
1. Copy your custom message XML into the [message_definitions/v1.0](https://github.com/mavlink/mavlink/tree/master/message_definitions/v1.0) folder | ||
1. Generate the headers: | ||
|
||
```sh | ||
python3 -m pymavlink.tools.mavgen --lang=C --wire-protocol=2.0 --output=generated message_definitions/v1.0/your_dialect.xml | ||
``` | ||
|
||
1. Install Pymavlink using | ||
|
||
```sh | ||
cd pymavlink | ||
sudo python setup.py install | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not 100% certain this will work. Normally Pymavlink package is built with the ArduPilot fork of mavlink/mavlink headers.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @hamishwillee yes I have tested it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Running this with What are we trying to do here? And why can't we just use upstream pymavlink? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, this does indeed screw up your installation - as I have just verified. I can get this to "work" (somewhat) but I can't undo it. Will have to delete my installation and start again :-( What we are trying to do, ultimately, is have an easy way to test a custom message, since building QGC with a custom dialect is a bit of a pain. The solution described here is to install mavproxy and then delete the pymavlink that it depends on. Then rebuild pymavlink from the mavlink repo clone with your new xml definitions added. This step is easy because you just copy the xml files in and run setup.py and it creates a new installation/.egg with the .py files for the definitions.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FYI, let's see if we can get MAVProxy to update ArduPilot/MAVProxy#1470 |
||
``` | ||
|
||
1. Connect your autopilot to MAVProxy by following the [MAVProxy docs](https://ardupilot.org/mavproxy/index.html). | ||
|
||
1. In the MAVProxy shell, you can use the `watch` command to display messages. | ||
For example, to display/test that a custom message is being sent you could use the command below: | ||
|
||
```sh | ||
watch custom_message_name | ||
``` |
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.
@wasaybaig Are you sure you need this step?
This builds the C headers in mavlink/mavlink, not Python headers so I don't think this would be used.
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.
@hamishwillee it works this way also but we can change the language to Python. But it is important to generate the headers with your new message or MAVProxy will not be able to understand the message.
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.
But MAVProxy uses Python so this is a null operation - you haven't built anything that MAVProxy can use.
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 guess I'll have to try it.
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.
This is not needed. setup.py pulls any xml files in the parent definitions folder and builds them. Tested.