Skip to content

feat(inputs.mavlink): Add plugin #16780

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

Merged
merged 19 commits into from
May 9, 2025

Conversation

chrisdalke
Copy link
Contributor

@chrisdalke chrisdalke commented Apr 14, 2025

Summary

Add a Mavlink input plugin.

The mavlink plugin connects to a MavLink-compatible flight controller such as as ArduPilot or PX4. and translates all incoming messages into metrics.

The purpose of this plugin is to allow Telegraf to be used to ingest live flight metrics from unmanned systems (drones, planes, boats, etc.)

Telegraf is already often used on flight computers (eg a Raspberry Pi) to collect system metrics for drones and it would be valuable to extend this to also provide a convenient way to record flight telemetry.

Checklist

  • No AI generated code was used in this PR

Related issues

resolves #16220
superseeds #16221

@telegraf-tiger telegraf-tiger bot added feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins labels Apr 14, 2025
@chrisdalke chrisdalke force-pushed the feature/mavlink-input-plugin branch from d0c0e8b to 888dad1 Compare April 14, 2025 02:15
Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

Thanks for the update @chrisdalke! Some smaller comments and suggestions...

@srebhan srebhan self-assigned this Apr 23, 2025
Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

@chrisdalke thanks for the update! I have one suggestion to move the whole metric handling into convertFrameToMetric as this simplifies the code IMO. Other than that, please bring back the "large amout of metrics" warning and check the remaining comments... We are almost there.

Comment on lines 73 to 75
For example, the message
[ATTITUDE](https://mavlink.io/en/messages/common.html#ATTITUDE) will become an
`attitude` metric, with all fields copied from its Mavlink message definition.
Copy link
Member

@srebhan srebhan May 5, 2025

Choose a reason for hiding this comment

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

Please use indirect links!

Suggested change
For example, the message
[ATTITUDE](https://mavlink.io/en/messages/common.html#ATTITUDE) will become an
`attitude` metric, with all fields copied from its Mavlink message definition.
For example, the message [ATTITUDE][attitude] will become an
`attitude` metric, with all fields copied from its Mavlink message definition.
[attitude]: https://mavlink.io/en/messages/common.html#ATTITUDE

@chrisdalke
Copy link
Contributor Author

@srebhan Updated to address all the comments above!

Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

@chrisdalke awesome. Just some more formatting things and we are good from my side...

Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

Thanks a lot @chrisdalke for this nice plugin!

@srebhan srebhan added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label May 8, 2025
@srebhan srebhan assigned skartikey and mstrandboge and unassigned srebhan May 8, 2025
Co-authored-by: Thomas Casteleyn <thomas.casteleyn@me.com>
@telegraf-tiger
Copy link
Contributor

telegraf-tiger bot commented May 8, 2025

Copy link
Contributor

@skartikey skartikey left a comment

Choose a reason for hiding this comment

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

@chrisdalke Great work!

@skartikey skartikey merged commit 4c23243 into influxdata:master May 9, 2025
27 checks passed
@github-actions github-actions bot added this to the v1.35.0 milestone May 9, 2025
@booo
Copy link

booo commented May 18, 2025

Sorry for some "off topic noise" now.

Can I test this easily within the docker ecosystem?

I tried:

➜  telegraf sudo docker run --rm --volume $PWD/config.toml:/etc/telegraf/telegraf.conf quay.io/influxdb/telegraf-nightly:latest          
2025-05-18T08:54:35Z I! Loading config: /etc/telegraf/telegraf.conf
2025-05-18T08:54:35Z E! loading config file /etc/telegraf/telegraf.conf failed: error parsing mavlink, undefined but requested input: mavlink
➜  telegraf cat config.toml 
[[inputs.mavlink]]
url = "udpserver://:14550"

Would love to beta test this!

@chrisdalke
Copy link
Contributor Author

@booo Thanks for trying this. At the time you had tried it out, the nightly build hadn't succeeded yet. However it looks like now the nightly build is updated and you should be able to try again!

If that does not work, try building from source.

@booo
Copy link

booo commented Jun 13, 2025

@booo Thanks for trying this. At the time you had tried it out, the nightly build hadn't succeeded yet. However it looks like now the nightly build is updated and you should be able to try again!

If that does not work, try building from source.

In the end I did build it from source. I created a small Dockerfile and Compose file: https://gitlab.com/searchwing/development/groundstation/antennagroundstation/mavlink-telegraf

So far it works quite well! Well done. Looking forward to create some fancy dashboards for our test flights :)

@Hipska
Copy link
Contributor

Hipska commented Jun 13, 2025

Thanks for sharing, but by having only two plugins activated, you could build yourself a much smaller binary with only those included.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin new plugin plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(inputs): Add Mavlink input plugin
6 participants