The extension Agnocast enables ROS2 publishing RGL nodes to utilize Agnocast for zero-copy communication.
To learn more about Agnocast please visit:
The Agnocast extension is part of the ROS2 extension. You must build and use Agnocast together with the ROS2 extension.
Agnocast extension is supported on Ubuntu only.
Install most dependencies automatically by running:
setup.py --install-agnocast-depsTwo components require manual installation:
agnocast-heaphookagnocast-kmod
Installation steps:
- Follow commands from the setup script (
#agnocast-heaphook and agnocast-kmodpart only): Agnocast setup script - Version compatibility: Ensure you use the same version specified in the install_deps script
Build the extension using the setup script with the Agnocast flag:
setup.py --with-agnocastNote: The ROS2 extension must also be enabled during the build process.
Note: Agnocast libraries will be also installed for ROS2 standalone build.
To run the application that uses Agnocast, there is some additional system setup required:
- Insert kernel module.
sudo modprobe agnocast
- Setup
LD_PRELOADenvironment variable (Agnocast reference)Note: Theexport LD_PRELOAD="libagnocast_heaphook.so${LD_PRELOAD:+:${LD_PRELOAD}}"
libagnocast_heaphooklibrary is originally located in the ROS 2 libraries directory (/opt/ros/$ROS_DISTRO/lib). Make sure to source ROS 2 before using it. Alternatively, if you're working with a standalone build, the library can be found alongside the other installed ROS 2 libraries. - Setup
AGNOCAST_MEMPOOL_SIZEenvironment variable (adjust the size for your needs)export AGNOCAST_MEMPOOL_SIZE=16777216 # 16MB
After creating an RGL ROS2 publishing node, enable Agnocast using the rgl_node_configure_agnocast API:
...
rgl_node_t nodeFormat = nullptr, nodeRos2 = nullptr;
std::vector<rgl_field_t> fieldsToPublish = { RGL_FIELD_XYZ_VEC3_F32, RGL_FIELD_DISTANCE_F32 };
rgl_node_points_format(&nodeFormat, fieldsToPublish.data(), fieldsToPublish.size())
rgl_node_points_ros2_publish(&nodeRos2, "example_topic", "example_frame");
rgl_node_configure_agnocast(nodeRos2, true);
rgl_graph_node_add_child(..., nodeFormat);
rgl_graph_node_add_child(nodeFormat, nodeRos2);More details can be found here.