Package symbol

libmavconn package from mavros repo

libmavconn mavros mavros_examples mavros_extras mavros_msgs

ROS Distro
humble

Package Summary

Version 2.16.0
License GPLv3
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Description
Checkout URI https://github.com/mavlink/mavros.git
VCS Type git
VCS Version ros2
Last Updated 2026-10-24
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

MAVLink communication library. This library provide unified connection handling classes and URL to connection object mapper. This library can be used in standalone programs.

Additional Links

Maintainers

  • Vladimir Ermakov

Authors

  • Vladimir Ermakov

MAVCONN library

It is mavlink connection and communication library used in MAVROS. Since 2014-11-02 it adopted to use outside from ROS environment by splitting to individual package and removing dependencies to rosconsole.

See the MAVROS documentation and the libmavconn API reference for more details.

Connection URL

Connection defined by URL. Just pass one of that URL to MAVConnInterface::open_url() and get connection object.

Supported schemas:

  • Serial: /path/to/serial/device[:baudrate]
  • Serial: serial:///path/to/serial/device[:baudrate][?ids=sysid,compid]
  • Serial with hardware flow control: serial-hwfc:///path/to/serial/device[:baudrate][?ids=sysid,compid]
  • UDP: udp://[bind_host][:port]@[remote_host][:port][/?ids=sysid,compid]
  • UDP broadcast until GCS discovery: udp-b://[bind_host][:port]@[:port][/?ids=sysid,compid]
  • UDP broadcast (permanent): udp-pb://[bind_host][:port]@[:port][/?ids=sysid,compid]
  • TCP client: tcp://[server_host][:port][/?ids=sysid,compid]
  • TCP server: tcp-l://[bind_port][:port][/?ids=sysid,compid]

Note: ids from URL overrides ids given by system_id & component_id parameters.

Dependencies

Same as for mavros:

  • Linux host
  • Asio library ( https://think-async.com/Asio/ )
  • console-bridge library
  • compiler with C++20 support

Shared io_service (optional)

By default each connection owns and runs its own asio::io_service thread. For multi-connection setups you can provide a shared asio::io_service and run it from your own thread pool.

#include <asio.hpp>
#include <mavconn/interface.hpp>

asio::io_service shared_io;
auto work = std::make_unique<asio::io_service::work>(shared_io);
std::jthread io_thread([&]() { shared_io.run(); });

auto conn = mavconn::MAVConnInterface::open_url(
  "udp://0.0.0.0:14555@127.0.0.1:14550",
  1, mavconn::MAV_COMP_ID_UDP_BRIDGE,
  [](const mavlink::mavlink_message_t *, mavconn::Framing) {},
  {},
  &shared_io);

conn->close();
work.reset();
shared_io.stop();

License

Licensed under terms of LGPLv3, BSD, or GPLv3.

CHANGELOG

Changelog for package libmavconn

2.16.0 (2026-09-27)

  • Merge pull request #2290 from mavlink/fix-io-context libmavconn: fix IoContextRunner self-close lifetime and restart (fix #2275)
  • libmavconn: fix IoContextRunner self-close lifetime and restart (fix #2275) On a shutdown initiated from the owned I/O thread (self-close), join_owned() detaches the worker thread. The runner then called restart() while run() was still active on that thread (undefined behaviour) and, after the worker detached, could be destroyed while the thread still wrote is_running_. Move the io_context, work guard, and is_running flag into a heap-shared State that the worker thread also holds. The worker restarts the io_context only after run() returns, and the State (and thus the io_context) survives even if the owning connection is destroyed before the detached thread completes.
  • Merge pull request #2289 from mavlink/check-cbg plugins: fix cmd/command service deadlocks and const shared_ptr deprecation warnings
  • libmavconn: consume nodiscard result in baudrate test The serial baudrate regression test calls open_url_no_connect() expecting it to throw DeviceError; the [[nodiscard]] return was left unconsumed, producing -Wunused-result warnings. Capture it in a [[maybe_unused]] variable.
  • Merge pull request #2287 from christophebedard/christophebedard/fix-libmavconn-missing-ament-cmake-google-benchmark-dep
  • Add missing test_depend on ament_cmake_google_benchmark to libmavconn It's used in tests since #2256, but it wasn't declared as a (test) dependency, resulting in build failures on the ROS 2 buildfarm: https://build.ros2.org/view/Hbin_uJ64/job/Hbin_uJ64__libmavconn__ubuntu_jammy_amd64__binary/160/console ` 23:58:37 CMake Error at CMakeLists.txt:117 (find_package): 23:58:37 By not providing "Findament_cmake_google_benchmark.cmake" in 23:58:37 CMAKE_MODULE_PATH this project has asked CMake to find a package 23:58:37 configuration file provided by "ament_cmake_google_benchmark", but CMake 23:58:37 did not find one. 23:58:37 23:58:37 Could not find a package configuration file provided by 23:58:37 "ament_cmake_google_benchmark" with any of the following names: 23:58:37 23:58:37 ament_cmake_google_benchmarkConfig.cmake 23:58:37 ament_cmake_google_benchmark-config.cmake`
  • Contributors: Christophe Bedard, Vladimir Ermakov

2.15.1 (2026-08-22)

  • libmavconn: fix serial baudrate parsing above uint16 url_parse_host hardcoded a uint16 port limit and error label, which rejected serial baudrates above 65535 (e.g. 921600) with a misleading 'invalid port value' error. Make the value range and field name configurable and allow baudrate to use the full int range. Adds a regression test covering a high valid baudrate and invalid zero/non-numeric baudrates. Fix #2265
  • Merge pull request #2260 from mavlink/fix-deprecations Fix deprecations
  • libmavconn: fix deprecated literal operator whitespace
  • libmavconn: avoid -Wformat-security in format() with no args
  • Contributors: Vladimir Ermakov

2.15.0 (2026-08-08)

  • Merge pull request #2259 from mavlink/docs-refresh docs: refresh, refactor extractor

  • docs: refresh subpackage READMEs

    - mavros: point the API docs link at readthedocs/plugin reference instead of the dead wiki.ros.org page; fix ROS1 roslaunch examples to ros2 launch; note that up-to-date install instructions live in the readthedocs guide.

    • mavros_extras: link to the full plugin reference.
    • libmavconn: link to the docs and API reference.
    • mavros_msgs: add the missing README (message/service overview + API links).
    • test_mavros: mark the ROS1-era SITL hand-tests as historical.
  • Merge pull request #2256 from mavlink/try-optimize-router Optimize MAVROS router and MAVConn send path

  • libmavconn: speed up utils::format with a stack-buffer fast path The old format() called snprintf twice (once to measure, once to fill) and wrote through &ret.front()/capacity(), which is UB for empty output. Format into a small stack buffer first (single snprintf), re-formatting into a heap string only when the output exceeds it. Handles encoding errors and the empty-output case.

  • libmavconn: skip send post when chain active, use composed async_write Only the producer that turns the tx queue from idle to active posts a send handler; an in-progress chain drains everything enqueued meanwhile. This removes the per-message asio::post handler allocation and shared_from_this churn on the send path in steady state. Use composed asio::async_write for TCP/serial so partial writes are handled internally, deleting the manual MsgBuffer::pos tracking and resend loop (and the fragile capture of a reference into the tx queue).

File truncated at 100 lines see the full file

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged libmavconn at Robotics Stack Exchange

Package symbol

libmavconn package from mavros repo

libmavconn mavros mavros_examples mavros_extras mavros_msgs

ROS Distro
jazzy

Package Summary

Version 2.16.0
License GPLv3
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Description
Checkout URI https://github.com/mavlink/mavros.git
VCS Type git
VCS Version ros2
Last Updated 2026-10-24
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

MAVLink communication library. This library provide unified connection handling classes and URL to connection object mapper. This library can be used in standalone programs.

Additional Links

Maintainers

  • Vladimir Ermakov

Authors

  • Vladimir Ermakov

MAVCONN library

It is mavlink connection and communication library used in MAVROS. Since 2014-11-02 it adopted to use outside from ROS environment by splitting to individual package and removing dependencies to rosconsole.

See the MAVROS documentation and the libmavconn API reference for more details.

Connection URL

Connection defined by URL. Just pass one of that URL to MAVConnInterface::open_url() and get connection object.

Supported schemas:

  • Serial: /path/to/serial/device[:baudrate]
  • Serial: serial:///path/to/serial/device[:baudrate][?ids=sysid,compid]
  • Serial with hardware flow control: serial-hwfc:///path/to/serial/device[:baudrate][?ids=sysid,compid]
  • UDP: udp://[bind_host][:port]@[remote_host][:port][/?ids=sysid,compid]
  • UDP broadcast until GCS discovery: udp-b://[bind_host][:port]@[:port][/?ids=sysid,compid]
  • UDP broadcast (permanent): udp-pb://[bind_host][:port]@[:port][/?ids=sysid,compid]
  • TCP client: tcp://[server_host][:port][/?ids=sysid,compid]
  • TCP server: tcp-l://[bind_port][:port][/?ids=sysid,compid]

Note: ids from URL overrides ids given by system_id & component_id parameters.

Dependencies

Same as for mavros:

  • Linux host
  • Asio library ( https://think-async.com/Asio/ )
  • console-bridge library
  • compiler with C++20 support

Shared io_service (optional)

By default each connection owns and runs its own asio::io_service thread. For multi-connection setups you can provide a shared asio::io_service and run it from your own thread pool.

#include <asio.hpp>
#include <mavconn/interface.hpp>

asio::io_service shared_io;
auto work = std::make_unique<asio::io_service::work>(shared_io);
std::jthread io_thread([&]() { shared_io.run(); });

auto conn = mavconn::MAVConnInterface::open_url(
  "udp://0.0.0.0:14555@127.0.0.1:14550",
  1, mavconn::MAV_COMP_ID_UDP_BRIDGE,
  [](const mavlink::mavlink_message_t *, mavconn::Framing) {},
  {},
  &shared_io);

conn->close();
work.reset();
shared_io.stop();

License

Licensed under terms of LGPLv3, BSD, or GPLv3.

CHANGELOG

Changelog for package libmavconn

2.16.0 (2026-09-27)

  • Merge pull request #2290 from mavlink/fix-io-context libmavconn: fix IoContextRunner self-close lifetime and restart (fix #2275)
  • libmavconn: fix IoContextRunner self-close lifetime and restart (fix #2275) On a shutdown initiated from the owned I/O thread (self-close), join_owned() detaches the worker thread. The runner then called restart() while run() was still active on that thread (undefined behaviour) and, after the worker detached, could be destroyed while the thread still wrote is_running_. Move the io_context, work guard, and is_running flag into a heap-shared State that the worker thread also holds. The worker restarts the io_context only after run() returns, and the State (and thus the io_context) survives even if the owning connection is destroyed before the detached thread completes.
  • Merge pull request #2289 from mavlink/check-cbg plugins: fix cmd/command service deadlocks and const shared_ptr deprecation warnings
  • libmavconn: consume nodiscard result in baudrate test The serial baudrate regression test calls open_url_no_connect() expecting it to throw DeviceError; the [[nodiscard]] return was left unconsumed, producing -Wunused-result warnings. Capture it in a [[maybe_unused]] variable.
  • Merge pull request #2287 from christophebedard/christophebedard/fix-libmavconn-missing-ament-cmake-google-benchmark-dep
  • Add missing test_depend on ament_cmake_google_benchmark to libmavconn It's used in tests since #2256, but it wasn't declared as a (test) dependency, resulting in build failures on the ROS 2 buildfarm: https://build.ros2.org/view/Hbin_uJ64/job/Hbin_uJ64__libmavconn__ubuntu_jammy_amd64__binary/160/console ` 23:58:37 CMake Error at CMakeLists.txt:117 (find_package): 23:58:37 By not providing "Findament_cmake_google_benchmark.cmake" in 23:58:37 CMAKE_MODULE_PATH this project has asked CMake to find a package 23:58:37 configuration file provided by "ament_cmake_google_benchmark", but CMake 23:58:37 did not find one. 23:58:37 23:58:37 Could not find a package configuration file provided by 23:58:37 "ament_cmake_google_benchmark" with any of the following names: 23:58:37 23:58:37 ament_cmake_google_benchmarkConfig.cmake 23:58:37 ament_cmake_google_benchmark-config.cmake`
  • Contributors: Christophe Bedard, Vladimir Ermakov

2.15.1 (2026-08-22)

  • libmavconn: fix serial baudrate parsing above uint16 url_parse_host hardcoded a uint16 port limit and error label, which rejected serial baudrates above 65535 (e.g. 921600) with a misleading 'invalid port value' error. Make the value range and field name configurable and allow baudrate to use the full int range. Adds a regression test covering a high valid baudrate and invalid zero/non-numeric baudrates. Fix #2265
  • Merge pull request #2260 from mavlink/fix-deprecations Fix deprecations
  • libmavconn: fix deprecated literal operator whitespace
  • libmavconn: avoid -Wformat-security in format() with no args
  • Contributors: Vladimir Ermakov

2.15.0 (2026-08-08)

  • Merge pull request #2259 from mavlink/docs-refresh docs: refresh, refactor extractor

  • docs: refresh subpackage READMEs

    - mavros: point the API docs link at readthedocs/plugin reference instead of the dead wiki.ros.org page; fix ROS1 roslaunch examples to ros2 launch; note that up-to-date install instructions live in the readthedocs guide.

    • mavros_extras: link to the full plugin reference.
    • libmavconn: link to the docs and API reference.
    • mavros_msgs: add the missing README (message/service overview + API links).
    • test_mavros: mark the ROS1-era SITL hand-tests as historical.
  • Merge pull request #2256 from mavlink/try-optimize-router Optimize MAVROS router and MAVConn send path

  • libmavconn: speed up utils::format with a stack-buffer fast path The old format() called snprintf twice (once to measure, once to fill) and wrote through &ret.front()/capacity(), which is UB for empty output. Format into a small stack buffer first (single snprintf), re-formatting into a heap string only when the output exceeds it. Handles encoding errors and the empty-output case.

  • libmavconn: skip send post when chain active, use composed async_write Only the producer that turns the tx queue from idle to active posts a send handler; an in-progress chain drains everything enqueued meanwhile. This removes the per-message asio::post handler allocation and shared_from_this churn on the send path in steady state. Use composed asio::async_write for TCP/serial so partial writes are handled internally, deleting the manual MsgBuffer::pos tracking and resend loop (and the fragile capture of a reference into the tx queue).

File truncated at 100 lines see the full file

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged libmavconn at Robotics Stack Exchange

Package symbol

libmavconn package from mavros repo

libmavconn mavros mavros_examples mavros_extras mavros_msgs

ROS Distro
kilted

Package Summary

Version 2.16.0
License GPLv3
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Description
Checkout URI https://github.com/mavlink/mavros.git
VCS Type git
VCS Version ros2
Last Updated 2026-10-24
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

MAVLink communication library. This library provide unified connection handling classes and URL to connection object mapper. This library can be used in standalone programs.

Additional Links

Maintainers

  • Vladimir Ermakov

Authors

  • Vladimir Ermakov

MAVCONN library

It is mavlink connection and communication library used in MAVROS. Since 2014-11-02 it adopted to use outside from ROS environment by splitting to individual package and removing dependencies to rosconsole.

See the MAVROS documentation and the libmavconn API reference for more details.

Connection URL

Connection defined by URL. Just pass one of that URL to MAVConnInterface::open_url() and get connection object.

Supported schemas:

  • Serial: /path/to/serial/device[:baudrate]
  • Serial: serial:///path/to/serial/device[:baudrate][?ids=sysid,compid]
  • Serial with hardware flow control: serial-hwfc:///path/to/serial/device[:baudrate][?ids=sysid,compid]
  • UDP: udp://[bind_host][:port]@[remote_host][:port][/?ids=sysid,compid]
  • UDP broadcast until GCS discovery: udp-b://[bind_host][:port]@[:port][/?ids=sysid,compid]
  • UDP broadcast (permanent): udp-pb://[bind_host][:port]@[:port][/?ids=sysid,compid]
  • TCP client: tcp://[server_host][:port][/?ids=sysid,compid]
  • TCP server: tcp-l://[bind_port][:port][/?ids=sysid,compid]

Note: ids from URL overrides ids given by system_id & component_id parameters.

Dependencies

Same as for mavros:

  • Linux host
  • Asio library ( https://think-async.com/Asio/ )
  • console-bridge library
  • compiler with C++20 support

Shared io_service (optional)

By default each connection owns and runs its own asio::io_service thread. For multi-connection setups you can provide a shared asio::io_service and run it from your own thread pool.

#include <asio.hpp>
#include <mavconn/interface.hpp>

asio::io_service shared_io;
auto work = std::make_unique<asio::io_service::work>(shared_io);
std::jthread io_thread([&]() { shared_io.run(); });

auto conn = mavconn::MAVConnInterface::open_url(
  "udp://0.0.0.0:14555@127.0.0.1:14550",
  1, mavconn::MAV_COMP_ID_UDP_BRIDGE,
  [](const mavlink::mavlink_message_t *, mavconn::Framing) {},
  {},
  &shared_io);

conn->close();
work.reset();
shared_io.stop();

License

Licensed under terms of LGPLv3, BSD, or GPLv3.

CHANGELOG

Changelog for package libmavconn

2.16.0 (2026-09-27)

  • Merge pull request #2290 from mavlink/fix-io-context libmavconn: fix IoContextRunner self-close lifetime and restart (fix #2275)
  • libmavconn: fix IoContextRunner self-close lifetime and restart (fix #2275) On a shutdown initiated from the owned I/O thread (self-close), join_owned() detaches the worker thread. The runner then called restart() while run() was still active on that thread (undefined behaviour) and, after the worker detached, could be destroyed while the thread still wrote is_running_. Move the io_context, work guard, and is_running flag into a heap-shared State that the worker thread also holds. The worker restarts the io_context only after run() returns, and the State (and thus the io_context) survives even if the owning connection is destroyed before the detached thread completes.
  • Merge pull request #2289 from mavlink/check-cbg plugins: fix cmd/command service deadlocks and const shared_ptr deprecation warnings
  • libmavconn: consume nodiscard result in baudrate test The serial baudrate regression test calls open_url_no_connect() expecting it to throw DeviceError; the [[nodiscard]] return was left unconsumed, producing -Wunused-result warnings. Capture it in a [[maybe_unused]] variable.
  • Merge pull request #2287 from christophebedard/christophebedard/fix-libmavconn-missing-ament-cmake-google-benchmark-dep
  • Add missing test_depend on ament_cmake_google_benchmark to libmavconn It's used in tests since #2256, but it wasn't declared as a (test) dependency, resulting in build failures on the ROS 2 buildfarm: https://build.ros2.org/view/Hbin_uJ64/job/Hbin_uJ64__libmavconn__ubuntu_jammy_amd64__binary/160/console ` 23:58:37 CMake Error at CMakeLists.txt:117 (find_package): 23:58:37 By not providing "Findament_cmake_google_benchmark.cmake" in 23:58:37 CMAKE_MODULE_PATH this project has asked CMake to find a package 23:58:37 configuration file provided by "ament_cmake_google_benchmark", but CMake 23:58:37 did not find one. 23:58:37 23:58:37 Could not find a package configuration file provided by 23:58:37 "ament_cmake_google_benchmark" with any of the following names: 23:58:37 23:58:37 ament_cmake_google_benchmarkConfig.cmake 23:58:37 ament_cmake_google_benchmark-config.cmake`
  • Contributors: Christophe Bedard, Vladimir Ermakov

2.15.1 (2026-08-22)

  • libmavconn: fix serial baudrate parsing above uint16 url_parse_host hardcoded a uint16 port limit and error label, which rejected serial baudrates above 65535 (e.g. 921600) with a misleading 'invalid port value' error. Make the value range and field name configurable and allow baudrate to use the full int range. Adds a regression test covering a high valid baudrate and invalid zero/non-numeric baudrates. Fix #2265
  • Merge pull request #2260 from mavlink/fix-deprecations Fix deprecations
  • libmavconn: fix deprecated literal operator whitespace
  • libmavconn: avoid -Wformat-security in format() with no args
  • Contributors: Vladimir Ermakov

2.15.0 (2026-08-08)

  • Merge pull request #2259 from mavlink/docs-refresh docs: refresh, refactor extractor

  • docs: refresh subpackage READMEs

    - mavros: point the API docs link at readthedocs/plugin reference instead of the dead wiki.ros.org page; fix ROS1 roslaunch examples to ros2 launch; note that up-to-date install instructions live in the readthedocs guide.

    • mavros_extras: link to the full plugin reference.
    • libmavconn: link to the docs and API reference.
    • mavros_msgs: add the missing README (message/service overview + API links).
    • test_mavros: mark the ROS1-era SITL hand-tests as historical.
  • Merge pull request #2256 from mavlink/try-optimize-router Optimize MAVROS router and MAVConn send path

  • libmavconn: speed up utils::format with a stack-buffer fast path The old format() called snprintf twice (once to measure, once to fill) and wrote through &ret.front()/capacity(), which is UB for empty output. Format into a small stack buffer first (single snprintf), re-formatting into a heap string only when the output exceeds it. Handles encoding errors and the empty-output case.

  • libmavconn: skip send post when chain active, use composed async_write Only the producer that turns the tx queue from idle to active posts a send handler; an in-progress chain drains everything enqueued meanwhile. This removes the per-message asio::post handler allocation and shared_from_this churn on the send path in steady state. Use composed asio::async_write for TCP/serial so partial writes are handled internally, deleting the manual MsgBuffer::pos tracking and resend loop (and the fragile capture of a reference into the tx queue).

File truncated at 100 lines see the full file

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged libmavconn at Robotics Stack Exchange

Package symbol

libmavconn package from mavros repo

libmavconn mavros mavros_examples mavros_extras mavros_msgs

ROS Distro
lyrical

Package Summary

Version 2.16.0
License GPLv3
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Description
Checkout URI https://github.com/mavlink/mavros.git
VCS Type git
VCS Version ros2
Last Updated 2026-10-24
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

MAVLink communication library. This library provide unified connection handling classes and URL to connection object mapper. This library can be used in standalone programs.

Additional Links

Maintainers

  • Vladimir Ermakov

Authors

  • Vladimir Ermakov

MAVCONN library

It is mavlink connection and communication library used in MAVROS. Since 2014-11-02 it adopted to use outside from ROS environment by splitting to individual package and removing dependencies to rosconsole.

See the MAVROS documentation and the libmavconn API reference for more details.

Connection URL

Connection defined by URL. Just pass one of that URL to MAVConnInterface::open_url() and get connection object.

Supported schemas:

  • Serial: /path/to/serial/device[:baudrate]
  • Serial: serial:///path/to/serial/device[:baudrate][?ids=sysid,compid]
  • Serial with hardware flow control: serial-hwfc:///path/to/serial/device[:baudrate][?ids=sysid,compid]
  • UDP: udp://[bind_host][:port]@[remote_host][:port][/?ids=sysid,compid]
  • UDP broadcast until GCS discovery: udp-b://[bind_host][:port]@[:port][/?ids=sysid,compid]
  • UDP broadcast (permanent): udp-pb://[bind_host][:port]@[:port][/?ids=sysid,compid]
  • TCP client: tcp://[server_host][:port][/?ids=sysid,compid]
  • TCP server: tcp-l://[bind_port][:port][/?ids=sysid,compid]

Note: ids from URL overrides ids given by system_id & component_id parameters.

Dependencies

Same as for mavros:

  • Linux host
  • Asio library ( https://think-async.com/Asio/ )
  • console-bridge library
  • compiler with C++20 support

Shared io_service (optional)

By default each connection owns and runs its own asio::io_service thread. For multi-connection setups you can provide a shared asio::io_service and run it from your own thread pool.

#include <asio.hpp>
#include <mavconn/interface.hpp>

asio::io_service shared_io;
auto work = std::make_unique<asio::io_service::work>(shared_io);
std::jthread io_thread([&]() { shared_io.run(); });

auto conn = mavconn::MAVConnInterface::open_url(
  "udp://0.0.0.0:14555@127.0.0.1:14550",
  1, mavconn::MAV_COMP_ID_UDP_BRIDGE,
  [](const mavlink::mavlink_message_t *, mavconn::Framing) {},
  {},
  &shared_io);

conn->close();
work.reset();
shared_io.stop();

License

Licensed under terms of LGPLv3, BSD, or GPLv3.

CHANGELOG

Changelog for package libmavconn

2.16.0 (2026-09-27)

  • Merge pull request #2290 from mavlink/fix-io-context libmavconn: fix IoContextRunner self-close lifetime and restart (fix #2275)
  • libmavconn: fix IoContextRunner self-close lifetime and restart (fix #2275) On a shutdown initiated from the owned I/O thread (self-close), join_owned() detaches the worker thread. The runner then called restart() while run() was still active on that thread (undefined behaviour) and, after the worker detached, could be destroyed while the thread still wrote is_running_. Move the io_context, work guard, and is_running flag into a heap-shared State that the worker thread also holds. The worker restarts the io_context only after run() returns, and the State (and thus the io_context) survives even if the owning connection is destroyed before the detached thread completes.
  • Merge pull request #2289 from mavlink/check-cbg plugins: fix cmd/command service deadlocks and const shared_ptr deprecation warnings
  • libmavconn: consume nodiscard result in baudrate test The serial baudrate regression test calls open_url_no_connect() expecting it to throw DeviceError; the [[nodiscard]] return was left unconsumed, producing -Wunused-result warnings. Capture it in a [[maybe_unused]] variable.
  • Merge pull request #2287 from christophebedard/christophebedard/fix-libmavconn-missing-ament-cmake-google-benchmark-dep
  • Add missing test_depend on ament_cmake_google_benchmark to libmavconn It's used in tests since #2256, but it wasn't declared as a (test) dependency, resulting in build failures on the ROS 2 buildfarm: https://build.ros2.org/view/Hbin_uJ64/job/Hbin_uJ64__libmavconn__ubuntu_jammy_amd64__binary/160/console ` 23:58:37 CMake Error at CMakeLists.txt:117 (find_package): 23:58:37 By not providing "Findament_cmake_google_benchmark.cmake" in 23:58:37 CMAKE_MODULE_PATH this project has asked CMake to find a package 23:58:37 configuration file provided by "ament_cmake_google_benchmark", but CMake 23:58:37 did not find one. 23:58:37 23:58:37 Could not find a package configuration file provided by 23:58:37 "ament_cmake_google_benchmark" with any of the following names: 23:58:37 23:58:37 ament_cmake_google_benchmarkConfig.cmake 23:58:37 ament_cmake_google_benchmark-config.cmake`
  • Contributors: Christophe Bedard, Vladimir Ermakov

2.15.1 (2026-08-22)

  • libmavconn: fix serial baudrate parsing above uint16 url_parse_host hardcoded a uint16 port limit and error label, which rejected serial baudrates above 65535 (e.g. 921600) with a misleading 'invalid port value' error. Make the value range and field name configurable and allow baudrate to use the full int range. Adds a regression test covering a high valid baudrate and invalid zero/non-numeric baudrates. Fix #2265
  • Merge pull request #2260 from mavlink/fix-deprecations Fix deprecations
  • libmavconn: fix deprecated literal operator whitespace
  • libmavconn: avoid -Wformat-security in format() with no args
  • Contributors: Vladimir Ermakov

2.15.0 (2026-08-08)

  • Merge pull request #2259 from mavlink/docs-refresh docs: refresh, refactor extractor

  • docs: refresh subpackage READMEs

    - mavros: point the API docs link at readthedocs/plugin reference instead of the dead wiki.ros.org page; fix ROS1 roslaunch examples to ros2 launch; note that up-to-date install instructions live in the readthedocs guide.

    • mavros_extras: link to the full plugin reference.
    • libmavconn: link to the docs and API reference.
    • mavros_msgs: add the missing README (message/service overview + API links).
    • test_mavros: mark the ROS1-era SITL hand-tests as historical.
  • Merge pull request #2256 from mavlink/try-optimize-router Optimize MAVROS router and MAVConn send path

  • libmavconn: speed up utils::format with a stack-buffer fast path The old format() called snprintf twice (once to measure, once to fill) and wrote through &ret.front()/capacity(), which is UB for empty output. Format into a small stack buffer first (single snprintf), re-formatting into a heap string only when the output exceeds it. Handles encoding errors and the empty-output case.

  • libmavconn: skip send post when chain active, use composed async_write Only the producer that turns the tx queue from idle to active posts a send handler; an in-progress chain drains everything enqueued meanwhile. This removes the per-message asio::post handler allocation and shared_from_this churn on the send path in steady state. Use composed asio::async_write for TCP/serial so partial writes are handled internally, deleting the manual MsgBuffer::pos tracking and resend loop (and the fragile capture of a reference into the tx queue).

File truncated at 100 lines see the full file

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged libmavconn at Robotics Stack Exchange

Package symbol

libmavconn package from mavros repo

libmavconn mavros mavros_examples mavros_extras mavros_msgs

ROS Distro
rolling

Package Summary

Version 2.16.0
License GPLv3
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Description
Checkout URI https://github.com/mavlink/mavros.git
VCS Type git
VCS Version ros2
Last Updated 2026-10-24
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

MAVLink communication library. This library provide unified connection handling classes and URL to connection object mapper. This library can be used in standalone programs.

Additional Links

Maintainers

  • Vladimir Ermakov

Authors

  • Vladimir Ermakov

MAVCONN library

It is mavlink connection and communication library used in MAVROS. Since 2014-11-02 it adopted to use outside from ROS environment by splitting to individual package and removing dependencies to rosconsole.

See the MAVROS documentation and the libmavconn API reference for more details.

Connection URL

Connection defined by URL. Just pass one of that URL to MAVConnInterface::open_url() and get connection object.

Supported schemas:

  • Serial: /path/to/serial/device[:baudrate]
  • Serial: serial:///path/to/serial/device[:baudrate][?ids=sysid,compid]
  • Serial with hardware flow control: serial-hwfc:///path/to/serial/device[:baudrate][?ids=sysid,compid]
  • UDP: udp://[bind_host][:port]@[remote_host][:port][/?ids=sysid,compid]
  • UDP broadcast until GCS discovery: udp-b://[bind_host][:port]@[:port][/?ids=sysid,compid]
  • UDP broadcast (permanent): udp-pb://[bind_host][:port]@[:port][/?ids=sysid,compid]
  • TCP client: tcp://[server_host][:port][/?ids=sysid,compid]
  • TCP server: tcp-l://[bind_port][:port][/?ids=sysid,compid]

Note: ids from URL overrides ids given by system_id & component_id parameters.

Dependencies

Same as for mavros:

  • Linux host
  • Asio library ( https://think-async.com/Asio/ )
  • console-bridge library
  • compiler with C++20 support

Shared io_service (optional)

By default each connection owns and runs its own asio::io_service thread. For multi-connection setups you can provide a shared asio::io_service and run it from your own thread pool.

#include <asio.hpp>
#include <mavconn/interface.hpp>

asio::io_service shared_io;
auto work = std::make_unique<asio::io_service::work>(shared_io);
std::jthread io_thread([&]() { shared_io.run(); });

auto conn = mavconn::MAVConnInterface::open_url(
  "udp://0.0.0.0:14555@127.0.0.1:14550",
  1, mavconn::MAV_COMP_ID_UDP_BRIDGE,
  [](const mavlink::mavlink_message_t *, mavconn::Framing) {},
  {},
  &shared_io);

conn->close();
work.reset();
shared_io.stop();

License

Licensed under terms of LGPLv3, BSD, or GPLv3.

CHANGELOG

Changelog for package libmavconn

2.16.0 (2026-09-27)

  • Merge pull request #2290 from mavlink/fix-io-context libmavconn: fix IoContextRunner self-close lifetime and restart (fix #2275)
  • libmavconn: fix IoContextRunner self-close lifetime and restart (fix #2275) On a shutdown initiated from the owned I/O thread (self-close), join_owned() detaches the worker thread. The runner then called restart() while run() was still active on that thread (undefined behaviour) and, after the worker detached, could be destroyed while the thread still wrote is_running_. Move the io_context, work guard, and is_running flag into a heap-shared State that the worker thread also holds. The worker restarts the io_context only after run() returns, and the State (and thus the io_context) survives even if the owning connection is destroyed before the detached thread completes.
  • Merge pull request #2289 from mavlink/check-cbg plugins: fix cmd/command service deadlocks and const shared_ptr deprecation warnings
  • libmavconn: consume nodiscard result in baudrate test The serial baudrate regression test calls open_url_no_connect() expecting it to throw DeviceError; the [[nodiscard]] return was left unconsumed, producing -Wunused-result warnings. Capture it in a [[maybe_unused]] variable.
  • Merge pull request #2287 from christophebedard/christophebedard/fix-libmavconn-missing-ament-cmake-google-benchmark-dep
  • Add missing test_depend on ament_cmake_google_benchmark to libmavconn It's used in tests since #2256, but it wasn't declared as a (test) dependency, resulting in build failures on the ROS 2 buildfarm: https://build.ros2.org/view/Hbin_uJ64/job/Hbin_uJ64__libmavconn__ubuntu_jammy_amd64__binary/160/console ` 23:58:37 CMake Error at CMakeLists.txt:117 (find_package): 23:58:37 By not providing "Findament_cmake_google_benchmark.cmake" in 23:58:37 CMAKE_MODULE_PATH this project has asked CMake to find a package 23:58:37 configuration file provided by "ament_cmake_google_benchmark", but CMake 23:58:37 did not find one. 23:58:37 23:58:37 Could not find a package configuration file provided by 23:58:37 "ament_cmake_google_benchmark" with any of the following names: 23:58:37 23:58:37 ament_cmake_google_benchmarkConfig.cmake 23:58:37 ament_cmake_google_benchmark-config.cmake`
  • Contributors: Christophe Bedard, Vladimir Ermakov

2.15.1 (2026-08-22)

  • libmavconn: fix serial baudrate parsing above uint16 url_parse_host hardcoded a uint16 port limit and error label, which rejected serial baudrates above 65535 (e.g. 921600) with a misleading 'invalid port value' error. Make the value range and field name configurable and allow baudrate to use the full int range. Adds a regression test covering a high valid baudrate and invalid zero/non-numeric baudrates. Fix #2265
  • Merge pull request #2260 from mavlink/fix-deprecations Fix deprecations
  • libmavconn: fix deprecated literal operator whitespace
  • libmavconn: avoid -Wformat-security in format() with no args
  • Contributors: Vladimir Ermakov

2.15.0 (2026-08-08)

  • Merge pull request #2259 from mavlink/docs-refresh docs: refresh, refactor extractor

  • docs: refresh subpackage READMEs

    - mavros: point the API docs link at readthedocs/plugin reference instead of the dead wiki.ros.org page; fix ROS1 roslaunch examples to ros2 launch; note that up-to-date install instructions live in the readthedocs guide.

    • mavros_extras: link to the full plugin reference.
    • libmavconn: link to the docs and API reference.
    • mavros_msgs: add the missing README (message/service overview + API links).
    • test_mavros: mark the ROS1-era SITL hand-tests as historical.
  • Merge pull request #2256 from mavlink/try-optimize-router Optimize MAVROS router and MAVConn send path

  • libmavconn: speed up utils::format with a stack-buffer fast path The old format() called snprintf twice (once to measure, once to fill) and wrote through &ret.front()/capacity(), which is UB for empty output. Format into a small stack buffer first (single snprintf), re-formatting into a heap string only when the output exceeds it. Handles encoding errors and the empty-output case.

  • libmavconn: skip send post when chain active, use composed async_write Only the producer that turns the tx queue from idle to active posts a send handler; an in-progress chain drains everything enqueued meanwhile. This removes the per-message asio::post handler allocation and shared_from_this churn on the send path in steady state. Use composed asio::async_write for TCP/serial so partial writes are handled internally, deleting the manual MsgBuffer::pos tracking and resend loop (and the fragile capture of a reference into the tx queue).

File truncated at 100 lines see the full file

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged libmavconn at Robotics Stack Exchange

Package Summary

Version 1.5.1
License GPLv3
Build type CATKIN
Use RECOMMENDED

Repository Summary

Description
Checkout URI https://github.com/arijitnoobstar/uavprojectilecatcher.git
VCS Type git
VCS Version master
Last Updated 2021-05-16
Dev Status UNKNOWN
Released UNRELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

MAVLink communication library. This library provide unified connection handling classes and URL to connection object mapper. This library can be used in standalone programs.

Additional Links

Maintainers

  • Vladimir Ermakov

Authors

  • Vladimir Ermakov

MAVCONN library

It is mavlink connection and communication library used in MAVROS. Since 2014-11-02 it adopted to use outside from ROS environment by splitting to individual package and removing dependencies to rosconsole.

Connection URL

Connection defined by URL. Just pass one of that URL to MAVConnInterface::open_url() and get connection object.

Supported schemas:

  • Serial: /path/to/serial/device[:baudrate]
  • Serial: serial:///path/to/serial/device[:baudrate][?ids=sysid,compid]
  • Serial with hardware flow control: serial-hwfc:///path/to/serial/device[:baudrate][?ids=sysid,compid]
  • UDP: udp://[bind_host][:port]@[remote_host][:port][/?ids=sysid,compid]
  • UDP broadcast until GCS discovery: udp-b://[bind_host][:port]@[:port][/?ids=sysid,compid]
  • UDP broadcast (permanent): udp-pb://[bind_host][:port]@[:port][/?ids=sysid,compid]
  • TCP client: tcp://[server_host][:port][/?ids=sysid,compid]
  • TCP server: tcp-l://[bind_port][:port][/?ids=sysid,compid]

Note: ids from URL overrides ids given by system_id & component_id parameters.

Dependencies

Same as for mavros:

  • Linux host
  • Boost >= 1.46 (used Boost.ASIO)
  • console-bridge library
  • compiller with C++11 support

License

Licensed under terms of LGPLv3, BSD, or GPLv3.

CHANGELOG

Changelog for package libmavconn

1.5.1 (2021-01-04)

  • Fix test for renaming of HEARTBEAT
  • Initialise message structures Uninitialised Mavlink 2 extension fields were sent if the fields were not later set. Initialising the fields to zero is the default value for extension fields and appears to the receiver as though sender is unaware of Mavlink 2. Instances were found with regex below, more may exist: mavlink::[\^:]+::msg::[\^:={]+ ?[\^:={]*;
  • Contributors: Rob Clarke

1.5.0 (2020-11-11)

  • libmavconn: Fix build warnings
  • Contributors: Morten Fyhn Amundsen

1.4.0 (2020-09-11)

  • Dispatch GCS IP address
  • Contributors: Morten Fyhn Amundsen

1.3.0 (2020-08-08)

  • allow mavros to compile in CI environment
  • Contributors: Marcelino

1.2.0 (2020-05-22)

1.1.0 (2020-04-04)

1.0.0 (2020-01-01)

0.33.4 (2019-12-12)

  • add macro for get_io_service() to work with boost>1.70
  • Contributors: acxz

0.33.3 (2019-11-13)

0.33.2 (2019-11-13)

0.33.1 (2019-11-11)

  • resolved merge conflict
  • Contributors: David Jablonski

0.33.0 (2019-10-10)

  • libmavconn: simplify parse_buffer, and fix dropped_packets and parse_error counters Currently the dropped_packets & parse_error counters are always published as 0 in mavros_diag.cpp. This seems to be caused by using the wrong status struct. Seems like mavros was editing m_status after mavlink_frame_char_buffer. This struct seems to be the parsing state, and looks like it shouldn't be modified by the caller (for example status->parse_error is zeroed out in the end of mavlink_frame_char_buffer). Also, the crc & signature checks done in mavros seems redundant. r_mavlink_status seems to be the struct that holds the mavlink connection information, therefore I changed get_status to return it instead. This fixes #1285.
  • Contributors: Koby Aizer

0.32.2 (2019-09-09)

0.32.1 (2019-08-08)

0.32.0 (2019-07-06)

0.31.0 (2019-06-07)

  • readme: fix udp-pb formatting
  • Contributors: Vladimir Ermakov

0.30.0 (2019-05-20)

0.29.2 (2019-03-06)

0.29.1 (2019-03-03)

  • All: catkin lint files
  • Contributors: Pierre Kancir

0.29.0 (2019-02-02)

  • Merge branch 'master' into param-timeout
  • libmavconn: Fix building without installation. Detect CI environment
  • ci:test: temporary disable failed udp bind test
  • mavconn:pkg: Move generated files to build tree
  • Contributors: Vladimir Ermakov

0.28.0 (2019-01-03)

  • libmavconn: add the possibility to set the source component ID through the send_message method
  • Contributors: TSC21

0.27.0 (2018-11-12)

File truncated at 100 lines see the full file

Package Dependencies

System Dependencies

Dependant Packages

Name Deps
px4
mavros

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged libmavconn at Robotics Stack Exchange

Package symbol

libmavconn package from mavros repo

libmavconn mavros mavros_examples mavros_extras mavros_msgs

ROS Distro
galactic

Package Summary

Version 2.16.0
License GPLv3
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Description
Checkout URI https://github.com/mavlink/mavros.git
VCS Type git
VCS Version ros2
Last Updated 2026-10-24
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

MAVLink communication library. This library provide unified connection handling classes and URL to connection object mapper. This library can be used in standalone programs.

Additional Links

Maintainers

  • Vladimir Ermakov

Authors

  • Vladimir Ermakov

MAVCONN library

It is mavlink connection and communication library used in MAVROS. Since 2014-11-02 it adopted to use outside from ROS environment by splitting to individual package and removing dependencies to rosconsole.

See the MAVROS documentation and the libmavconn API reference for more details.

Connection URL

Connection defined by URL. Just pass one of that URL to MAVConnInterface::open_url() and get connection object.

Supported schemas:

  • Serial: /path/to/serial/device[:baudrate]
  • Serial: serial:///path/to/serial/device[:baudrate][?ids=sysid,compid]
  • Serial with hardware flow control: serial-hwfc:///path/to/serial/device[:baudrate][?ids=sysid,compid]
  • UDP: udp://[bind_host][:port]@[remote_host][:port][/?ids=sysid,compid]
  • UDP broadcast until GCS discovery: udp-b://[bind_host][:port]@[:port][/?ids=sysid,compid]
  • UDP broadcast (permanent): udp-pb://[bind_host][:port]@[:port][/?ids=sysid,compid]
  • TCP client: tcp://[server_host][:port][/?ids=sysid,compid]
  • TCP server: tcp-l://[bind_port][:port][/?ids=sysid,compid]

Note: ids from URL overrides ids given by system_id & component_id parameters.

Dependencies

Same as for mavros:

  • Linux host
  • Asio library ( https://think-async.com/Asio/ )
  • console-bridge library
  • compiler with C++20 support

Shared io_service (optional)

By default each connection owns and runs its own asio::io_service thread. For multi-connection setups you can provide a shared asio::io_service and run it from your own thread pool.

#include <asio.hpp>
#include <mavconn/interface.hpp>

asio::io_service shared_io;
auto work = std::make_unique<asio::io_service::work>(shared_io);
std::jthread io_thread([&]() { shared_io.run(); });

auto conn = mavconn::MAVConnInterface::open_url(
  "udp://0.0.0.0:14555@127.0.0.1:14550",
  1, mavconn::MAV_COMP_ID_UDP_BRIDGE,
  [](const mavlink::mavlink_message_t *, mavconn::Framing) {},
  {},
  &shared_io);

conn->close();
work.reset();
shared_io.stop();

License

Licensed under terms of LGPLv3, BSD, or GPLv3.

CHANGELOG

Changelog for package libmavconn

2.16.0 (2026-09-27)

  • Merge pull request #2290 from mavlink/fix-io-context libmavconn: fix IoContextRunner self-close lifetime and restart (fix #2275)
  • libmavconn: fix IoContextRunner self-close lifetime and restart (fix #2275) On a shutdown initiated from the owned I/O thread (self-close), join_owned() detaches the worker thread. The runner then called restart() while run() was still active on that thread (undefined behaviour) and, after the worker detached, could be destroyed while the thread still wrote is_running_. Move the io_context, work guard, and is_running flag into a heap-shared State that the worker thread also holds. The worker restarts the io_context only after run() returns, and the State (and thus the io_context) survives even if the owning connection is destroyed before the detached thread completes.
  • Merge pull request #2289 from mavlink/check-cbg plugins: fix cmd/command service deadlocks and const shared_ptr deprecation warnings
  • libmavconn: consume nodiscard result in baudrate test The serial baudrate regression test calls open_url_no_connect() expecting it to throw DeviceError; the [[nodiscard]] return was left unconsumed, producing -Wunused-result warnings. Capture it in a [[maybe_unused]] variable.
  • Merge pull request #2287 from christophebedard/christophebedard/fix-libmavconn-missing-ament-cmake-google-benchmark-dep
  • Add missing test_depend on ament_cmake_google_benchmark to libmavconn It's used in tests since #2256, but it wasn't declared as a (test) dependency, resulting in build failures on the ROS 2 buildfarm: https://build.ros2.org/view/Hbin_uJ64/job/Hbin_uJ64__libmavconn__ubuntu_jammy_amd64__binary/160/console ` 23:58:37 CMake Error at CMakeLists.txt:117 (find_package): 23:58:37 By not providing "Findament_cmake_google_benchmark.cmake" in 23:58:37 CMAKE_MODULE_PATH this project has asked CMake to find a package 23:58:37 configuration file provided by "ament_cmake_google_benchmark", but CMake 23:58:37 did not find one. 23:58:37 23:58:37 Could not find a package configuration file provided by 23:58:37 "ament_cmake_google_benchmark" with any of the following names: 23:58:37 23:58:37 ament_cmake_google_benchmarkConfig.cmake 23:58:37 ament_cmake_google_benchmark-config.cmake`
  • Contributors: Christophe Bedard, Vladimir Ermakov

2.15.1 (2026-08-22)

  • libmavconn: fix serial baudrate parsing above uint16 url_parse_host hardcoded a uint16 port limit and error label, which rejected serial baudrates above 65535 (e.g. 921600) with a misleading 'invalid port value' error. Make the value range and field name configurable and allow baudrate to use the full int range. Adds a regression test covering a high valid baudrate and invalid zero/non-numeric baudrates. Fix #2265
  • Merge pull request #2260 from mavlink/fix-deprecations Fix deprecations
  • libmavconn: fix deprecated literal operator whitespace
  • libmavconn: avoid -Wformat-security in format() with no args
  • Contributors: Vladimir Ermakov

2.15.0 (2026-08-08)

  • Merge pull request #2259 from mavlink/docs-refresh docs: refresh, refactor extractor

  • docs: refresh subpackage READMEs

    - mavros: point the API docs link at readthedocs/plugin reference instead of the dead wiki.ros.org page; fix ROS1 roslaunch examples to ros2 launch; note that up-to-date install instructions live in the readthedocs guide.

    • mavros_extras: link to the full plugin reference.
    • libmavconn: link to the docs and API reference.
    • mavros_msgs: add the missing README (message/service overview + API links).
    • test_mavros: mark the ROS1-era SITL hand-tests as historical.
  • Merge pull request #2256 from mavlink/try-optimize-router Optimize MAVROS router and MAVConn send path

  • libmavconn: speed up utils::format with a stack-buffer fast path The old format() called snprintf twice (once to measure, once to fill) and wrote through &ret.front()/capacity(), which is UB for empty output. Format into a small stack buffer first (single snprintf), re-formatting into a heap string only when the output exceeds it. Handles encoding errors and the empty-output case.

  • libmavconn: skip send post when chain active, use composed async_write Only the producer that turns the tx queue from idle to active posts a send handler; an in-progress chain drains everything enqueued meanwhile. This removes the per-message asio::post handler allocation and shared_from_this churn on the send path in steady state. Use composed asio::async_write for TCP/serial so partial writes are handled internally, deleting the manual MsgBuffer::pos tracking and resend loop (and the fragile capture of a reference into the tx queue).

File truncated at 100 lines see the full file

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged libmavconn at Robotics Stack Exchange

Package symbol

libmavconn package from mavros repo

libmavconn mavros mavros_examples mavros_extras mavros_msgs

ROS Distro
iron

Package Summary

Version 2.16.0
License GPLv3
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Description
Checkout URI https://github.com/mavlink/mavros.git
VCS Type git
VCS Version ros2
Last Updated 2026-10-24
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

MAVLink communication library. This library provide unified connection handling classes and URL to connection object mapper. This library can be used in standalone programs.

Additional Links

Maintainers

  • Vladimir Ermakov

Authors

  • Vladimir Ermakov

MAVCONN library

It is mavlink connection and communication library used in MAVROS. Since 2014-11-02 it adopted to use outside from ROS environment by splitting to individual package and removing dependencies to rosconsole.

See the MAVROS documentation and the libmavconn API reference for more details.

Connection URL

Connection defined by URL. Just pass one of that URL to MAVConnInterface::open_url() and get connection object.

Supported schemas:

  • Serial: /path/to/serial/device[:baudrate]
  • Serial: serial:///path/to/serial/device[:baudrate][?ids=sysid,compid]
  • Serial with hardware flow control: serial-hwfc:///path/to/serial/device[:baudrate][?ids=sysid,compid]
  • UDP: udp://[bind_host][:port]@[remote_host][:port][/?ids=sysid,compid]
  • UDP broadcast until GCS discovery: udp-b://[bind_host][:port]@[:port][/?ids=sysid,compid]
  • UDP broadcast (permanent): udp-pb://[bind_host][:port]@[:port][/?ids=sysid,compid]
  • TCP client: tcp://[server_host][:port][/?ids=sysid,compid]
  • TCP server: tcp-l://[bind_port][:port][/?ids=sysid,compid]

Note: ids from URL overrides ids given by system_id & component_id parameters.

Dependencies

Same as for mavros:

  • Linux host
  • Asio library ( https://think-async.com/Asio/ )
  • console-bridge library
  • compiler with C++20 support

Shared io_service (optional)

By default each connection owns and runs its own asio::io_service thread. For multi-connection setups you can provide a shared asio::io_service and run it from your own thread pool.

#include <asio.hpp>
#include <mavconn/interface.hpp>

asio::io_service shared_io;
auto work = std::make_unique<asio::io_service::work>(shared_io);
std::jthread io_thread([&]() { shared_io.run(); });

auto conn = mavconn::MAVConnInterface::open_url(
  "udp://0.0.0.0:14555@127.0.0.1:14550",
  1, mavconn::MAV_COMP_ID_UDP_BRIDGE,
  [](const mavlink::mavlink_message_t *, mavconn::Framing) {},
  {},
  &shared_io);

conn->close();
work.reset();
shared_io.stop();

License

Licensed under terms of LGPLv3, BSD, or GPLv3.

CHANGELOG

Changelog for package libmavconn

2.16.0 (2026-09-27)

  • Merge pull request #2290 from mavlink/fix-io-context libmavconn: fix IoContextRunner self-close lifetime and restart (fix #2275)
  • libmavconn: fix IoContextRunner self-close lifetime and restart (fix #2275) On a shutdown initiated from the owned I/O thread (self-close), join_owned() detaches the worker thread. The runner then called restart() while run() was still active on that thread (undefined behaviour) and, after the worker detached, could be destroyed while the thread still wrote is_running_. Move the io_context, work guard, and is_running flag into a heap-shared State that the worker thread also holds. The worker restarts the io_context only after run() returns, and the State (and thus the io_context) survives even if the owning connection is destroyed before the detached thread completes.
  • Merge pull request #2289 from mavlink/check-cbg plugins: fix cmd/command service deadlocks and const shared_ptr deprecation warnings
  • libmavconn: consume nodiscard result in baudrate test The serial baudrate regression test calls open_url_no_connect() expecting it to throw DeviceError; the [[nodiscard]] return was left unconsumed, producing -Wunused-result warnings. Capture it in a [[maybe_unused]] variable.
  • Merge pull request #2287 from christophebedard/christophebedard/fix-libmavconn-missing-ament-cmake-google-benchmark-dep
  • Add missing test_depend on ament_cmake_google_benchmark to libmavconn It's used in tests since #2256, but it wasn't declared as a (test) dependency, resulting in build failures on the ROS 2 buildfarm: https://build.ros2.org/view/Hbin_uJ64/job/Hbin_uJ64__libmavconn__ubuntu_jammy_amd64__binary/160/console ` 23:58:37 CMake Error at CMakeLists.txt:117 (find_package): 23:58:37 By not providing "Findament_cmake_google_benchmark.cmake" in 23:58:37 CMAKE_MODULE_PATH this project has asked CMake to find a package 23:58:37 configuration file provided by "ament_cmake_google_benchmark", but CMake 23:58:37 did not find one. 23:58:37 23:58:37 Could not find a package configuration file provided by 23:58:37 "ament_cmake_google_benchmark" with any of the following names: 23:58:37 23:58:37 ament_cmake_google_benchmarkConfig.cmake 23:58:37 ament_cmake_google_benchmark-config.cmake`
  • Contributors: Christophe Bedard, Vladimir Ermakov

2.15.1 (2026-08-22)

  • libmavconn: fix serial baudrate parsing above uint16 url_parse_host hardcoded a uint16 port limit and error label, which rejected serial baudrates above 65535 (e.g. 921600) with a misleading 'invalid port value' error. Make the value range and field name configurable and allow baudrate to use the full int range. Adds a regression test covering a high valid baudrate and invalid zero/non-numeric baudrates. Fix #2265
  • Merge pull request #2260 from mavlink/fix-deprecations Fix deprecations
  • libmavconn: fix deprecated literal operator whitespace
  • libmavconn: avoid -Wformat-security in format() with no args
  • Contributors: Vladimir Ermakov

2.15.0 (2026-08-08)

  • Merge pull request #2259 from mavlink/docs-refresh docs: refresh, refactor extractor

  • docs: refresh subpackage READMEs

    - mavros: point the API docs link at readthedocs/plugin reference instead of the dead wiki.ros.org page; fix ROS1 roslaunch examples to ros2 launch; note that up-to-date install instructions live in the readthedocs guide.

    • mavros_extras: link to the full plugin reference.
    • libmavconn: link to the docs and API reference.
    • mavros_msgs: add the missing README (message/service overview + API links).
    • test_mavros: mark the ROS1-era SITL hand-tests as historical.
  • Merge pull request #2256 from mavlink/try-optimize-router Optimize MAVROS router and MAVConn send path

  • libmavconn: speed up utils::format with a stack-buffer fast path The old format() called snprintf twice (once to measure, once to fill) and wrote through &ret.front()/capacity(), which is UB for empty output. Format into a small stack buffer first (single snprintf), re-formatting into a heap string only when the output exceeds it. Handles encoding errors and the empty-output case.

  • libmavconn: skip send post when chain active, use composed async_write Only the producer that turns the tx queue from idle to active posts a send handler; an in-progress chain drains everything enqueued meanwhile. This removes the per-message asio::post handler allocation and shared_from_this churn on the send path in steady state. Use composed asio::async_write for TCP/serial so partial writes are handled internally, deleting the manual MsgBuffer::pos tracking and resend loop (and the fragile capture of a reference into the tx queue).

File truncated at 100 lines see the full file

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged libmavconn at Robotics Stack Exchange

Package symbol

libmavconn package from mavros repo

libmavconn mavros mavros_extras mavros_msgs test_mavros

ROS Distro
melodic

Package Summary

Version 1.21.1
License GPLv3
Build type CATKIN
Use RECOMMENDED

Repository Summary

Description
Checkout URI https://github.com/mavlink/mavros.git
VCS Type git
VCS Version master
Last Updated 2025-12-12
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

MAVLink communication library. This library provide unified connection handling classes and URL to connection object mapper. This library can be used in standalone programs.

Additional Links

Maintainers

  • Vladimir Ermakov

Authors

  • Vladimir Ermakov

MAVCONN library

It is mavlink connection and communication library used in MAVROS. Since 2014-11-02 it adopted to use outside from ROS environment by splitting to individual package and removing dependencies to rosconsole.

Connection URL

Connection defined by URL. Just pass one of that URL to MAVConnInterface::open_url() and get connection object.

Supported schemas:

  • Serial: /path/to/serial/device[:baudrate]
  • Serial: serial:///path/to/serial/device[:baudrate][?ids=sysid,compid]
  • Serial with hardware flow control: serial-hwfc:///path/to/serial/device[:baudrate][?ids=sysid,compid]
  • UDP: udp://[bind_host][:port]@[remote_host][:port][/?ids=sysid,compid]
  • UDP broadcast until GCS discovery: udp-b://[bind_host][:port]@[:port][/?ids=sysid,compid]
  • UDP broadcast (permanent): udp-pb://[bind_host][:port]@[:port][/?ids=sysid,compid]
  • TCP client: tcp://[server_host][:port][/?ids=sysid,compid]
  • TCP server: tcp-l://[bind_port][:port][/?ids=sysid,compid]

Note: ids from URL overrides ids given by system_id & component_id parameters.

Dependencies

Same as for mavros:

  • Linux host
  • Boost >= 1.46 (used Boost.ASIO)
  • console-bridge library
  • compiller with C++11 support

License

Licensed under terms of LGPLv3, BSD, or GPLv3.

CHANGELOG

Changelog for package libmavconn

1.21.1 (2025-12-12)

1.21.0 (2025-09-08)

  • regenerate all
  • Contributors: Vladimir Ermakov

1.20.1 (2025-05-05)

1.20.0 (2024-10-10)

1.19.0 (2024-06-06)

1.18.0 (2024-03-03)

1.17.0 (2023-09-09)

  • Merge pull request #1865 from scoutdi/warnings Fix / suppress some build warnings
  • Suppress warnings from included headers
  • Contributors: Morten Fyhn Amundsen, Vladimir Ermakov

1.16.0 (2023-05-05)

1.15.0 (2022-12-30)

  • Merge pull request #1794 from rossizero/master libmavconn: fix MAVLink v1.0 output selection
  • libmavconn: fix MAVLink v1.0 output selection Fix #1787
  • Contributors: Vladimir Ermakov, rosrunne

1.14.0 (2022-09-24)

  • libmavconn: fix MAVLink v1.0 output selection Fix #1787
  • Merge pull request #1775 from acxz/find-geographiclib use already installed FindGeographicLib.cmake
  • use already installed FindGeographicLib.cmake
  • Contributors: Vladimir Ermakov, acxz

1.13.0 (2022-01-13)

1.12.2 (2021-12-12)

1.12.1 (2021-11-29)

  • mavconn: fix connection issue introduced by #1658
  • Contributors: Vladimir Ermakov

1.12.0 (2021-11-27)

  • Merge pull request #1658 from asherikov/as_bugfixes Fix multiple bugs

  • Fix multiple bugs

    • fix bad_weak_ptr on connect and disconnect
    • introduce new API to avoid thread race when assigning callbacks

    - fix uninitialized variable in TCP client constructor which would randomly block TCP server This is an API breaking change: if client code creates connections using make_shared<>() instead of open_url(), it is now necessary to call new connect() method explicitly.

  • Contributors: Alexander Sherikov, Vladimir Ermakov

1.11.1 (2021-11-24)

1.11.0 (2021-11-24)

1.10.0 (2021-11-04)

  • Merge pull request #1626 from valbok/crash_on_shutdown Show ENOTCONN error instead of crash on socket's shutdown
  • Show ENOTCONN error instead of crash When a client suddenly drops the connection, socket.shutdown() will throw an exception: boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error> > what(): shutdown: Transport endpoint is not connected Showing an error in this common case looks more reasonable than crashing.
  • Contributors: Val Doroshchuk, Vladimir Ermakov

1.9.0 (2021-09-09)

1.8.0 (2021-05-05)

1.7.1 (2021-04-05)

1.7.0 (2021-04-05)

File truncated at 100 lines see the full file

Package Dependencies

System Dependencies

Dependant Packages

Name Deps
mavros

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged libmavconn at Robotics Stack Exchange

Package symbol

libmavconn package from mavros repo

libmavconn mavros mavros_extras mavros_msgs test_mavros

ROS Distro
noetic

Package Summary

Version 1.21.1
License GPLv3
Build type CATKIN
Use RECOMMENDED

Repository Summary

Description
Checkout URI https://github.com/mavlink/mavros.git
VCS Type git
VCS Version master
Last Updated 2025-12-12
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

MAVLink communication library. This library provide unified connection handling classes and URL to connection object mapper. This library can be used in standalone programs.

Additional Links

Maintainers

  • Vladimir Ermakov

Authors

  • Vladimir Ermakov

MAVCONN library

It is mavlink connection and communication library used in MAVROS. Since 2014-11-02 it adopted to use outside from ROS environment by splitting to individual package and removing dependencies to rosconsole.

Connection URL

Connection defined by URL. Just pass one of that URL to MAVConnInterface::open_url() and get connection object.

Supported schemas:

  • Serial: /path/to/serial/device[:baudrate]
  • Serial: serial:///path/to/serial/device[:baudrate][?ids=sysid,compid]
  • Serial with hardware flow control: serial-hwfc:///path/to/serial/device[:baudrate][?ids=sysid,compid]
  • UDP: udp://[bind_host][:port]@[remote_host][:port][/?ids=sysid,compid]
  • UDP broadcast until GCS discovery: udp-b://[bind_host][:port]@[:port][/?ids=sysid,compid]
  • UDP broadcast (permanent): udp-pb://[bind_host][:port]@[:port][/?ids=sysid,compid]
  • TCP client: tcp://[server_host][:port][/?ids=sysid,compid]
  • TCP server: tcp-l://[bind_port][:port][/?ids=sysid,compid]

Note: ids from URL overrides ids given by system_id & component_id parameters.

Dependencies

Same as for mavros:

  • Linux host
  • Boost >= 1.46 (used Boost.ASIO)
  • console-bridge library
  • compiller with C++11 support

License

Licensed under terms of LGPLv3, BSD, or GPLv3.

CHANGELOG

Changelog for package libmavconn

1.21.1 (2025-12-12)

1.21.0 (2025-09-08)

  • regenerate all
  • Contributors: Vladimir Ermakov

1.20.1 (2025-05-05)

1.20.0 (2024-10-10)

1.19.0 (2024-06-06)

1.18.0 (2024-03-03)

1.17.0 (2023-09-09)

  • Merge pull request #1865 from scoutdi/warnings Fix / suppress some build warnings
  • Suppress warnings from included headers
  • Contributors: Morten Fyhn Amundsen, Vladimir Ermakov

1.16.0 (2023-05-05)

1.15.0 (2022-12-30)

  • Merge pull request #1794 from rossizero/master libmavconn: fix MAVLink v1.0 output selection
  • libmavconn: fix MAVLink v1.0 output selection Fix #1787
  • Contributors: Vladimir Ermakov, rosrunne

1.14.0 (2022-09-24)

  • libmavconn: fix MAVLink v1.0 output selection Fix #1787
  • Merge pull request #1775 from acxz/find-geographiclib use already installed FindGeographicLib.cmake
  • use already installed FindGeographicLib.cmake
  • Contributors: Vladimir Ermakov, acxz

1.13.0 (2022-01-13)

1.12.2 (2021-12-12)

1.12.1 (2021-11-29)

  • mavconn: fix connection issue introduced by #1658
  • Contributors: Vladimir Ermakov

1.12.0 (2021-11-27)

  • Merge pull request #1658 from asherikov/as_bugfixes Fix multiple bugs

  • Fix multiple bugs

    • fix bad_weak_ptr on connect and disconnect
    • introduce new API to avoid thread race when assigning callbacks

    - fix uninitialized variable in TCP client constructor which would randomly block TCP server This is an API breaking change: if client code creates connections using make_shared<>() instead of open_url(), it is now necessary to call new connect() method explicitly.

  • Contributors: Alexander Sherikov, Vladimir Ermakov

1.11.1 (2021-11-24)

1.11.0 (2021-11-24)

1.10.0 (2021-11-04)

  • Merge pull request #1626 from valbok/crash_on_shutdown Show ENOTCONN error instead of crash on socket's shutdown
  • Show ENOTCONN error instead of crash When a client suddenly drops the connection, socket.shutdown() will throw an exception: boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error> > what(): shutdown: Transport endpoint is not connected Showing an error in this common case looks more reasonable than crashing.
  • Contributors: Val Doroshchuk, Vladimir Ermakov

1.9.0 (2021-09-09)

1.8.0 (2021-05-05)

1.7.1 (2021-04-05)

1.7.0 (2021-04-05)

File truncated at 100 lines see the full file

Package Dependencies

System Dependencies

Dependant Packages

Name Deps
mavros

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged libmavconn at Robotics Stack Exchange