-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
feat(inputs.mavlink): Add plugin #16221
Closed
chrisdalke
wants to merge
43
commits into
influxdata:master
from
chrisdalke:feature/mavlink-input-plugin
Closed
Changes from all commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
290d0bf
Mavlink test
chrisdalke 8d95aac
Working threaded mavlink plugin
cdalke-havoc 8105d40
fix config
cdalke-havoc 24d47db
Support all client types
chrisdalke 89264c4
wip
chrisdalke 084395f
fix
chrisdalke 12c598f
Fix README
chrisdalke b8b5030
Fixing README
chrisdalke cb3b1b6
Fixes
chrisdalke 93899a1
Lint
chrisdalke bc756ea
Remove unused imports for now
chrisdalke 1151fda
Fix
chrisdalke a85be7a
Add some tests, split things into util file
cdalke-havoc 4d8de2c
Working tests
cdalke-havoc 18e2180
Lint fixes
cdalke-havoc 24f8c06
More fixes
cdalke-havoc 9c07968
Fix problems
cdalke-havoc c9f3c80
Fix dependencies
cdalke-havoc b368ccb
Test with cross platform fork of gomavlib
chrisdalke c656844
Fix dependency license file
chrisdalke ba1f7e5
Don't export the metric frame data type
cdalke-havoc 231b70a
Merge remote-tracking branch 'origin/feature/mavlink-input-plugin' in…
cdalke-havoc 7579342
wip
cdalke-havoc 0c6a561
Revert dep changes that had nothing to do with this PR
cdalke-havoc 66adb19
Fix
cdalke-havoc fbf605c
Merge remote-tracking branch 'upstream/master' into feature/mavlink-i…
cdalke-havoc 56e345d
WIP PR review
cdalke-havoc 2d170ef
Fix README example output, message filtering
cdalke-havoc 3b504e5
Lint fixes
cdalke-havoc e8db31b
Move client configuration to Init, connection to Start
cdalke-havoc 2c1dfd6
Lint + test fixes
cdalke-havoc 7de58ea
Working on PR feedback, simplify parsing logic
chrisdalke b95ccda
Improve test coverage, address linting issues
chrisdalke 67d40d7
Update docs
chrisdalke d009325
Fix host/port parsing
cdalke-havoc 1fb5aa0
Rename `source` tag back to `fcu_url`
cdalke-havoc 1699ec5
Working on PR feedback
chrisdalke 64e30ac
Lint
chrisdalke 9a80fe5
Merge commit '516b8cfbd16dc1eade0034fe873bb23a242bee04' into feature/…
chrisdalke 2647227
Working on PR feedback
chrisdalke 0e42711
Move URL parsing out of utils into main file, fix linting issues
chrisdalke 70d9732
Lint
chrisdalke 89a9649
Swap forked gomavlib for upstream
chrisdalke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
//go:build !custom || inputs || inputs.mavlink | ||
|
||
package all | ||
|
||
import _ "github.com/influxdata/telegraf/plugins/inputs/mavlink" // register plugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,107 @@ | ||||||
# MavLink Input Plugin | ||||||
|
||||||
This plugin collects metrics from [MavLink][mavlink]-compatible flight | ||||||
controllers such as [ArduPilot][ardupilot] or [PX4][px4] to live ingest | ||||||
flight metrics from unmanned systems (drones, planes, boats, etc.) | ||||||
Currently the ArduPilot-specific Mavlink dialect is used, check the | ||||||
[Mavlink documentation][mavlink_docs] for more details and the various | ||||||
messages available. | ||||||
|
||||||
> [!WARNING] | ||||||
> This plugin potentially generates a large amount of data! Please use metric | ||||||
> filters to limit the amount of metrics produced! | ||||||
|
||||||
⭐ Telegraf v1.34.0 | ||||||
🏷️ iot | ||||||
💻 all | ||||||
|
||||||
[mavlink]: https://mavlink.io/ | ||||||
[ardupilot]: https://ardupilot.org/ | ||||||
[px4]: https://px4.io/ | ||||||
[mavlink_docs]: https://mavlink.io/en/messages/ardupilotmega.html | ||||||
|
||||||
## Global configuration options <!-- @/docs/includes/plugin_config.md --> | ||||||
|
||||||
In addition to the plugin-specific configuration settings, plugins support | ||||||
additional global and plugin configuration settings. These settings are used to | ||||||
modify metrics, tags, and field or create aliases and configure ordering, etc. | ||||||
See the [CONFIGURATION.md][CONFIGURATION.md] for more details. | ||||||
|
||||||
[CONFIGURATION.md]: ../../../docs/CONFIGURATION.md#plugins | ||||||
|
||||||
## Configuration | ||||||
|
||||||
```toml @sample.conf | ||||||
# Read metrics from a Mavlink flight controller. | ||||||
[[inputs.mavlink]] | ||||||
## Flight controller URL supporting serial port, UDP and TCP connections. | ||||||
## The modes are documented at | ||||||
## https://mavsdk.mavlink.io/v1.4/en/cpp/guide/connections.html. | ||||||
## | ||||||
## Examples: | ||||||
## - Serial port: serial:///dev/ttyACM0:57600 | ||||||
## - TCP client: tcp://192.168.1.12:14550 | ||||||
## - UDP client: udp://192.168.1.12:14550 | ||||||
## - UDP server: udp://:14540 | ||||||
url = "udp://:14540" | ||||||
|
||||||
## Filter to specific messages. Only the messages in this list will be parsed. | ||||||
## If blank or unset, all messages will be accepted. Glob syntax is accepted. | ||||||
## Each message in this list should be lowercase camel_case, with "message_" | ||||||
## prefix removed, eg: "global_position_int", "attitude" | ||||||
# filter = [] | ||||||
|
||||||
## Mavlink system ID for Telegraf | ||||||
## Only used if the mavlink plugin is sending messages, eg. | ||||||
## when `stream_request_enable` is enabled (see below.) | ||||||
system_id = 254 | ||||||
|
||||||
## Determines whether the plugin sends requests to stream telemetry, | ||||||
## and if enabled, the requested frequency of telemetry in Hz. | ||||||
## This setting should be disabled if your software controls rates using | ||||||
## REQUEST_DATA_STREAM or MAV_CMD_SET_MESSAGE_INTERVAL | ||||||
## (See https://mavlink.io/en/mavgen_python/howto_requestmessages.html#how-to-request--stream-messages) | ||||||
stream_request_enable = true | ||||||
stream_request_frequency = 4 | ||||||
``` | ||||||
|
||||||
## Metrics | ||||||
|
||||||
Each supported Mavlink message translates to one metric group, and fields | ||||||
on the Mavlink message are converted to fields in telegraf. | ||||||
|
||||||
The name of the Mavlink message is translated into lowercase and any | ||||||
leading text `message_` is dropped. | ||||||
|
||||||
For example, [MESSAGE_ATTITUDE](https://mavlink.io/en/messages/common.html) | ||||||
will become an `attitude` metric, with all fields copied from its Mavlink | ||||||
message definition. | ||||||
|
||||||
## Example Output | ||||||
|
||||||
```text | ||||||
system_time,source=udp://:5760,sys_id=1 time_unix_usec=1732901334516981i,time_boot_ms=1731552i 0 | ||||||
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.
Suggested change
Including no timestamp is better than including a wrong one. |
||||||
simstate,source=udp://:5760,sys_id=1 roll=0,pitch=0,yaw=-1.2217304706573486,xacc=0,yacc=0,zacc=-9.806650161743164,xgyro=0,ygyro=0,zgyro=0,lat=450469223i,lng=-834024728i 0 | ||||||
ekf_status_report,source=udp://:5760,sys_id=1 velocity_variance=0.006436665542423725,pos_horiz_variance=0.006062425673007965,pos_vert_variance=0.0029854460153728724,compass_variance=0.010930062271654606,terrain_alt_variance=0,airspeed_variance=0 0 | ||||||
local_position_ned,source=udp://:5760,sys_id=1 time_boot_ms=1731552i,x=-0.010437906719744205,y=-0.02162001095712185,z=-0.0037050051614642143,vx=-0.011906237341463566,vy=-0.02467793971300125,vz=0.012739507481455803 0 | ||||||
vibration,source=udp://:5760,sys_id=1 time_usec=1731552102i,vibration_x=0.0028534166049212217,vibration_y=0.002792230574414134,vibration_z=0.0028329004999250174,clipping_0=0i,clipping_1=0i,clipping_2=0i 0 | ||||||
battery_status,source=udp://:5760,sys_id=1 id=0i,temperature=32767i,current_battery=0i,current_consumed=0i,energy_consumed=0i,battery_remaining=100i,time_remaining=0i 0 | ||||||
statustext,source=udp://:5760,sys_id=1 text="Field Elevation Set: 0m",id=0i,chunk_seq=0i 0 | ||||||
ahrs,source=udp://:5760,sys_id=1 omegaix=-0.0012698185164481401,omegaiy=-0.0011798597406595945,omegaiz=-0.0017210562946274877,accel_weight=0,renorm_val=0,error_rp=0.002372326795011759,error_yaw=0.0014012008905410767 0 | ||||||
ahrs2,source=udp://:5760,sys_id=1 roll=-0.0015893152449280024,pitch=-0.0018129277741536498,yaw=-1.2297048568725586,altitude=0.22999998927116394,lat=450469223i,lng=-834024728i 0 | ||||||
attitude,source=udp://:5760,sys_id=1 time_boot_ms=1731811i,roll=-0.0011288427049294114,pitch=-0.0013485358795151114,yaw=-1.2430261373519897,rollspeed=-0.00023304438218474388,pitchspeed=-0.00023194786626845598,yawspeed=-0.0008081073756329715 0 | ||||||
global_position_int,source=udp://:5760,sys_id=1 time_boot_ms=1731811i,lat=450469223i,lon=-834024730i,alt=0i,relative_alt=-115i,vx=-1i,vy=-2i,vz=1i,hdg=28878i 0 | ||||||
vfr_hud,source=udp://:5760,sys_id=1 airspeed=0,groundspeed=0.027561495080590248,heading=288i,throttle=0i,alt=0,climb=-0.011526756919920444 0 | ||||||
sys_status,source=udp://:5760,sys_id=1 load=0i,voltage_battery=12600i,current_battery=0i,battery_remaining=100i,drop_rate_comm=0i,errors_comm=0i,errors_count1=0i,errors_count2=0i,errors_count3=0i,errors_count4=0i 0 | ||||||
power_status,source=udp://:5760,sys_id=1 vcc=5000i,vservo=0i 0 | ||||||
meminfo,source=udp://:5760,sys_id=1 brkval=0i,freemem=65535i,freemem32=131072i 0 | ||||||
mission_current,source=udp://:5760,sys_id=1 seq=0i,total=0i,mission_mode=0i,mission_id=0i,fence_id=0i,rally_points_id=0i 0 | ||||||
servo_output_raw,source=udp://:5760,sys_id=1 time_usec=1731811998i,port=0i,servo1_raw=1500i,servo2_raw=0i,servo3_raw=1500i,servo4_raw=0i,servo5_raw=0i,servo6_raw=0i,servo7_raw=0i,servo8_raw=0i,servo9_raw=0i,servo10_raw=0i,servo11_raw=0i,servo12_raw=0i,servo13_raw=0i,servo14_raw=0i,servo15_raw=0i,servo16_raw=0i 0 | ||||||
rc_channels,source=udp://:5760,sys_id=1 time_boot_ms=1731811i,chancount=8i,chan1_raw=1500i,chan2_raw=1500i,chan3_raw=1500i,chan4_raw=1500i,chan5_raw=1800i,chan6_raw=1000i,chan7_raw=1000i,chan8_raw=1800i,chan9_raw=0i,chan10_raw=0i,chan11_raw=0i,chan12_raw=0i,chan13_raw=0i,chan14_raw=0i,chan15_raw=0i,chan16_raw=0i,chan17_raw=0i,chan18_raw=0i,rssi=255i 0 | ||||||
raw_imu,source=udp://:5760,sys_id=1 time_usec=1731811998i,xacc=0i,yacc=0i,zacc=-1001i,xgyro=1i,ygyro=0i,zgyro=0i,xmag=84i,ymag=159i,zmag=508i,id=0i,temperature=4493i 0 | ||||||
scaled_imu2,source=udp://:5760,sys_id=1 time_boot_ms=1731811i,xacc=0i,yacc=0i,zacc=-1001i,xgyro=1i,ygyro=0i,zgyro=1i,xmag=84i,ymag=159i,zmag=508i,temperature=4493i 0 | ||||||
scaled_imu3,source=udp://:5760,sys_id=1 time_boot_ms=1731811i,xacc=0i,yacc=0i,zacc=0i,xgyro=0i,ygyro=0i,zgyro=0i,xmag=84i,ymag=159i,zmag=508i,temperature=0i 0 | ||||||
scaled_pressure,source=udp://:5760,sys_id=1 time_boot_ms=1731811i,press_abs=1013.2387084960938,press_diff=0,temperature=3499i,temperature_press_diff=0i 0 | ||||||
scaled_pressure2,source=udp://:5760,sys_id=1 time_boot_ms=1731811i,press_abs=1013.2310791015625,press_diff=0,temperature=3499i,temperature_press_diff=0i 0 | ||||||
gps_raw_int,source=udp://:5760,sys_id=1 time_usec=1731635000i,lat=450469223i,lon=-834024728i,alt=0i,eph=121i,epv=200i,vel=0i,cog=0i,satellites_visible=10i,alt_ellipsoid=0i,hacc=300i,vacc=300i,vel_acc=40i,hdg_acc=0i,yaw=0i 0 | ||||||
``` |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.