Package Summary
| Version | 1.9.0 |
| License | Apache License 2.0 |
| Build type | AMENT_CMAKE |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/autowarefoundation/autoware_core.git |
| VCS Type | git |
| VCS Version | main |
| Last Updated | 2026-09-09 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Takahiro Ishikawa-Aso
- Koichi Imai
- Atsushi Yano
- Yutaro Kobayashi
- Takumi Jin
- Tetsuhiro Kawaguchi
Authors
autoware_agnocast_wrapper
The purpose of this package is to integrate Agnocast, a zero-copy middleware, into each topic in Autoware with minimal side effects. Agnocast is a library designed to work alongside ROS 2, enabling true zero-copy publish/subscribe communication for all ROS 2 message types, including unsized message types.
- Agnocast Repository: https://github.com/autowarefoundation/agnocast
- Agnocast Documentation: https://autowarefoundation.github.io/agnocast_doc/main/
- Discussion on Agnocast Integration into Autoware: https://github.com/orgs/autowarefoundation/discussions/5835
- Review Guide for Agnocast Wrapper PRs
This package provides macros that wrap functions for publish/subscribe operations and smart pointer types for handling ROS 2 messages. When Autoware is built using the default build command, Agnocast is not enabled. However, setting the environment variable ENABLE_AGNOCAST=1 enables Agnocast and results in a build that includes its integration. This design ensures backward compatibility for users who are unaware of Agnocast, minimizing disruption.
Two Integration Approaches
This package provides two approaches for integrating Agnocast. Both will coexist for the foreseeable future.
1. Node Wrapper (agnocast_wrapper::Node)
Use this when you want the entire node to transparently switch between rclcpp::Node and agnocast::Node at runtime. The node wrapper automatically selects the correct underlying implementation based on the ENABLE_AGNOCAST environment variable.
agnocast_wrapper::Node does not publicly derive from rclcpp::Node. It exposes a curated subset
of the rclcpp::Node surface and forwards each member to the underlying implementation (rclcpp::Node
or agnocast::Node). The member names and argument lists are identical in both builds
(ENABLE_AGNOCAST=0 and =1), so a node written against it compiles unchanged either way — provided
you spell the handle, options and message types with the AUTOWARE_* macros (see
Type spellings). If you need an API that is not listed below, extend the wrapper, or
reach the underlying node via get_rclcpp_node() (declared in both builds, but it throws when the node
is in Agnocast mode — see the build-modes table).
Supported API surface
The following members / free functions are provided. Unless noted, signatures mirror their
rclcpp::Node counterparts.
| Category | Members |
|---|---|
| Construction |
Node(name, options), Node(name, namespace, options), virtual destructor, SharedPtr. Non-copyable and non-movable (copying would alias one backend behind two wrappers). Derives from std::enable_shared_from_this<Node>, so shared_from_this() is available when the node is owned by a shared_ptr
|
| Basic info |
get_name(), get_namespace(), get_fully_qualified_name(), get_logger()
|
| Time |
get_clock(), now()
|
| Node interfaces |
get_node_base_interface(), get_node_topics_interface(), get_node_parameters_interface() (partial — only these three) |
| Callback groups | create_callback_group() |
| Parameters |
declare_parameter() (typed + ParameterValue/ParameterType overloads), has_parameter(), undeclare_parameter(), get_parameter() / get_parameters() (typed + prefix overloads), set_parameter() / set_parameters() / set_parameters_atomically(), describe_parameter(s)(), get_parameter_types(), list_parameters(), add_on_set_parameters_callback(), remove_on_set_parameters_callback()
|
| Publisher |
create_publisher<MessageT>() (QoS and depth overloads) — see Publisher API
|
| Subscription |
create_subscription<MessageT>() (QoS and depth overloads, plus a callback-less form read with take()) — see Subscription API
|
| Client |
create_client<ServiceT>() (rclcpp::QoS); async_send_request() takes allocate_output_service_request()’s result, or a plain std::shared_ptr<S::Request> that the Agnocast backend copies |
| Service |
create_service<ServiceT>() (rclcpp::QoS) — message_ptr callback form and an rclcpp-style shared_ptr callback form |
| Timer |
create_wall_timer(); free create_timer(node, clock, period, cb, group) and free set_period(timer, period) (see Timer notes) |
| Underlying node |
get_rclcpp_node(); get_agnocast_node() (agnocast-enabled build only — not declared in an agnocast-disabled build, so calling it there is a compile error); free to_rclcpp_node(node)
|
| Context | free init(), shutdown() and ok() — mode-agnostic replacements for the rclcpp equivalents (see Context notes) |
OnSetParametersCallbackTypeis aliased in this namespace and resolves to the correct rclcpp type for both Humble (rclcpp 16.x) and Jazzy (rclcpp 28+).
Polling subscribers are not a Node member. Use the free function
polling::create_polling_subscriber<MessageT>(node, topic, qos) — see
Polling Subscriber.
Reading another node’s parameters is not a Node member either. Use
autoware::agnocast_wrapper::AsyncParametersClient, which takes a Method 2 node. Of the parameter
service calls it exposes only get_parameters(), alongside wait_for_service() and
service_is_ready(); the setter, descriptor and listing calls are not wrapped yet, and
on_parameter_event() has no Agnocast counterpart. On the Agnocast backend the response arrives
over an Agnocast subscription, so get_parameters() resolves its future only while an Agnocast
executor spins the node.
create_client()andcreate_service()also accept anrmw_qos_profile_t. This is not part of the supported surface: it exists so that Humble-era call sites passingrmw_qos_profile_services_defaultkeep compiling, and it will be removed. Pass anrclcpp::QoS.
Type spellings
The member names and argument lists above are the same in both builds, but the handle, options and
message types they use are not the same C++ types. Always spell them with the AUTOWARE_* macros so the
same source compiles in both builds:
| What | Spell it as | ENABLE_AGNOCAST=0 |
ENABLE_AGNOCAST=1 |
|---|---|---|---|
create_publisher result |
AUTOWARE_PUBLISHER_PTR(M) |
rclcpp::Publisher<M>::SharedPtr |
agnocast_wrapper::Publisher<M>::SharedPtr |
create_subscription result |
AUTOWARE_SUBSCRIPTION_PTR(M) |
rclcpp::Subscription<M>::SharedPtr |
agnocast_wrapper::Subscription<M>::SharedPtr |
create_wall_timer result |
AUTOWARE_TIMER_PTR |
rclcpp::TimerBase::SharedPtr |
agnocast_wrapper::Timer::SharedPtr |
create_publisher options arg |
AUTOWARE_PUBLISHER_OPTIONS |
rclcpp::PublisherOptions |
agnocast::PublisherOptions |
create_subscription options |
AUTOWARE_SUBSCRIPTION_OPTIONS |
rclcpp::SubscriptionOptions |
agnocast::SubscriptionOptions |
| Owning subscription callback arg | AUTOWARE_MESSAGE_CONST_SHARED_PTR(M) |
std::shared_ptr<const M> |
message_ptr<const M, Shared> |
async_send_request request arg |
AUTOWARE_CLIENT_REQUEST_PTR(S) |
std::shared_ptr<S::Request> |
message_ptr<S::Request, Shared> |
A subscription callback may also take the plain MessageT::ConstSharedPtr; it needs no macro because it is spelled the same in both builds.
On the Agnocast path an owning handle must not outlive the subscription that delivered it. This covers AUTOWARE_MESSAGE_CONST_SHARED_PTR, a callback taking MessageT::ConstSharedPtr, the pointer returned by polling::take_data(), and AUTOWARE_CLIENT_RESPONSE_PTR, which the client delivers through a response subscription of its own and which therefore must not outlive the client. Reading it afterwards can return recycled memory, and releasing it can abort the process. Members are destroyed in reverse declaration order, so declare the subscription before any member that caches a message:
AUTOWARE_SUBSCRIPTION_PTR(PointCloud2) sub_; // declared first -> destroyed last
std::shared_ptr<const PointCloud2> latest_; // destroyed first -> safe
AUTOWARE_CLIENT_PTR(SrvT) client_; // same rule for a cached client response
std::shared_ptr<const SrvT::Response> cached_;
The DDS path lets the same pointer be held indefinitely, so a node validated only with ENABLE_AGNOCAST=0 will not show the problem.
AUTOWARE_CLIENT_PTR(S) / AUTOWARE_SERVICE_PTR(S) and the AUTOWARE_CLIENT_*FUTURE* macros resolve to
the wrapper’s own Client<S> / Service<S> types in both builds, so client and service code needs no
File truncated at 100 lines see the full file
Changelog for package autoware_agnocast_wrapper
1.9.0 (2026-06-24)
-
Merge remote-tracking branch 'origin/main' into tmp/bot/bump_version_base
-
refactor(autoware_agnocast_wrapper): split service ptr macros into server/client variants (#1205)
* refactor(autoware_agnocast_wrapper): split service ptr macros into server/client variants
- Apply feedback review
* Remove const from is_shared_ptr_service_callback_v ---------
-
feat(autoware_agnocast_wrapper): add overload for service (#1203)
- add create_service overload
- add assert
* fix copilot review ---------
-
feat(autoware_agnocast_wrapper): add service and client support (#1074)
- Add service and client support to agnocast wrapper
- Mark service and client support as experimental in README
- Add missing macros
- Fix colcon flag typo in README
- fix
- style(pre-commit): autofix
- fix
- style(pre-commit): autofix
- Add a comment
- Adjust create_service/create_client calls depending on rclcpp version
- fix cpplint errors
- style(pre-commit): autofix
- Fix type deduction in create_client and create_service
- Add functional header
- Fix cpplint errors
- Remove experimental tag
- Add RCLCPP version check for client and service macros
* Propagate exception in client async callbacks ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Koichi Imai <<koichi.imai.2@tier4.jp>> Co-authored-by: Koichi Imai <<45482193+Koichi98@users.noreply.github.com>>
-
feat(autoware_agnocast_wrapper): support more args for synchronizer (#1104) support 8 args
-
feat(autoware_agnocast_wrapper): adopt glog to agnocast main templete (#1180) feat(autoware_agnocast_wrapper): use glog (#88)
- feat: use glog
- fix: tag name
- feat: link glog
- fix
* fix: add ament auto library ---------
-
fix(autoware_agnocast_wrapper): get_name,namespace,get_fully_qualified_name (#1178) fix get_name,namespace,get_fully_qualified_name
-
feat(autoware_agnocast_wrapper): spawn agnocast_discovery_agent from launch wrapper (#1084) Spawn exactly one agnocast_discovery_agent per ros2 launch tree from agnocast_env.launch.{py,xml} when ENABLE_AGNOCAST=1, deduplicated tree-wide via the LaunchContext globals and pinned to namespace="/".
-
feat(autoware_agnocast_wrapper): add ON_NODE macros (#1170)
-
feat(autoware_agnocast_wrapper): update [agnocast_env.launch]{.title-ref} to enable override [use_agnocast]{.title-ref} (#1123)
- update agnocast_env.launch to override use_agnocast
- style(pre-commit): autofix
* more description in README ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
| Name |
|---|
| libgoogle-glog-dev |
Dependant Packages
Launch files
- launch/agnocast_env.launch.xml
-
- agnocast_heaphook_path [default: /opt/ros/$(env ROS_DISTRO humble)/lib/libagnocast_heaphook.so]
- use_multithread [default: false]
- use_agnocast [default: $(env ENABLE_AGNOCAST 0)]
Messages
Services
Plugins
Recent questions tagged autoware_agnocast_wrapper at Robotics Stack Exchange
Package Summary
| Version | 1.9.0 |
| License | Apache License 2.0 |
| Build type | AMENT_CMAKE |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/autowarefoundation/autoware_core.git |
| VCS Type | git |
| VCS Version | main |
| Last Updated | 2026-09-09 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Takahiro Ishikawa-Aso
- Koichi Imai
- Atsushi Yano
- Yutaro Kobayashi
- Takumi Jin
- Tetsuhiro Kawaguchi
Authors
autoware_agnocast_wrapper
The purpose of this package is to integrate Agnocast, a zero-copy middleware, into each topic in Autoware with minimal side effects. Agnocast is a library designed to work alongside ROS 2, enabling true zero-copy publish/subscribe communication for all ROS 2 message types, including unsized message types.
- Agnocast Repository: https://github.com/autowarefoundation/agnocast
- Agnocast Documentation: https://autowarefoundation.github.io/agnocast_doc/main/
- Discussion on Agnocast Integration into Autoware: https://github.com/orgs/autowarefoundation/discussions/5835
- Review Guide for Agnocast Wrapper PRs
This package provides macros that wrap functions for publish/subscribe operations and smart pointer types for handling ROS 2 messages. When Autoware is built using the default build command, Agnocast is not enabled. However, setting the environment variable ENABLE_AGNOCAST=1 enables Agnocast and results in a build that includes its integration. This design ensures backward compatibility for users who are unaware of Agnocast, minimizing disruption.
Two Integration Approaches
This package provides two approaches for integrating Agnocast. Both will coexist for the foreseeable future.
1. Node Wrapper (agnocast_wrapper::Node)
Use this when you want the entire node to transparently switch between rclcpp::Node and agnocast::Node at runtime. The node wrapper automatically selects the correct underlying implementation based on the ENABLE_AGNOCAST environment variable.
agnocast_wrapper::Node does not publicly derive from rclcpp::Node. It exposes a curated subset
of the rclcpp::Node surface and forwards each member to the underlying implementation (rclcpp::Node
or agnocast::Node). The member names and argument lists are identical in both builds
(ENABLE_AGNOCAST=0 and =1), so a node written against it compiles unchanged either way — provided
you spell the handle, options and message types with the AUTOWARE_* macros (see
Type spellings). If you need an API that is not listed below, extend the wrapper, or
reach the underlying node via get_rclcpp_node() (declared in both builds, but it throws when the node
is in Agnocast mode — see the build-modes table).
Supported API surface
The following members / free functions are provided. Unless noted, signatures mirror their
rclcpp::Node counterparts.
| Category | Members |
|---|---|
| Construction |
Node(name, options), Node(name, namespace, options), virtual destructor, SharedPtr. Non-copyable and non-movable (copying would alias one backend behind two wrappers). Derives from std::enable_shared_from_this<Node>, so shared_from_this() is available when the node is owned by a shared_ptr
|
| Basic info |
get_name(), get_namespace(), get_fully_qualified_name(), get_logger()
|
| Time |
get_clock(), now()
|
| Node interfaces |
get_node_base_interface(), get_node_topics_interface(), get_node_parameters_interface() (partial — only these three) |
| Callback groups | create_callback_group() |
| Parameters |
declare_parameter() (typed + ParameterValue/ParameterType overloads), has_parameter(), undeclare_parameter(), get_parameter() / get_parameters() (typed + prefix overloads), set_parameter() / set_parameters() / set_parameters_atomically(), describe_parameter(s)(), get_parameter_types(), list_parameters(), add_on_set_parameters_callback(), remove_on_set_parameters_callback()
|
| Publisher |
create_publisher<MessageT>() (QoS and depth overloads) — see Publisher API
|
| Subscription |
create_subscription<MessageT>() (QoS and depth overloads, plus a callback-less form read with take()) — see Subscription API
|
| Client |
create_client<ServiceT>() (rclcpp::QoS); async_send_request() takes allocate_output_service_request()’s result, or a plain std::shared_ptr<S::Request> that the Agnocast backend copies |
| Service |
create_service<ServiceT>() (rclcpp::QoS) — message_ptr callback form and an rclcpp-style shared_ptr callback form |
| Timer |
create_wall_timer(); free create_timer(node, clock, period, cb, group) and free set_period(timer, period) (see Timer notes) |
| Underlying node |
get_rclcpp_node(); get_agnocast_node() (agnocast-enabled build only — not declared in an agnocast-disabled build, so calling it there is a compile error); free to_rclcpp_node(node)
|
| Context | free init(), shutdown() and ok() — mode-agnostic replacements for the rclcpp equivalents (see Context notes) |
OnSetParametersCallbackTypeis aliased in this namespace and resolves to the correct rclcpp type for both Humble (rclcpp 16.x) and Jazzy (rclcpp 28+).
Polling subscribers are not a Node member. Use the free function
polling::create_polling_subscriber<MessageT>(node, topic, qos) — see
Polling Subscriber.
Reading another node’s parameters is not a Node member either. Use
autoware::agnocast_wrapper::AsyncParametersClient, which takes a Method 2 node. Of the parameter
service calls it exposes only get_parameters(), alongside wait_for_service() and
service_is_ready(); the setter, descriptor and listing calls are not wrapped yet, and
on_parameter_event() has no Agnocast counterpart. On the Agnocast backend the response arrives
over an Agnocast subscription, so get_parameters() resolves its future only while an Agnocast
executor spins the node.
create_client()andcreate_service()also accept anrmw_qos_profile_t. This is not part of the supported surface: it exists so that Humble-era call sites passingrmw_qos_profile_services_defaultkeep compiling, and it will be removed. Pass anrclcpp::QoS.
Type spellings
The member names and argument lists above are the same in both builds, but the handle, options and
message types they use are not the same C++ types. Always spell them with the AUTOWARE_* macros so the
same source compiles in both builds:
| What | Spell it as | ENABLE_AGNOCAST=0 |
ENABLE_AGNOCAST=1 |
|---|---|---|---|
create_publisher result |
AUTOWARE_PUBLISHER_PTR(M) |
rclcpp::Publisher<M>::SharedPtr |
agnocast_wrapper::Publisher<M>::SharedPtr |
create_subscription result |
AUTOWARE_SUBSCRIPTION_PTR(M) |
rclcpp::Subscription<M>::SharedPtr |
agnocast_wrapper::Subscription<M>::SharedPtr |
create_wall_timer result |
AUTOWARE_TIMER_PTR |
rclcpp::TimerBase::SharedPtr |
agnocast_wrapper::Timer::SharedPtr |
create_publisher options arg |
AUTOWARE_PUBLISHER_OPTIONS |
rclcpp::PublisherOptions |
agnocast::PublisherOptions |
create_subscription options |
AUTOWARE_SUBSCRIPTION_OPTIONS |
rclcpp::SubscriptionOptions |
agnocast::SubscriptionOptions |
| Owning subscription callback arg | AUTOWARE_MESSAGE_CONST_SHARED_PTR(M) |
std::shared_ptr<const M> |
message_ptr<const M, Shared> |
async_send_request request arg |
AUTOWARE_CLIENT_REQUEST_PTR(S) |
std::shared_ptr<S::Request> |
message_ptr<S::Request, Shared> |
A subscription callback may also take the plain MessageT::ConstSharedPtr; it needs no macro because it is spelled the same in both builds.
On the Agnocast path an owning handle must not outlive the subscription that delivered it. This covers AUTOWARE_MESSAGE_CONST_SHARED_PTR, a callback taking MessageT::ConstSharedPtr, the pointer returned by polling::take_data(), and AUTOWARE_CLIENT_RESPONSE_PTR, which the client delivers through a response subscription of its own and which therefore must not outlive the client. Reading it afterwards can return recycled memory, and releasing it can abort the process. Members are destroyed in reverse declaration order, so declare the subscription before any member that caches a message:
AUTOWARE_SUBSCRIPTION_PTR(PointCloud2) sub_; // declared first -> destroyed last
std::shared_ptr<const PointCloud2> latest_; // destroyed first -> safe
AUTOWARE_CLIENT_PTR(SrvT) client_; // same rule for a cached client response
std::shared_ptr<const SrvT::Response> cached_;
The DDS path lets the same pointer be held indefinitely, so a node validated only with ENABLE_AGNOCAST=0 will not show the problem.
AUTOWARE_CLIENT_PTR(S) / AUTOWARE_SERVICE_PTR(S) and the AUTOWARE_CLIENT_*FUTURE* macros resolve to
the wrapper’s own Client<S> / Service<S> types in both builds, so client and service code needs no
File truncated at 100 lines see the full file
Changelog for package autoware_agnocast_wrapper
1.9.0 (2026-06-24)
-
Merge remote-tracking branch 'origin/main' into tmp/bot/bump_version_base
-
refactor(autoware_agnocast_wrapper): split service ptr macros into server/client variants (#1205)
* refactor(autoware_agnocast_wrapper): split service ptr macros into server/client variants
- Apply feedback review
* Remove const from is_shared_ptr_service_callback_v ---------
-
feat(autoware_agnocast_wrapper): add overload for service (#1203)
- add create_service overload
- add assert
* fix copilot review ---------
-
feat(autoware_agnocast_wrapper): add service and client support (#1074)
- Add service and client support to agnocast wrapper
- Mark service and client support as experimental in README
- Add missing macros
- Fix colcon flag typo in README
- fix
- style(pre-commit): autofix
- fix
- style(pre-commit): autofix
- Add a comment
- Adjust create_service/create_client calls depending on rclcpp version
- fix cpplint errors
- style(pre-commit): autofix
- Fix type deduction in create_client and create_service
- Add functional header
- Fix cpplint errors
- Remove experimental tag
- Add RCLCPP version check for client and service macros
* Propagate exception in client async callbacks ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Koichi Imai <<koichi.imai.2@tier4.jp>> Co-authored-by: Koichi Imai <<45482193+Koichi98@users.noreply.github.com>>
-
feat(autoware_agnocast_wrapper): support more args for synchronizer (#1104) support 8 args
-
feat(autoware_agnocast_wrapper): adopt glog to agnocast main templete (#1180) feat(autoware_agnocast_wrapper): use glog (#88)
- feat: use glog
- fix: tag name
- feat: link glog
- fix
* fix: add ament auto library ---------
-
fix(autoware_agnocast_wrapper): get_name,namespace,get_fully_qualified_name (#1178) fix get_name,namespace,get_fully_qualified_name
-
feat(autoware_agnocast_wrapper): spawn agnocast_discovery_agent from launch wrapper (#1084) Spawn exactly one agnocast_discovery_agent per ros2 launch tree from agnocast_env.launch.{py,xml} when ENABLE_AGNOCAST=1, deduplicated tree-wide via the LaunchContext globals and pinned to namespace="/".
-
feat(autoware_agnocast_wrapper): add ON_NODE macros (#1170)
-
feat(autoware_agnocast_wrapper): update [agnocast_env.launch]{.title-ref} to enable override [use_agnocast]{.title-ref} (#1123)
- update agnocast_env.launch to override use_agnocast
- style(pre-commit): autofix
* more description in README ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
| Name |
|---|
| libgoogle-glog-dev |
Dependant Packages
Launch files
- launch/agnocast_env.launch.xml
-
- agnocast_heaphook_path [default: /opt/ros/$(env ROS_DISTRO humble)/lib/libagnocast_heaphook.so]
- use_multithread [default: false]
- use_agnocast [default: $(env ENABLE_AGNOCAST 0)]
Messages
Services
Plugins
Recent questions tagged autoware_agnocast_wrapper at Robotics Stack Exchange
Package Summary
| Version | 1.9.0 |
| License | Apache License 2.0 |
| Build type | AMENT_CMAKE |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/autowarefoundation/autoware_core.git |
| VCS Type | git |
| VCS Version | main |
| Last Updated | 2026-09-09 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Takahiro Ishikawa-Aso
- Koichi Imai
- Atsushi Yano
- Yutaro Kobayashi
- Takumi Jin
- Tetsuhiro Kawaguchi
Authors
autoware_agnocast_wrapper
The purpose of this package is to integrate Agnocast, a zero-copy middleware, into each topic in Autoware with minimal side effects. Agnocast is a library designed to work alongside ROS 2, enabling true zero-copy publish/subscribe communication for all ROS 2 message types, including unsized message types.
- Agnocast Repository: https://github.com/autowarefoundation/agnocast
- Agnocast Documentation: https://autowarefoundation.github.io/agnocast_doc/main/
- Discussion on Agnocast Integration into Autoware: https://github.com/orgs/autowarefoundation/discussions/5835
- Review Guide for Agnocast Wrapper PRs
This package provides macros that wrap functions for publish/subscribe operations and smart pointer types for handling ROS 2 messages. When Autoware is built using the default build command, Agnocast is not enabled. However, setting the environment variable ENABLE_AGNOCAST=1 enables Agnocast and results in a build that includes its integration. This design ensures backward compatibility for users who are unaware of Agnocast, minimizing disruption.
Two Integration Approaches
This package provides two approaches for integrating Agnocast. Both will coexist for the foreseeable future.
1. Node Wrapper (agnocast_wrapper::Node)
Use this when you want the entire node to transparently switch between rclcpp::Node and agnocast::Node at runtime. The node wrapper automatically selects the correct underlying implementation based on the ENABLE_AGNOCAST environment variable.
agnocast_wrapper::Node does not publicly derive from rclcpp::Node. It exposes a curated subset
of the rclcpp::Node surface and forwards each member to the underlying implementation (rclcpp::Node
or agnocast::Node). The member names and argument lists are identical in both builds
(ENABLE_AGNOCAST=0 and =1), so a node written against it compiles unchanged either way — provided
you spell the handle, options and message types with the AUTOWARE_* macros (see
Type spellings). If you need an API that is not listed below, extend the wrapper, or
reach the underlying node via get_rclcpp_node() (declared in both builds, but it throws when the node
is in Agnocast mode — see the build-modes table).
Supported API surface
The following members / free functions are provided. Unless noted, signatures mirror their
rclcpp::Node counterparts.
| Category | Members |
|---|---|
| Construction |
Node(name, options), Node(name, namespace, options), virtual destructor, SharedPtr. Non-copyable and non-movable (copying would alias one backend behind two wrappers). Derives from std::enable_shared_from_this<Node>, so shared_from_this() is available when the node is owned by a shared_ptr
|
| Basic info |
get_name(), get_namespace(), get_fully_qualified_name(), get_logger()
|
| Time |
get_clock(), now()
|
| Node interfaces |
get_node_base_interface(), get_node_topics_interface(), get_node_parameters_interface() (partial — only these three) |
| Callback groups | create_callback_group() |
| Parameters |
declare_parameter() (typed + ParameterValue/ParameterType overloads), has_parameter(), undeclare_parameter(), get_parameter() / get_parameters() (typed + prefix overloads), set_parameter() / set_parameters() / set_parameters_atomically(), describe_parameter(s)(), get_parameter_types(), list_parameters(), add_on_set_parameters_callback(), remove_on_set_parameters_callback()
|
| Publisher |
create_publisher<MessageT>() (QoS and depth overloads) — see Publisher API
|
| Subscription |
create_subscription<MessageT>() (QoS and depth overloads, plus a callback-less form read with take()) — see Subscription API
|
| Client |
create_client<ServiceT>() (rclcpp::QoS); async_send_request() takes allocate_output_service_request()’s result, or a plain std::shared_ptr<S::Request> that the Agnocast backend copies |
| Service |
create_service<ServiceT>() (rclcpp::QoS) — message_ptr callback form and an rclcpp-style shared_ptr callback form |
| Timer |
create_wall_timer(); free create_timer(node, clock, period, cb, group) and free set_period(timer, period) (see Timer notes) |
| Underlying node |
get_rclcpp_node(); get_agnocast_node() (agnocast-enabled build only — not declared in an agnocast-disabled build, so calling it there is a compile error); free to_rclcpp_node(node)
|
| Context | free init(), shutdown() and ok() — mode-agnostic replacements for the rclcpp equivalents (see Context notes) |
OnSetParametersCallbackTypeis aliased in this namespace and resolves to the correct rclcpp type for both Humble (rclcpp 16.x) and Jazzy (rclcpp 28+).
Polling subscribers are not a Node member. Use the free function
polling::create_polling_subscriber<MessageT>(node, topic, qos) — see
Polling Subscriber.
Reading another node’s parameters is not a Node member either. Use
autoware::agnocast_wrapper::AsyncParametersClient, which takes a Method 2 node. Of the parameter
service calls it exposes only get_parameters(), alongside wait_for_service() and
service_is_ready(); the setter, descriptor and listing calls are not wrapped yet, and
on_parameter_event() has no Agnocast counterpart. On the Agnocast backend the response arrives
over an Agnocast subscription, so get_parameters() resolves its future only while an Agnocast
executor spins the node.
create_client()andcreate_service()also accept anrmw_qos_profile_t. This is not part of the supported surface: it exists so that Humble-era call sites passingrmw_qos_profile_services_defaultkeep compiling, and it will be removed. Pass anrclcpp::QoS.
Type spellings
The member names and argument lists above are the same in both builds, but the handle, options and
message types they use are not the same C++ types. Always spell them with the AUTOWARE_* macros so the
same source compiles in both builds:
| What | Spell it as | ENABLE_AGNOCAST=0 |
ENABLE_AGNOCAST=1 |
|---|---|---|---|
create_publisher result |
AUTOWARE_PUBLISHER_PTR(M) |
rclcpp::Publisher<M>::SharedPtr |
agnocast_wrapper::Publisher<M>::SharedPtr |
create_subscription result |
AUTOWARE_SUBSCRIPTION_PTR(M) |
rclcpp::Subscription<M>::SharedPtr |
agnocast_wrapper::Subscription<M>::SharedPtr |
create_wall_timer result |
AUTOWARE_TIMER_PTR |
rclcpp::TimerBase::SharedPtr |
agnocast_wrapper::Timer::SharedPtr |
create_publisher options arg |
AUTOWARE_PUBLISHER_OPTIONS |
rclcpp::PublisherOptions |
agnocast::PublisherOptions |
create_subscription options |
AUTOWARE_SUBSCRIPTION_OPTIONS |
rclcpp::SubscriptionOptions |
agnocast::SubscriptionOptions |
| Owning subscription callback arg | AUTOWARE_MESSAGE_CONST_SHARED_PTR(M) |
std::shared_ptr<const M> |
message_ptr<const M, Shared> |
async_send_request request arg |
AUTOWARE_CLIENT_REQUEST_PTR(S) |
std::shared_ptr<S::Request> |
message_ptr<S::Request, Shared> |
A subscription callback may also take the plain MessageT::ConstSharedPtr; it needs no macro because it is spelled the same in both builds.
On the Agnocast path an owning handle must not outlive the subscription that delivered it. This covers AUTOWARE_MESSAGE_CONST_SHARED_PTR, a callback taking MessageT::ConstSharedPtr, the pointer returned by polling::take_data(), and AUTOWARE_CLIENT_RESPONSE_PTR, which the client delivers through a response subscription of its own and which therefore must not outlive the client. Reading it afterwards can return recycled memory, and releasing it can abort the process. Members are destroyed in reverse declaration order, so declare the subscription before any member that caches a message:
AUTOWARE_SUBSCRIPTION_PTR(PointCloud2) sub_; // declared first -> destroyed last
std::shared_ptr<const PointCloud2> latest_; // destroyed first -> safe
AUTOWARE_CLIENT_PTR(SrvT) client_; // same rule for a cached client response
std::shared_ptr<const SrvT::Response> cached_;
The DDS path lets the same pointer be held indefinitely, so a node validated only with ENABLE_AGNOCAST=0 will not show the problem.
AUTOWARE_CLIENT_PTR(S) / AUTOWARE_SERVICE_PTR(S) and the AUTOWARE_CLIENT_*FUTURE* macros resolve to
the wrapper’s own Client<S> / Service<S> types in both builds, so client and service code needs no
File truncated at 100 lines see the full file
Changelog for package autoware_agnocast_wrapper
1.9.0 (2026-06-24)
-
Merge remote-tracking branch 'origin/main' into tmp/bot/bump_version_base
-
refactor(autoware_agnocast_wrapper): split service ptr macros into server/client variants (#1205)
* refactor(autoware_agnocast_wrapper): split service ptr macros into server/client variants
- Apply feedback review
* Remove const from is_shared_ptr_service_callback_v ---------
-
feat(autoware_agnocast_wrapper): add overload for service (#1203)
- add create_service overload
- add assert
* fix copilot review ---------
-
feat(autoware_agnocast_wrapper): add service and client support (#1074)
- Add service and client support to agnocast wrapper
- Mark service and client support as experimental in README
- Add missing macros
- Fix colcon flag typo in README
- fix
- style(pre-commit): autofix
- fix
- style(pre-commit): autofix
- Add a comment
- Adjust create_service/create_client calls depending on rclcpp version
- fix cpplint errors
- style(pre-commit): autofix
- Fix type deduction in create_client and create_service
- Add functional header
- Fix cpplint errors
- Remove experimental tag
- Add RCLCPP version check for client and service macros
* Propagate exception in client async callbacks ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Koichi Imai <<koichi.imai.2@tier4.jp>> Co-authored-by: Koichi Imai <<45482193+Koichi98@users.noreply.github.com>>
-
feat(autoware_agnocast_wrapper): support more args for synchronizer (#1104) support 8 args
-
feat(autoware_agnocast_wrapper): adopt glog to agnocast main templete (#1180) feat(autoware_agnocast_wrapper): use glog (#88)
- feat: use glog
- fix: tag name
- feat: link glog
- fix
* fix: add ament auto library ---------
-
fix(autoware_agnocast_wrapper): get_name,namespace,get_fully_qualified_name (#1178) fix get_name,namespace,get_fully_qualified_name
-
feat(autoware_agnocast_wrapper): spawn agnocast_discovery_agent from launch wrapper (#1084) Spawn exactly one agnocast_discovery_agent per ros2 launch tree from agnocast_env.launch.{py,xml} when ENABLE_AGNOCAST=1, deduplicated tree-wide via the LaunchContext globals and pinned to namespace="/".
-
feat(autoware_agnocast_wrapper): add ON_NODE macros (#1170)
-
feat(autoware_agnocast_wrapper): update [agnocast_env.launch]{.title-ref} to enable override [use_agnocast]{.title-ref} (#1123)
- update agnocast_env.launch to override use_agnocast
- style(pre-commit): autofix
* more description in README ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
| Name |
|---|
| libgoogle-glog-dev |
Dependant Packages
Launch files
- launch/agnocast_env.launch.xml
-
- agnocast_heaphook_path [default: /opt/ros/$(env ROS_DISTRO humble)/lib/libagnocast_heaphook.so]
- use_multithread [default: false]
- use_agnocast [default: $(env ENABLE_AGNOCAST 0)]
Messages
Services
Plugins
Recent questions tagged autoware_agnocast_wrapper at Robotics Stack Exchange
Package Summary
| Version | 1.9.0 |
| License | Apache License 2.0 |
| Build type | AMENT_CMAKE |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/autowarefoundation/autoware_core.git |
| VCS Type | git |
| VCS Version | main |
| Last Updated | 2026-09-09 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Takahiro Ishikawa-Aso
- Koichi Imai
- Atsushi Yano
- Yutaro Kobayashi
- Takumi Jin
- Tetsuhiro Kawaguchi
Authors
autoware_agnocast_wrapper
The purpose of this package is to integrate Agnocast, a zero-copy middleware, into each topic in Autoware with minimal side effects. Agnocast is a library designed to work alongside ROS 2, enabling true zero-copy publish/subscribe communication for all ROS 2 message types, including unsized message types.
- Agnocast Repository: https://github.com/autowarefoundation/agnocast
- Agnocast Documentation: https://autowarefoundation.github.io/agnocast_doc/main/
- Discussion on Agnocast Integration into Autoware: https://github.com/orgs/autowarefoundation/discussions/5835
- Review Guide for Agnocast Wrapper PRs
This package provides macros that wrap functions for publish/subscribe operations and smart pointer types for handling ROS 2 messages. When Autoware is built using the default build command, Agnocast is not enabled. However, setting the environment variable ENABLE_AGNOCAST=1 enables Agnocast and results in a build that includes its integration. This design ensures backward compatibility for users who are unaware of Agnocast, minimizing disruption.
Two Integration Approaches
This package provides two approaches for integrating Agnocast. Both will coexist for the foreseeable future.
1. Node Wrapper (agnocast_wrapper::Node)
Use this when you want the entire node to transparently switch between rclcpp::Node and agnocast::Node at runtime. The node wrapper automatically selects the correct underlying implementation based on the ENABLE_AGNOCAST environment variable.
agnocast_wrapper::Node does not publicly derive from rclcpp::Node. It exposes a curated subset
of the rclcpp::Node surface and forwards each member to the underlying implementation (rclcpp::Node
or agnocast::Node). The member names and argument lists are identical in both builds
(ENABLE_AGNOCAST=0 and =1), so a node written against it compiles unchanged either way — provided
you spell the handle, options and message types with the AUTOWARE_* macros (see
Type spellings). If you need an API that is not listed below, extend the wrapper, or
reach the underlying node via get_rclcpp_node() (declared in both builds, but it throws when the node
is in Agnocast mode — see the build-modes table).
Supported API surface
The following members / free functions are provided. Unless noted, signatures mirror their
rclcpp::Node counterparts.
| Category | Members |
|---|---|
| Construction |
Node(name, options), Node(name, namespace, options), virtual destructor, SharedPtr. Non-copyable and non-movable (copying would alias one backend behind two wrappers). Derives from std::enable_shared_from_this<Node>, so shared_from_this() is available when the node is owned by a shared_ptr
|
| Basic info |
get_name(), get_namespace(), get_fully_qualified_name(), get_logger()
|
| Time |
get_clock(), now()
|
| Node interfaces |
get_node_base_interface(), get_node_topics_interface(), get_node_parameters_interface() (partial — only these three) |
| Callback groups | create_callback_group() |
| Parameters |
declare_parameter() (typed + ParameterValue/ParameterType overloads), has_parameter(), undeclare_parameter(), get_parameter() / get_parameters() (typed + prefix overloads), set_parameter() / set_parameters() / set_parameters_atomically(), describe_parameter(s)(), get_parameter_types(), list_parameters(), add_on_set_parameters_callback(), remove_on_set_parameters_callback()
|
| Publisher |
create_publisher<MessageT>() (QoS and depth overloads) — see Publisher API
|
| Subscription |
create_subscription<MessageT>() (QoS and depth overloads, plus a callback-less form read with take()) — see Subscription API
|
| Client |
create_client<ServiceT>() (rclcpp::QoS); async_send_request() takes allocate_output_service_request()’s result, or a plain std::shared_ptr<S::Request> that the Agnocast backend copies |
| Service |
create_service<ServiceT>() (rclcpp::QoS) — message_ptr callback form and an rclcpp-style shared_ptr callback form |
| Timer |
create_wall_timer(); free create_timer(node, clock, period, cb, group) and free set_period(timer, period) (see Timer notes) |
| Underlying node |
get_rclcpp_node(); get_agnocast_node() (agnocast-enabled build only — not declared in an agnocast-disabled build, so calling it there is a compile error); free to_rclcpp_node(node)
|
| Context | free init(), shutdown() and ok() — mode-agnostic replacements for the rclcpp equivalents (see Context notes) |
OnSetParametersCallbackTypeis aliased in this namespace and resolves to the correct rclcpp type for both Humble (rclcpp 16.x) and Jazzy (rclcpp 28+).
Polling subscribers are not a Node member. Use the free function
polling::create_polling_subscriber<MessageT>(node, topic, qos) — see
Polling Subscriber.
Reading another node’s parameters is not a Node member either. Use
autoware::agnocast_wrapper::AsyncParametersClient, which takes a Method 2 node. Of the parameter
service calls it exposes only get_parameters(), alongside wait_for_service() and
service_is_ready(); the setter, descriptor and listing calls are not wrapped yet, and
on_parameter_event() has no Agnocast counterpart. On the Agnocast backend the response arrives
over an Agnocast subscription, so get_parameters() resolves its future only while an Agnocast
executor spins the node.
create_client()andcreate_service()also accept anrmw_qos_profile_t. This is not part of the supported surface: it exists so that Humble-era call sites passingrmw_qos_profile_services_defaultkeep compiling, and it will be removed. Pass anrclcpp::QoS.
Type spellings
The member names and argument lists above are the same in both builds, but the handle, options and
message types they use are not the same C++ types. Always spell them with the AUTOWARE_* macros so the
same source compiles in both builds:
| What | Spell it as | ENABLE_AGNOCAST=0 |
ENABLE_AGNOCAST=1 |
|---|---|---|---|
create_publisher result |
AUTOWARE_PUBLISHER_PTR(M) |
rclcpp::Publisher<M>::SharedPtr |
agnocast_wrapper::Publisher<M>::SharedPtr |
create_subscription result |
AUTOWARE_SUBSCRIPTION_PTR(M) |
rclcpp::Subscription<M>::SharedPtr |
agnocast_wrapper::Subscription<M>::SharedPtr |
create_wall_timer result |
AUTOWARE_TIMER_PTR |
rclcpp::TimerBase::SharedPtr |
agnocast_wrapper::Timer::SharedPtr |
create_publisher options arg |
AUTOWARE_PUBLISHER_OPTIONS |
rclcpp::PublisherOptions |
agnocast::PublisherOptions |
create_subscription options |
AUTOWARE_SUBSCRIPTION_OPTIONS |
rclcpp::SubscriptionOptions |
agnocast::SubscriptionOptions |
| Owning subscription callback arg | AUTOWARE_MESSAGE_CONST_SHARED_PTR(M) |
std::shared_ptr<const M> |
message_ptr<const M, Shared> |
async_send_request request arg |
AUTOWARE_CLIENT_REQUEST_PTR(S) |
std::shared_ptr<S::Request> |
message_ptr<S::Request, Shared> |
A subscription callback may also take the plain MessageT::ConstSharedPtr; it needs no macro because it is spelled the same in both builds.
On the Agnocast path an owning handle must not outlive the subscription that delivered it. This covers AUTOWARE_MESSAGE_CONST_SHARED_PTR, a callback taking MessageT::ConstSharedPtr, the pointer returned by polling::take_data(), and AUTOWARE_CLIENT_RESPONSE_PTR, which the client delivers through a response subscription of its own and which therefore must not outlive the client. Reading it afterwards can return recycled memory, and releasing it can abort the process. Members are destroyed in reverse declaration order, so declare the subscription before any member that caches a message:
AUTOWARE_SUBSCRIPTION_PTR(PointCloud2) sub_; // declared first -> destroyed last
std::shared_ptr<const PointCloud2> latest_; // destroyed first -> safe
AUTOWARE_CLIENT_PTR(SrvT) client_; // same rule for a cached client response
std::shared_ptr<const SrvT::Response> cached_;
The DDS path lets the same pointer be held indefinitely, so a node validated only with ENABLE_AGNOCAST=0 will not show the problem.
AUTOWARE_CLIENT_PTR(S) / AUTOWARE_SERVICE_PTR(S) and the AUTOWARE_CLIENT_*FUTURE* macros resolve to
the wrapper’s own Client<S> / Service<S> types in both builds, so client and service code needs no
File truncated at 100 lines see the full file
Changelog for package autoware_agnocast_wrapper
1.9.0 (2026-06-24)
-
Merge remote-tracking branch 'origin/main' into tmp/bot/bump_version_base
-
refactor(autoware_agnocast_wrapper): split service ptr macros into server/client variants (#1205)
* refactor(autoware_agnocast_wrapper): split service ptr macros into server/client variants
- Apply feedback review
* Remove const from is_shared_ptr_service_callback_v ---------
-
feat(autoware_agnocast_wrapper): add overload for service (#1203)
- add create_service overload
- add assert
* fix copilot review ---------
-
feat(autoware_agnocast_wrapper): add service and client support (#1074)
- Add service and client support to agnocast wrapper
- Mark service and client support as experimental in README
- Add missing macros
- Fix colcon flag typo in README
- fix
- style(pre-commit): autofix
- fix
- style(pre-commit): autofix
- Add a comment
- Adjust create_service/create_client calls depending on rclcpp version
- fix cpplint errors
- style(pre-commit): autofix
- Fix type deduction in create_client and create_service
- Add functional header
- Fix cpplint errors
- Remove experimental tag
- Add RCLCPP version check for client and service macros
* Propagate exception in client async callbacks ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Koichi Imai <<koichi.imai.2@tier4.jp>> Co-authored-by: Koichi Imai <<45482193+Koichi98@users.noreply.github.com>>
-
feat(autoware_agnocast_wrapper): support more args for synchronizer (#1104) support 8 args
-
feat(autoware_agnocast_wrapper): adopt glog to agnocast main templete (#1180) feat(autoware_agnocast_wrapper): use glog (#88)
- feat: use glog
- fix: tag name
- feat: link glog
- fix
* fix: add ament auto library ---------
-
fix(autoware_agnocast_wrapper): get_name,namespace,get_fully_qualified_name (#1178) fix get_name,namespace,get_fully_qualified_name
-
feat(autoware_agnocast_wrapper): spawn agnocast_discovery_agent from launch wrapper (#1084) Spawn exactly one agnocast_discovery_agent per ros2 launch tree from agnocast_env.launch.{py,xml} when ENABLE_AGNOCAST=1, deduplicated tree-wide via the LaunchContext globals and pinned to namespace="/".
-
feat(autoware_agnocast_wrapper): add ON_NODE macros (#1170)
-
feat(autoware_agnocast_wrapper): update [agnocast_env.launch]{.title-ref} to enable override [use_agnocast]{.title-ref} (#1123)
- update agnocast_env.launch to override use_agnocast
- style(pre-commit): autofix
* more description in README ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
| Name |
|---|
| libgoogle-glog-dev |
Dependant Packages
Launch files
- launch/agnocast_env.launch.xml
-
- agnocast_heaphook_path [default: /opt/ros/$(env ROS_DISTRO humble)/lib/libagnocast_heaphook.so]
- use_multithread [default: false]
- use_agnocast [default: $(env ENABLE_AGNOCAST 0)]
Messages
Services
Plugins
Recent questions tagged autoware_agnocast_wrapper at Robotics Stack Exchange
Package Summary
| Version | 1.9.0 |
| License | Apache License 2.0 |
| Build type | AMENT_CMAKE |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/autowarefoundation/autoware_core.git |
| VCS Type | git |
| VCS Version | main |
| Last Updated | 2026-09-09 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Takahiro Ishikawa-Aso
- Koichi Imai
- Atsushi Yano
- Yutaro Kobayashi
- Takumi Jin
- Tetsuhiro Kawaguchi
Authors
autoware_agnocast_wrapper
The purpose of this package is to integrate Agnocast, a zero-copy middleware, into each topic in Autoware with minimal side effects. Agnocast is a library designed to work alongside ROS 2, enabling true zero-copy publish/subscribe communication for all ROS 2 message types, including unsized message types.
- Agnocast Repository: https://github.com/autowarefoundation/agnocast
- Agnocast Documentation: https://autowarefoundation.github.io/agnocast_doc/main/
- Discussion on Agnocast Integration into Autoware: https://github.com/orgs/autowarefoundation/discussions/5835
- Review Guide for Agnocast Wrapper PRs
This package provides macros that wrap functions for publish/subscribe operations and smart pointer types for handling ROS 2 messages. When Autoware is built using the default build command, Agnocast is not enabled. However, setting the environment variable ENABLE_AGNOCAST=1 enables Agnocast and results in a build that includes its integration. This design ensures backward compatibility for users who are unaware of Agnocast, minimizing disruption.
Two Integration Approaches
This package provides two approaches for integrating Agnocast. Both will coexist for the foreseeable future.
1. Node Wrapper (agnocast_wrapper::Node)
Use this when you want the entire node to transparently switch between rclcpp::Node and agnocast::Node at runtime. The node wrapper automatically selects the correct underlying implementation based on the ENABLE_AGNOCAST environment variable.
agnocast_wrapper::Node does not publicly derive from rclcpp::Node. It exposes a curated subset
of the rclcpp::Node surface and forwards each member to the underlying implementation (rclcpp::Node
or agnocast::Node). The member names and argument lists are identical in both builds
(ENABLE_AGNOCAST=0 and =1), so a node written against it compiles unchanged either way — provided
you spell the handle, options and message types with the AUTOWARE_* macros (see
Type spellings). If you need an API that is not listed below, extend the wrapper, or
reach the underlying node via get_rclcpp_node() (declared in both builds, but it throws when the node
is in Agnocast mode — see the build-modes table).
Supported API surface
The following members / free functions are provided. Unless noted, signatures mirror their
rclcpp::Node counterparts.
| Category | Members |
|---|---|
| Construction |
Node(name, options), Node(name, namespace, options), virtual destructor, SharedPtr. Non-copyable and non-movable (copying would alias one backend behind two wrappers). Derives from std::enable_shared_from_this<Node>, so shared_from_this() is available when the node is owned by a shared_ptr
|
| Basic info |
get_name(), get_namespace(), get_fully_qualified_name(), get_logger()
|
| Time |
get_clock(), now()
|
| Node interfaces |
get_node_base_interface(), get_node_topics_interface(), get_node_parameters_interface() (partial — only these three) |
| Callback groups | create_callback_group() |
| Parameters |
declare_parameter() (typed + ParameterValue/ParameterType overloads), has_parameter(), undeclare_parameter(), get_parameter() / get_parameters() (typed + prefix overloads), set_parameter() / set_parameters() / set_parameters_atomically(), describe_parameter(s)(), get_parameter_types(), list_parameters(), add_on_set_parameters_callback(), remove_on_set_parameters_callback()
|
| Publisher |
create_publisher<MessageT>() (QoS and depth overloads) — see Publisher API
|
| Subscription |
create_subscription<MessageT>() (QoS and depth overloads, plus a callback-less form read with take()) — see Subscription API
|
| Client |
create_client<ServiceT>() (rclcpp::QoS); async_send_request() takes allocate_output_service_request()’s result, or a plain std::shared_ptr<S::Request> that the Agnocast backend copies |
| Service |
create_service<ServiceT>() (rclcpp::QoS) — message_ptr callback form and an rclcpp-style shared_ptr callback form |
| Timer |
create_wall_timer(); free create_timer(node, clock, period, cb, group) and free set_period(timer, period) (see Timer notes) |
| Underlying node |
get_rclcpp_node(); get_agnocast_node() (agnocast-enabled build only — not declared in an agnocast-disabled build, so calling it there is a compile error); free to_rclcpp_node(node)
|
| Context | free init(), shutdown() and ok() — mode-agnostic replacements for the rclcpp equivalents (see Context notes) |
OnSetParametersCallbackTypeis aliased in this namespace and resolves to the correct rclcpp type for both Humble (rclcpp 16.x) and Jazzy (rclcpp 28+).
Polling subscribers are not a Node member. Use the free function
polling::create_polling_subscriber<MessageT>(node, topic, qos) — see
Polling Subscriber.
Reading another node’s parameters is not a Node member either. Use
autoware::agnocast_wrapper::AsyncParametersClient, which takes a Method 2 node. Of the parameter
service calls it exposes only get_parameters(), alongside wait_for_service() and
service_is_ready(); the setter, descriptor and listing calls are not wrapped yet, and
on_parameter_event() has no Agnocast counterpart. On the Agnocast backend the response arrives
over an Agnocast subscription, so get_parameters() resolves its future only while an Agnocast
executor spins the node.
create_client()andcreate_service()also accept anrmw_qos_profile_t. This is not part of the supported surface: it exists so that Humble-era call sites passingrmw_qos_profile_services_defaultkeep compiling, and it will be removed. Pass anrclcpp::QoS.
Type spellings
The member names and argument lists above are the same in both builds, but the handle, options and
message types they use are not the same C++ types. Always spell them with the AUTOWARE_* macros so the
same source compiles in both builds:
| What | Spell it as | ENABLE_AGNOCAST=0 |
ENABLE_AGNOCAST=1 |
|---|---|---|---|
create_publisher result |
AUTOWARE_PUBLISHER_PTR(M) |
rclcpp::Publisher<M>::SharedPtr |
agnocast_wrapper::Publisher<M>::SharedPtr |
create_subscription result |
AUTOWARE_SUBSCRIPTION_PTR(M) |
rclcpp::Subscription<M>::SharedPtr |
agnocast_wrapper::Subscription<M>::SharedPtr |
create_wall_timer result |
AUTOWARE_TIMER_PTR |
rclcpp::TimerBase::SharedPtr |
agnocast_wrapper::Timer::SharedPtr |
create_publisher options arg |
AUTOWARE_PUBLISHER_OPTIONS |
rclcpp::PublisherOptions |
agnocast::PublisherOptions |
create_subscription options |
AUTOWARE_SUBSCRIPTION_OPTIONS |
rclcpp::SubscriptionOptions |
agnocast::SubscriptionOptions |
| Owning subscription callback arg | AUTOWARE_MESSAGE_CONST_SHARED_PTR(M) |
std::shared_ptr<const M> |
message_ptr<const M, Shared> |
async_send_request request arg |
AUTOWARE_CLIENT_REQUEST_PTR(S) |
std::shared_ptr<S::Request> |
message_ptr<S::Request, Shared> |
A subscription callback may also take the plain MessageT::ConstSharedPtr; it needs no macro because it is spelled the same in both builds.
On the Agnocast path an owning handle must not outlive the subscription that delivered it. This covers AUTOWARE_MESSAGE_CONST_SHARED_PTR, a callback taking MessageT::ConstSharedPtr, the pointer returned by polling::take_data(), and AUTOWARE_CLIENT_RESPONSE_PTR, which the client delivers through a response subscription of its own and which therefore must not outlive the client. Reading it afterwards can return recycled memory, and releasing it can abort the process. Members are destroyed in reverse declaration order, so declare the subscription before any member that caches a message:
AUTOWARE_SUBSCRIPTION_PTR(PointCloud2) sub_; // declared first -> destroyed last
std::shared_ptr<const PointCloud2> latest_; // destroyed first -> safe
AUTOWARE_CLIENT_PTR(SrvT) client_; // same rule for a cached client response
std::shared_ptr<const SrvT::Response> cached_;
The DDS path lets the same pointer be held indefinitely, so a node validated only with ENABLE_AGNOCAST=0 will not show the problem.
AUTOWARE_CLIENT_PTR(S) / AUTOWARE_SERVICE_PTR(S) and the AUTOWARE_CLIENT_*FUTURE* macros resolve to
the wrapper’s own Client<S> / Service<S> types in both builds, so client and service code needs no
File truncated at 100 lines see the full file
Changelog for package autoware_agnocast_wrapper
1.9.0 (2026-06-24)
-
Merge remote-tracking branch 'origin/main' into tmp/bot/bump_version_base
-
refactor(autoware_agnocast_wrapper): split service ptr macros into server/client variants (#1205)
* refactor(autoware_agnocast_wrapper): split service ptr macros into server/client variants
- Apply feedback review
* Remove const from is_shared_ptr_service_callback_v ---------
-
feat(autoware_agnocast_wrapper): add overload for service (#1203)
- add create_service overload
- add assert
* fix copilot review ---------
-
feat(autoware_agnocast_wrapper): add service and client support (#1074)
- Add service and client support to agnocast wrapper
- Mark service and client support as experimental in README
- Add missing macros
- Fix colcon flag typo in README
- fix
- style(pre-commit): autofix
- fix
- style(pre-commit): autofix
- Add a comment
- Adjust create_service/create_client calls depending on rclcpp version
- fix cpplint errors
- style(pre-commit): autofix
- Fix type deduction in create_client and create_service
- Add functional header
- Fix cpplint errors
- Remove experimental tag
- Add RCLCPP version check for client and service macros
* Propagate exception in client async callbacks ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Koichi Imai <<koichi.imai.2@tier4.jp>> Co-authored-by: Koichi Imai <<45482193+Koichi98@users.noreply.github.com>>
-
feat(autoware_agnocast_wrapper): support more args for synchronizer (#1104) support 8 args
-
feat(autoware_agnocast_wrapper): adopt glog to agnocast main templete (#1180) feat(autoware_agnocast_wrapper): use glog (#88)
- feat: use glog
- fix: tag name
- feat: link glog
- fix
* fix: add ament auto library ---------
-
fix(autoware_agnocast_wrapper): get_name,namespace,get_fully_qualified_name (#1178) fix get_name,namespace,get_fully_qualified_name
-
feat(autoware_agnocast_wrapper): spawn agnocast_discovery_agent from launch wrapper (#1084) Spawn exactly one agnocast_discovery_agent per ros2 launch tree from agnocast_env.launch.{py,xml} when ENABLE_AGNOCAST=1, deduplicated tree-wide via the LaunchContext globals and pinned to namespace="/".
-
feat(autoware_agnocast_wrapper): add ON_NODE macros (#1170)
-
feat(autoware_agnocast_wrapper): update [agnocast_env.launch]{.title-ref} to enable override [use_agnocast]{.title-ref} (#1123)
- update agnocast_env.launch to override use_agnocast
- style(pre-commit): autofix
* more description in README ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
| Name |
|---|
| libgoogle-glog-dev |
Dependant Packages
Launch files
- launch/agnocast_env.launch.xml
-
- agnocast_heaphook_path [default: /opt/ros/$(env ROS_DISTRO humble)/lib/libagnocast_heaphook.so]
- use_multithread [default: false]
- use_agnocast [default: $(env ENABLE_AGNOCAST 0)]
Messages
Services
Plugins
Recent questions tagged autoware_agnocast_wrapper at Robotics Stack Exchange
Package Summary
| Version | 1.9.0 |
| License | Apache License 2.0 |
| Build type | AMENT_CMAKE |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/autowarefoundation/autoware_core.git |
| VCS Type | git |
| VCS Version | main |
| Last Updated | 2026-09-09 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Takahiro Ishikawa-Aso
- Koichi Imai
- Atsushi Yano
- Yutaro Kobayashi
- Takumi Jin
- Tetsuhiro Kawaguchi
Authors
autoware_agnocast_wrapper
The purpose of this package is to integrate Agnocast, a zero-copy middleware, into each topic in Autoware with minimal side effects. Agnocast is a library designed to work alongside ROS 2, enabling true zero-copy publish/subscribe communication for all ROS 2 message types, including unsized message types.
- Agnocast Repository: https://github.com/autowarefoundation/agnocast
- Agnocast Documentation: https://autowarefoundation.github.io/agnocast_doc/main/
- Discussion on Agnocast Integration into Autoware: https://github.com/orgs/autowarefoundation/discussions/5835
- Review Guide for Agnocast Wrapper PRs
This package provides macros that wrap functions for publish/subscribe operations and smart pointer types for handling ROS 2 messages. When Autoware is built using the default build command, Agnocast is not enabled. However, setting the environment variable ENABLE_AGNOCAST=1 enables Agnocast and results in a build that includes its integration. This design ensures backward compatibility for users who are unaware of Agnocast, minimizing disruption.
Two Integration Approaches
This package provides two approaches for integrating Agnocast. Both will coexist for the foreseeable future.
1. Node Wrapper (agnocast_wrapper::Node)
Use this when you want the entire node to transparently switch between rclcpp::Node and agnocast::Node at runtime. The node wrapper automatically selects the correct underlying implementation based on the ENABLE_AGNOCAST environment variable.
agnocast_wrapper::Node does not publicly derive from rclcpp::Node. It exposes a curated subset
of the rclcpp::Node surface and forwards each member to the underlying implementation (rclcpp::Node
or agnocast::Node). The member names and argument lists are identical in both builds
(ENABLE_AGNOCAST=0 and =1), so a node written against it compiles unchanged either way — provided
you spell the handle, options and message types with the AUTOWARE_* macros (see
Type spellings). If you need an API that is not listed below, extend the wrapper, or
reach the underlying node via get_rclcpp_node() (declared in both builds, but it throws when the node
is in Agnocast mode — see the build-modes table).
Supported API surface
The following members / free functions are provided. Unless noted, signatures mirror their
rclcpp::Node counterparts.
| Category | Members |
|---|---|
| Construction |
Node(name, options), Node(name, namespace, options), virtual destructor, SharedPtr. Non-copyable and non-movable (copying would alias one backend behind two wrappers). Derives from std::enable_shared_from_this<Node>, so shared_from_this() is available when the node is owned by a shared_ptr
|
| Basic info |
get_name(), get_namespace(), get_fully_qualified_name(), get_logger()
|
| Time |
get_clock(), now()
|
| Node interfaces |
get_node_base_interface(), get_node_topics_interface(), get_node_parameters_interface() (partial — only these three) |
| Callback groups | create_callback_group() |
| Parameters |
declare_parameter() (typed + ParameterValue/ParameterType overloads), has_parameter(), undeclare_parameter(), get_parameter() / get_parameters() (typed + prefix overloads), set_parameter() / set_parameters() / set_parameters_atomically(), describe_parameter(s)(), get_parameter_types(), list_parameters(), add_on_set_parameters_callback(), remove_on_set_parameters_callback()
|
| Publisher |
create_publisher<MessageT>() (QoS and depth overloads) — see Publisher API
|
| Subscription |
create_subscription<MessageT>() (QoS and depth overloads, plus a callback-less form read with take()) — see Subscription API
|
| Client |
create_client<ServiceT>() (rclcpp::QoS); async_send_request() takes allocate_output_service_request()’s result, or a plain std::shared_ptr<S::Request> that the Agnocast backend copies |
| Service |
create_service<ServiceT>() (rclcpp::QoS) — message_ptr callback form and an rclcpp-style shared_ptr callback form |
| Timer |
create_wall_timer(); free create_timer(node, clock, period, cb, group) and free set_period(timer, period) (see Timer notes) |
| Underlying node |
get_rclcpp_node(); get_agnocast_node() (agnocast-enabled build only — not declared in an agnocast-disabled build, so calling it there is a compile error); free to_rclcpp_node(node)
|
| Context | free init(), shutdown() and ok() — mode-agnostic replacements for the rclcpp equivalents (see Context notes) |
OnSetParametersCallbackTypeis aliased in this namespace and resolves to the correct rclcpp type for both Humble (rclcpp 16.x) and Jazzy (rclcpp 28+).
Polling subscribers are not a Node member. Use the free function
polling::create_polling_subscriber<MessageT>(node, topic, qos) — see
Polling Subscriber.
Reading another node’s parameters is not a Node member either. Use
autoware::agnocast_wrapper::AsyncParametersClient, which takes a Method 2 node. Of the parameter
service calls it exposes only get_parameters(), alongside wait_for_service() and
service_is_ready(); the setter, descriptor and listing calls are not wrapped yet, and
on_parameter_event() has no Agnocast counterpart. On the Agnocast backend the response arrives
over an Agnocast subscription, so get_parameters() resolves its future only while an Agnocast
executor spins the node.
create_client()andcreate_service()also accept anrmw_qos_profile_t. This is not part of the supported surface: it exists so that Humble-era call sites passingrmw_qos_profile_services_defaultkeep compiling, and it will be removed. Pass anrclcpp::QoS.
Type spellings
The member names and argument lists above are the same in both builds, but the handle, options and
message types they use are not the same C++ types. Always spell them with the AUTOWARE_* macros so the
same source compiles in both builds:
| What | Spell it as | ENABLE_AGNOCAST=0 |
ENABLE_AGNOCAST=1 |
|---|---|---|---|
create_publisher result |
AUTOWARE_PUBLISHER_PTR(M) |
rclcpp::Publisher<M>::SharedPtr |
agnocast_wrapper::Publisher<M>::SharedPtr |
create_subscription result |
AUTOWARE_SUBSCRIPTION_PTR(M) |
rclcpp::Subscription<M>::SharedPtr |
agnocast_wrapper::Subscription<M>::SharedPtr |
create_wall_timer result |
AUTOWARE_TIMER_PTR |
rclcpp::TimerBase::SharedPtr |
agnocast_wrapper::Timer::SharedPtr |
create_publisher options arg |
AUTOWARE_PUBLISHER_OPTIONS |
rclcpp::PublisherOptions |
agnocast::PublisherOptions |
create_subscription options |
AUTOWARE_SUBSCRIPTION_OPTIONS |
rclcpp::SubscriptionOptions |
agnocast::SubscriptionOptions |
| Owning subscription callback arg | AUTOWARE_MESSAGE_CONST_SHARED_PTR(M) |
std::shared_ptr<const M> |
message_ptr<const M, Shared> |
async_send_request request arg |
AUTOWARE_CLIENT_REQUEST_PTR(S) |
std::shared_ptr<S::Request> |
message_ptr<S::Request, Shared> |
A subscription callback may also take the plain MessageT::ConstSharedPtr; it needs no macro because it is spelled the same in both builds.
On the Agnocast path an owning handle must not outlive the subscription that delivered it. This covers AUTOWARE_MESSAGE_CONST_SHARED_PTR, a callback taking MessageT::ConstSharedPtr, the pointer returned by polling::take_data(), and AUTOWARE_CLIENT_RESPONSE_PTR, which the client delivers through a response subscription of its own and which therefore must not outlive the client. Reading it afterwards can return recycled memory, and releasing it can abort the process. Members are destroyed in reverse declaration order, so declare the subscription before any member that caches a message:
AUTOWARE_SUBSCRIPTION_PTR(PointCloud2) sub_; // declared first -> destroyed last
std::shared_ptr<const PointCloud2> latest_; // destroyed first -> safe
AUTOWARE_CLIENT_PTR(SrvT) client_; // same rule for a cached client response
std::shared_ptr<const SrvT::Response> cached_;
The DDS path lets the same pointer be held indefinitely, so a node validated only with ENABLE_AGNOCAST=0 will not show the problem.
AUTOWARE_CLIENT_PTR(S) / AUTOWARE_SERVICE_PTR(S) and the AUTOWARE_CLIENT_*FUTURE* macros resolve to
the wrapper’s own Client<S> / Service<S> types in both builds, so client and service code needs no
File truncated at 100 lines see the full file
Changelog for package autoware_agnocast_wrapper
1.9.0 (2026-06-24)
-
Merge remote-tracking branch 'origin/main' into tmp/bot/bump_version_base
-
refactor(autoware_agnocast_wrapper): split service ptr macros into server/client variants (#1205)
* refactor(autoware_agnocast_wrapper): split service ptr macros into server/client variants
- Apply feedback review
* Remove const from is_shared_ptr_service_callback_v ---------
-
feat(autoware_agnocast_wrapper): add overload for service (#1203)
- add create_service overload
- add assert
* fix copilot review ---------
-
feat(autoware_agnocast_wrapper): add service and client support (#1074)
- Add service and client support to agnocast wrapper
- Mark service and client support as experimental in README
- Add missing macros
- Fix colcon flag typo in README
- fix
- style(pre-commit): autofix
- fix
- style(pre-commit): autofix
- Add a comment
- Adjust create_service/create_client calls depending on rclcpp version
- fix cpplint errors
- style(pre-commit): autofix
- Fix type deduction in create_client and create_service
- Add functional header
- Fix cpplint errors
- Remove experimental tag
- Add RCLCPP version check for client and service macros
* Propagate exception in client async callbacks ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Koichi Imai <<koichi.imai.2@tier4.jp>> Co-authored-by: Koichi Imai <<45482193+Koichi98@users.noreply.github.com>>
-
feat(autoware_agnocast_wrapper): support more args for synchronizer (#1104) support 8 args
-
feat(autoware_agnocast_wrapper): adopt glog to agnocast main templete (#1180) feat(autoware_agnocast_wrapper): use glog (#88)
- feat: use glog
- fix: tag name
- feat: link glog
- fix
* fix: add ament auto library ---------
-
fix(autoware_agnocast_wrapper): get_name,namespace,get_fully_qualified_name (#1178) fix get_name,namespace,get_fully_qualified_name
-
feat(autoware_agnocast_wrapper): spawn agnocast_discovery_agent from launch wrapper (#1084) Spawn exactly one agnocast_discovery_agent per ros2 launch tree from agnocast_env.launch.{py,xml} when ENABLE_AGNOCAST=1, deduplicated tree-wide via the LaunchContext globals and pinned to namespace="/".
-
feat(autoware_agnocast_wrapper): add ON_NODE macros (#1170)
-
feat(autoware_agnocast_wrapper): update [agnocast_env.launch]{.title-ref} to enable override [use_agnocast]{.title-ref} (#1123)
- update agnocast_env.launch to override use_agnocast
- style(pre-commit): autofix
* more description in README ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
| Name |
|---|
| libgoogle-glog-dev |
Dependant Packages
Launch files
- launch/agnocast_env.launch.xml
-
- agnocast_heaphook_path [default: /opt/ros/$(env ROS_DISTRO humble)/lib/libagnocast_heaphook.so]
- use_multithread [default: false]
- use_agnocast [default: $(env ENABLE_AGNOCAST 0)]
Messages
Services
Plugins
Recent questions tagged autoware_agnocast_wrapper at Robotics Stack Exchange
Package Summary
| Version | 1.9.0 |
| License | Apache License 2.0 |
| Build type | AMENT_CMAKE |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/autowarefoundation/autoware_core.git |
| VCS Type | git |
| VCS Version | main |
| Last Updated | 2026-09-09 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Takahiro Ishikawa-Aso
- Koichi Imai
- Atsushi Yano
- Yutaro Kobayashi
- Takumi Jin
- Tetsuhiro Kawaguchi
Authors
autoware_agnocast_wrapper
The purpose of this package is to integrate Agnocast, a zero-copy middleware, into each topic in Autoware with minimal side effects. Agnocast is a library designed to work alongside ROS 2, enabling true zero-copy publish/subscribe communication for all ROS 2 message types, including unsized message types.
- Agnocast Repository: https://github.com/autowarefoundation/agnocast
- Agnocast Documentation: https://autowarefoundation.github.io/agnocast_doc/main/
- Discussion on Agnocast Integration into Autoware: https://github.com/orgs/autowarefoundation/discussions/5835
- Review Guide for Agnocast Wrapper PRs
This package provides macros that wrap functions for publish/subscribe operations and smart pointer types for handling ROS 2 messages. When Autoware is built using the default build command, Agnocast is not enabled. However, setting the environment variable ENABLE_AGNOCAST=1 enables Agnocast and results in a build that includes its integration. This design ensures backward compatibility for users who are unaware of Agnocast, minimizing disruption.
Two Integration Approaches
This package provides two approaches for integrating Agnocast. Both will coexist for the foreseeable future.
1. Node Wrapper (agnocast_wrapper::Node)
Use this when you want the entire node to transparently switch between rclcpp::Node and agnocast::Node at runtime. The node wrapper automatically selects the correct underlying implementation based on the ENABLE_AGNOCAST environment variable.
agnocast_wrapper::Node does not publicly derive from rclcpp::Node. It exposes a curated subset
of the rclcpp::Node surface and forwards each member to the underlying implementation (rclcpp::Node
or agnocast::Node). The member names and argument lists are identical in both builds
(ENABLE_AGNOCAST=0 and =1), so a node written against it compiles unchanged either way — provided
you spell the handle, options and message types with the AUTOWARE_* macros (see
Type spellings). If you need an API that is not listed below, extend the wrapper, or
reach the underlying node via get_rclcpp_node() (declared in both builds, but it throws when the node
is in Agnocast mode — see the build-modes table).
Supported API surface
The following members / free functions are provided. Unless noted, signatures mirror their
rclcpp::Node counterparts.
| Category | Members |
|---|---|
| Construction |
Node(name, options), Node(name, namespace, options), virtual destructor, SharedPtr. Non-copyable and non-movable (copying would alias one backend behind two wrappers). Derives from std::enable_shared_from_this<Node>, so shared_from_this() is available when the node is owned by a shared_ptr
|
| Basic info |
get_name(), get_namespace(), get_fully_qualified_name(), get_logger()
|
| Time |
get_clock(), now()
|
| Node interfaces |
get_node_base_interface(), get_node_topics_interface(), get_node_parameters_interface() (partial — only these three) |
| Callback groups | create_callback_group() |
| Parameters |
declare_parameter() (typed + ParameterValue/ParameterType overloads), has_parameter(), undeclare_parameter(), get_parameter() / get_parameters() (typed + prefix overloads), set_parameter() / set_parameters() / set_parameters_atomically(), describe_parameter(s)(), get_parameter_types(), list_parameters(), add_on_set_parameters_callback(), remove_on_set_parameters_callback()
|
| Publisher |
create_publisher<MessageT>() (QoS and depth overloads) — see Publisher API
|
| Subscription |
create_subscription<MessageT>() (QoS and depth overloads, plus a callback-less form read with take()) — see Subscription API
|
| Client |
create_client<ServiceT>() (rclcpp::QoS); async_send_request() takes allocate_output_service_request()’s result, or a plain std::shared_ptr<S::Request> that the Agnocast backend copies |
| Service |
create_service<ServiceT>() (rclcpp::QoS) — message_ptr callback form and an rclcpp-style shared_ptr callback form |
| Timer |
create_wall_timer(); free create_timer(node, clock, period, cb, group) and free set_period(timer, period) (see Timer notes) |
| Underlying node |
get_rclcpp_node(); get_agnocast_node() (agnocast-enabled build only — not declared in an agnocast-disabled build, so calling it there is a compile error); free to_rclcpp_node(node)
|
| Context | free init(), shutdown() and ok() — mode-agnostic replacements for the rclcpp equivalents (see Context notes) |
OnSetParametersCallbackTypeis aliased in this namespace and resolves to the correct rclcpp type for both Humble (rclcpp 16.x) and Jazzy (rclcpp 28+).
Polling subscribers are not a Node member. Use the free function
polling::create_polling_subscriber<MessageT>(node, topic, qos) — see
Polling Subscriber.
Reading another node’s parameters is not a Node member either. Use
autoware::agnocast_wrapper::AsyncParametersClient, which takes a Method 2 node. Of the parameter
service calls it exposes only get_parameters(), alongside wait_for_service() and
service_is_ready(); the setter, descriptor and listing calls are not wrapped yet, and
on_parameter_event() has no Agnocast counterpart. On the Agnocast backend the response arrives
over an Agnocast subscription, so get_parameters() resolves its future only while an Agnocast
executor spins the node.
create_client()andcreate_service()also accept anrmw_qos_profile_t. This is not part of the supported surface: it exists so that Humble-era call sites passingrmw_qos_profile_services_defaultkeep compiling, and it will be removed. Pass anrclcpp::QoS.
Type spellings
The member names and argument lists above are the same in both builds, but the handle, options and
message types they use are not the same C++ types. Always spell them with the AUTOWARE_* macros so the
same source compiles in both builds:
| What | Spell it as | ENABLE_AGNOCAST=0 |
ENABLE_AGNOCAST=1 |
|---|---|---|---|
create_publisher result |
AUTOWARE_PUBLISHER_PTR(M) |
rclcpp::Publisher<M>::SharedPtr |
agnocast_wrapper::Publisher<M>::SharedPtr |
create_subscription result |
AUTOWARE_SUBSCRIPTION_PTR(M) |
rclcpp::Subscription<M>::SharedPtr |
agnocast_wrapper::Subscription<M>::SharedPtr |
create_wall_timer result |
AUTOWARE_TIMER_PTR |
rclcpp::TimerBase::SharedPtr |
agnocast_wrapper::Timer::SharedPtr |
create_publisher options arg |
AUTOWARE_PUBLISHER_OPTIONS |
rclcpp::PublisherOptions |
agnocast::PublisherOptions |
create_subscription options |
AUTOWARE_SUBSCRIPTION_OPTIONS |
rclcpp::SubscriptionOptions |
agnocast::SubscriptionOptions |
| Owning subscription callback arg | AUTOWARE_MESSAGE_CONST_SHARED_PTR(M) |
std::shared_ptr<const M> |
message_ptr<const M, Shared> |
async_send_request request arg |
AUTOWARE_CLIENT_REQUEST_PTR(S) |
std::shared_ptr<S::Request> |
message_ptr<S::Request, Shared> |
A subscription callback may also take the plain MessageT::ConstSharedPtr; it needs no macro because it is spelled the same in both builds.
On the Agnocast path an owning handle must not outlive the subscription that delivered it. This covers AUTOWARE_MESSAGE_CONST_SHARED_PTR, a callback taking MessageT::ConstSharedPtr, the pointer returned by polling::take_data(), and AUTOWARE_CLIENT_RESPONSE_PTR, which the client delivers through a response subscription of its own and which therefore must not outlive the client. Reading it afterwards can return recycled memory, and releasing it can abort the process. Members are destroyed in reverse declaration order, so declare the subscription before any member that caches a message:
AUTOWARE_SUBSCRIPTION_PTR(PointCloud2) sub_; // declared first -> destroyed last
std::shared_ptr<const PointCloud2> latest_; // destroyed first -> safe
AUTOWARE_CLIENT_PTR(SrvT) client_; // same rule for a cached client response
std::shared_ptr<const SrvT::Response> cached_;
The DDS path lets the same pointer be held indefinitely, so a node validated only with ENABLE_AGNOCAST=0 will not show the problem.
AUTOWARE_CLIENT_PTR(S) / AUTOWARE_SERVICE_PTR(S) and the AUTOWARE_CLIENT_*FUTURE* macros resolve to
the wrapper’s own Client<S> / Service<S> types in both builds, so client and service code needs no
File truncated at 100 lines see the full file
Changelog for package autoware_agnocast_wrapper
1.9.0 (2026-06-24)
-
Merge remote-tracking branch 'origin/main' into tmp/bot/bump_version_base
-
refactor(autoware_agnocast_wrapper): split service ptr macros into server/client variants (#1205)
* refactor(autoware_agnocast_wrapper): split service ptr macros into server/client variants
- Apply feedback review
* Remove const from is_shared_ptr_service_callback_v ---------
-
feat(autoware_agnocast_wrapper): add overload for service (#1203)
- add create_service overload
- add assert
* fix copilot review ---------
-
feat(autoware_agnocast_wrapper): add service and client support (#1074)
- Add service and client support to agnocast wrapper
- Mark service and client support as experimental in README
- Add missing macros
- Fix colcon flag typo in README
- fix
- style(pre-commit): autofix
- fix
- style(pre-commit): autofix
- Add a comment
- Adjust create_service/create_client calls depending on rclcpp version
- fix cpplint errors
- style(pre-commit): autofix
- Fix type deduction in create_client and create_service
- Add functional header
- Fix cpplint errors
- Remove experimental tag
- Add RCLCPP version check for client and service macros
* Propagate exception in client async callbacks ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Koichi Imai <<koichi.imai.2@tier4.jp>> Co-authored-by: Koichi Imai <<45482193+Koichi98@users.noreply.github.com>>
-
feat(autoware_agnocast_wrapper): support more args for synchronizer (#1104) support 8 args
-
feat(autoware_agnocast_wrapper): adopt glog to agnocast main templete (#1180) feat(autoware_agnocast_wrapper): use glog (#88)
- feat: use glog
- fix: tag name
- feat: link glog
- fix
* fix: add ament auto library ---------
-
fix(autoware_agnocast_wrapper): get_name,namespace,get_fully_qualified_name (#1178) fix get_name,namespace,get_fully_qualified_name
-
feat(autoware_agnocast_wrapper): spawn agnocast_discovery_agent from launch wrapper (#1084) Spawn exactly one agnocast_discovery_agent per ros2 launch tree from agnocast_env.launch.{py,xml} when ENABLE_AGNOCAST=1, deduplicated tree-wide via the LaunchContext globals and pinned to namespace="/".
-
feat(autoware_agnocast_wrapper): add ON_NODE macros (#1170)
-
feat(autoware_agnocast_wrapper): update [agnocast_env.launch]{.title-ref} to enable override [use_agnocast]{.title-ref} (#1123)
- update agnocast_env.launch to override use_agnocast
- style(pre-commit): autofix
* more description in README ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
| Name |
|---|
| libgoogle-glog-dev |
Dependant Packages
Launch files
- launch/agnocast_env.launch.xml
-
- agnocast_heaphook_path [default: /opt/ros/$(env ROS_DISTRO humble)/lib/libagnocast_heaphook.so]
- use_multithread [default: false]
- use_agnocast [default: $(env ENABLE_AGNOCAST 0)]
Messages
Services
Plugins
Recent questions tagged autoware_agnocast_wrapper at Robotics Stack Exchange
Package Summary
| Version | 1.9.0 |
| License | Apache License 2.0 |
| Build type | AMENT_CMAKE |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/autowarefoundation/autoware_core.git |
| VCS Type | git |
| VCS Version | main |
| Last Updated | 2026-09-09 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Takahiro Ishikawa-Aso
- Koichi Imai
- Atsushi Yano
- Yutaro Kobayashi
- Takumi Jin
- Tetsuhiro Kawaguchi
Authors
autoware_agnocast_wrapper
The purpose of this package is to integrate Agnocast, a zero-copy middleware, into each topic in Autoware with minimal side effects. Agnocast is a library designed to work alongside ROS 2, enabling true zero-copy publish/subscribe communication for all ROS 2 message types, including unsized message types.
- Agnocast Repository: https://github.com/autowarefoundation/agnocast
- Agnocast Documentation: https://autowarefoundation.github.io/agnocast_doc/main/
- Discussion on Agnocast Integration into Autoware: https://github.com/orgs/autowarefoundation/discussions/5835
- Review Guide for Agnocast Wrapper PRs
This package provides macros that wrap functions for publish/subscribe operations and smart pointer types for handling ROS 2 messages. When Autoware is built using the default build command, Agnocast is not enabled. However, setting the environment variable ENABLE_AGNOCAST=1 enables Agnocast and results in a build that includes its integration. This design ensures backward compatibility for users who are unaware of Agnocast, minimizing disruption.
Two Integration Approaches
This package provides two approaches for integrating Agnocast. Both will coexist for the foreseeable future.
1. Node Wrapper (agnocast_wrapper::Node)
Use this when you want the entire node to transparently switch between rclcpp::Node and agnocast::Node at runtime. The node wrapper automatically selects the correct underlying implementation based on the ENABLE_AGNOCAST environment variable.
agnocast_wrapper::Node does not publicly derive from rclcpp::Node. It exposes a curated subset
of the rclcpp::Node surface and forwards each member to the underlying implementation (rclcpp::Node
or agnocast::Node). The member names and argument lists are identical in both builds
(ENABLE_AGNOCAST=0 and =1), so a node written against it compiles unchanged either way — provided
you spell the handle, options and message types with the AUTOWARE_* macros (see
Type spellings). If you need an API that is not listed below, extend the wrapper, or
reach the underlying node via get_rclcpp_node() (declared in both builds, but it throws when the node
is in Agnocast mode — see the build-modes table).
Supported API surface
The following members / free functions are provided. Unless noted, signatures mirror their
rclcpp::Node counterparts.
| Category | Members |
|---|---|
| Construction |
Node(name, options), Node(name, namespace, options), virtual destructor, SharedPtr. Non-copyable and non-movable (copying would alias one backend behind two wrappers). Derives from std::enable_shared_from_this<Node>, so shared_from_this() is available when the node is owned by a shared_ptr
|
| Basic info |
get_name(), get_namespace(), get_fully_qualified_name(), get_logger()
|
| Time |
get_clock(), now()
|
| Node interfaces |
get_node_base_interface(), get_node_topics_interface(), get_node_parameters_interface() (partial — only these three) |
| Callback groups | create_callback_group() |
| Parameters |
declare_parameter() (typed + ParameterValue/ParameterType overloads), has_parameter(), undeclare_parameter(), get_parameter() / get_parameters() (typed + prefix overloads), set_parameter() / set_parameters() / set_parameters_atomically(), describe_parameter(s)(), get_parameter_types(), list_parameters(), add_on_set_parameters_callback(), remove_on_set_parameters_callback()
|
| Publisher |
create_publisher<MessageT>() (QoS and depth overloads) — see Publisher API
|
| Subscription |
create_subscription<MessageT>() (QoS and depth overloads, plus a callback-less form read with take()) — see Subscription API
|
| Client |
create_client<ServiceT>() (rclcpp::QoS); async_send_request() takes allocate_output_service_request()’s result, or a plain std::shared_ptr<S::Request> that the Agnocast backend copies |
| Service |
create_service<ServiceT>() (rclcpp::QoS) — message_ptr callback form and an rclcpp-style shared_ptr callback form |
| Timer |
create_wall_timer(); free create_timer(node, clock, period, cb, group) and free set_period(timer, period) (see Timer notes) |
| Underlying node |
get_rclcpp_node(); get_agnocast_node() (agnocast-enabled build only — not declared in an agnocast-disabled build, so calling it there is a compile error); free to_rclcpp_node(node)
|
| Context | free init(), shutdown() and ok() — mode-agnostic replacements for the rclcpp equivalents (see Context notes) |
OnSetParametersCallbackTypeis aliased in this namespace and resolves to the correct rclcpp type for both Humble (rclcpp 16.x) and Jazzy (rclcpp 28+).
Polling subscribers are not a Node member. Use the free function
polling::create_polling_subscriber<MessageT>(node, topic, qos) — see
Polling Subscriber.
Reading another node’s parameters is not a Node member either. Use
autoware::agnocast_wrapper::AsyncParametersClient, which takes a Method 2 node. Of the parameter
service calls it exposes only get_parameters(), alongside wait_for_service() and
service_is_ready(); the setter, descriptor and listing calls are not wrapped yet, and
on_parameter_event() has no Agnocast counterpart. On the Agnocast backend the response arrives
over an Agnocast subscription, so get_parameters() resolves its future only while an Agnocast
executor spins the node.
create_client()andcreate_service()also accept anrmw_qos_profile_t. This is not part of the supported surface: it exists so that Humble-era call sites passingrmw_qos_profile_services_defaultkeep compiling, and it will be removed. Pass anrclcpp::QoS.
Type spellings
The member names and argument lists above are the same in both builds, but the handle, options and
message types they use are not the same C++ types. Always spell them with the AUTOWARE_* macros so the
same source compiles in both builds:
| What | Spell it as | ENABLE_AGNOCAST=0 |
ENABLE_AGNOCAST=1 |
|---|---|---|---|
create_publisher result |
AUTOWARE_PUBLISHER_PTR(M) |
rclcpp::Publisher<M>::SharedPtr |
agnocast_wrapper::Publisher<M>::SharedPtr |
create_subscription result |
AUTOWARE_SUBSCRIPTION_PTR(M) |
rclcpp::Subscription<M>::SharedPtr |
agnocast_wrapper::Subscription<M>::SharedPtr |
create_wall_timer result |
AUTOWARE_TIMER_PTR |
rclcpp::TimerBase::SharedPtr |
agnocast_wrapper::Timer::SharedPtr |
create_publisher options arg |
AUTOWARE_PUBLISHER_OPTIONS |
rclcpp::PublisherOptions |
agnocast::PublisherOptions |
create_subscription options |
AUTOWARE_SUBSCRIPTION_OPTIONS |
rclcpp::SubscriptionOptions |
agnocast::SubscriptionOptions |
| Owning subscription callback arg | AUTOWARE_MESSAGE_CONST_SHARED_PTR(M) |
std::shared_ptr<const M> |
message_ptr<const M, Shared> |
async_send_request request arg |
AUTOWARE_CLIENT_REQUEST_PTR(S) |
std::shared_ptr<S::Request> |
message_ptr<S::Request, Shared> |
A subscription callback may also take the plain MessageT::ConstSharedPtr; it needs no macro because it is spelled the same in both builds.
On the Agnocast path an owning handle must not outlive the subscription that delivered it. This covers AUTOWARE_MESSAGE_CONST_SHARED_PTR, a callback taking MessageT::ConstSharedPtr, the pointer returned by polling::take_data(), and AUTOWARE_CLIENT_RESPONSE_PTR, which the client delivers through a response subscription of its own and which therefore must not outlive the client. Reading it afterwards can return recycled memory, and releasing it can abort the process. Members are destroyed in reverse declaration order, so declare the subscription before any member that caches a message:
AUTOWARE_SUBSCRIPTION_PTR(PointCloud2) sub_; // declared first -> destroyed last
std::shared_ptr<const PointCloud2> latest_; // destroyed first -> safe
AUTOWARE_CLIENT_PTR(SrvT) client_; // same rule for a cached client response
std::shared_ptr<const SrvT::Response> cached_;
The DDS path lets the same pointer be held indefinitely, so a node validated only with ENABLE_AGNOCAST=0 will not show the problem.
AUTOWARE_CLIENT_PTR(S) / AUTOWARE_SERVICE_PTR(S) and the AUTOWARE_CLIENT_*FUTURE* macros resolve to
the wrapper’s own Client<S> / Service<S> types in both builds, so client and service code needs no
File truncated at 100 lines see the full file
Changelog for package autoware_agnocast_wrapper
1.9.0 (2026-06-24)
-
Merge remote-tracking branch 'origin/main' into tmp/bot/bump_version_base
-
refactor(autoware_agnocast_wrapper): split service ptr macros into server/client variants (#1205)
* refactor(autoware_agnocast_wrapper): split service ptr macros into server/client variants
- Apply feedback review
* Remove const from is_shared_ptr_service_callback_v ---------
-
feat(autoware_agnocast_wrapper): add overload for service (#1203)
- add create_service overload
- add assert
* fix copilot review ---------
-
feat(autoware_agnocast_wrapper): add service and client support (#1074)
- Add service and client support to agnocast wrapper
- Mark service and client support as experimental in README
- Add missing macros
- Fix colcon flag typo in README
- fix
- style(pre-commit): autofix
- fix
- style(pre-commit): autofix
- Add a comment
- Adjust create_service/create_client calls depending on rclcpp version
- fix cpplint errors
- style(pre-commit): autofix
- Fix type deduction in create_client and create_service
- Add functional header
- Fix cpplint errors
- Remove experimental tag
- Add RCLCPP version check for client and service macros
* Propagate exception in client async callbacks ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Koichi Imai <<koichi.imai.2@tier4.jp>> Co-authored-by: Koichi Imai <<45482193+Koichi98@users.noreply.github.com>>
-
feat(autoware_agnocast_wrapper): support more args for synchronizer (#1104) support 8 args
-
feat(autoware_agnocast_wrapper): adopt glog to agnocast main templete (#1180) feat(autoware_agnocast_wrapper): use glog (#88)
- feat: use glog
- fix: tag name
- feat: link glog
- fix
* fix: add ament auto library ---------
-
fix(autoware_agnocast_wrapper): get_name,namespace,get_fully_qualified_name (#1178) fix get_name,namespace,get_fully_qualified_name
-
feat(autoware_agnocast_wrapper): spawn agnocast_discovery_agent from launch wrapper (#1084) Spawn exactly one agnocast_discovery_agent per ros2 launch tree from agnocast_env.launch.{py,xml} when ENABLE_AGNOCAST=1, deduplicated tree-wide via the LaunchContext globals and pinned to namespace="/".
-
feat(autoware_agnocast_wrapper): add ON_NODE macros (#1170)
-
feat(autoware_agnocast_wrapper): update [agnocast_env.launch]{.title-ref} to enable override [use_agnocast]{.title-ref} (#1123)
- update agnocast_env.launch to override use_agnocast
- style(pre-commit): autofix
* more description in README ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
| Name |
|---|
| libgoogle-glog-dev |
Dependant Packages
Launch files
- launch/agnocast_env.launch.xml
-
- agnocast_heaphook_path [default: /opt/ros/$(env ROS_DISTRO humble)/lib/libagnocast_heaphook.so]
- use_multithread [default: false]
- use_agnocast [default: $(env ENABLE_AGNOCAST 0)]
Messages
Services
Plugins
Recent questions tagged autoware_agnocast_wrapper at Robotics Stack Exchange
Package Summary
| Version | 1.9.0 |
| License | Apache License 2.0 |
| Build type | AMENT_CMAKE |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/autowarefoundation/autoware_core.git |
| VCS Type | git |
| VCS Version | main |
| Last Updated | 2026-09-09 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Takahiro Ishikawa-Aso
- Koichi Imai
- Atsushi Yano
- Yutaro Kobayashi
- Takumi Jin
- Tetsuhiro Kawaguchi
Authors
autoware_agnocast_wrapper
The purpose of this package is to integrate Agnocast, a zero-copy middleware, into each topic in Autoware with minimal side effects. Agnocast is a library designed to work alongside ROS 2, enabling true zero-copy publish/subscribe communication for all ROS 2 message types, including unsized message types.
- Agnocast Repository: https://github.com/autowarefoundation/agnocast
- Agnocast Documentation: https://autowarefoundation.github.io/agnocast_doc/main/
- Discussion on Agnocast Integration into Autoware: https://github.com/orgs/autowarefoundation/discussions/5835
- Review Guide for Agnocast Wrapper PRs
This package provides macros that wrap functions for publish/subscribe operations and smart pointer types for handling ROS 2 messages. When Autoware is built using the default build command, Agnocast is not enabled. However, setting the environment variable ENABLE_AGNOCAST=1 enables Agnocast and results in a build that includes its integration. This design ensures backward compatibility for users who are unaware of Agnocast, minimizing disruption.
Two Integration Approaches
This package provides two approaches for integrating Agnocast. Both will coexist for the foreseeable future.
1. Node Wrapper (agnocast_wrapper::Node)
Use this when you want the entire node to transparently switch between rclcpp::Node and agnocast::Node at runtime. The node wrapper automatically selects the correct underlying implementation based on the ENABLE_AGNOCAST environment variable.
agnocast_wrapper::Node does not publicly derive from rclcpp::Node. It exposes a curated subset
of the rclcpp::Node surface and forwards each member to the underlying implementation (rclcpp::Node
or agnocast::Node). The member names and argument lists are identical in both builds
(ENABLE_AGNOCAST=0 and =1), so a node written against it compiles unchanged either way — provided
you spell the handle, options and message types with the AUTOWARE_* macros (see
Type spellings). If you need an API that is not listed below, extend the wrapper, or
reach the underlying node via get_rclcpp_node() (declared in both builds, but it throws when the node
is in Agnocast mode — see the build-modes table).
Supported API surface
The following members / free functions are provided. Unless noted, signatures mirror their
rclcpp::Node counterparts.
| Category | Members |
|---|---|
| Construction |
Node(name, options), Node(name, namespace, options), virtual destructor, SharedPtr. Non-copyable and non-movable (copying would alias one backend behind two wrappers). Derives from std::enable_shared_from_this<Node>, so shared_from_this() is available when the node is owned by a shared_ptr
|
| Basic info |
get_name(), get_namespace(), get_fully_qualified_name(), get_logger()
|
| Time |
get_clock(), now()
|
| Node interfaces |
get_node_base_interface(), get_node_topics_interface(), get_node_parameters_interface() (partial — only these three) |
| Callback groups | create_callback_group() |
| Parameters |
declare_parameter() (typed + ParameterValue/ParameterType overloads), has_parameter(), undeclare_parameter(), get_parameter() / get_parameters() (typed + prefix overloads), set_parameter() / set_parameters() / set_parameters_atomically(), describe_parameter(s)(), get_parameter_types(), list_parameters(), add_on_set_parameters_callback(), remove_on_set_parameters_callback()
|
| Publisher |
create_publisher<MessageT>() (QoS and depth overloads) — see Publisher API
|
| Subscription |
create_subscription<MessageT>() (QoS and depth overloads, plus a callback-less form read with take()) — see Subscription API
|
| Client |
create_client<ServiceT>() (rclcpp::QoS); async_send_request() takes allocate_output_service_request()’s result, or a plain std::shared_ptr<S::Request> that the Agnocast backend copies |
| Service |
create_service<ServiceT>() (rclcpp::QoS) — message_ptr callback form and an rclcpp-style shared_ptr callback form |
| Timer |
create_wall_timer(); free create_timer(node, clock, period, cb, group) and free set_period(timer, period) (see Timer notes) |
| Underlying node |
get_rclcpp_node(); get_agnocast_node() (agnocast-enabled build only — not declared in an agnocast-disabled build, so calling it there is a compile error); free to_rclcpp_node(node)
|
| Context | free init(), shutdown() and ok() — mode-agnostic replacements for the rclcpp equivalents (see Context notes) |
OnSetParametersCallbackTypeis aliased in this namespace and resolves to the correct rclcpp type for both Humble (rclcpp 16.x) and Jazzy (rclcpp 28+).
Polling subscribers are not a Node member. Use the free function
polling::create_polling_subscriber<MessageT>(node, topic, qos) — see
Polling Subscriber.
Reading another node’s parameters is not a Node member either. Use
autoware::agnocast_wrapper::AsyncParametersClient, which takes a Method 2 node. Of the parameter
service calls it exposes only get_parameters(), alongside wait_for_service() and
service_is_ready(); the setter, descriptor and listing calls are not wrapped yet, and
on_parameter_event() has no Agnocast counterpart. On the Agnocast backend the response arrives
over an Agnocast subscription, so get_parameters() resolves its future only while an Agnocast
executor spins the node.
create_client()andcreate_service()also accept anrmw_qos_profile_t. This is not part of the supported surface: it exists so that Humble-era call sites passingrmw_qos_profile_services_defaultkeep compiling, and it will be removed. Pass anrclcpp::QoS.
Type spellings
The member names and argument lists above are the same in both builds, but the handle, options and
message types they use are not the same C++ types. Always spell them with the AUTOWARE_* macros so the
same source compiles in both builds:
| What | Spell it as | ENABLE_AGNOCAST=0 |
ENABLE_AGNOCAST=1 |
|---|---|---|---|
create_publisher result |
AUTOWARE_PUBLISHER_PTR(M) |
rclcpp::Publisher<M>::SharedPtr |
agnocast_wrapper::Publisher<M>::SharedPtr |
create_subscription result |
AUTOWARE_SUBSCRIPTION_PTR(M) |
rclcpp::Subscription<M>::SharedPtr |
agnocast_wrapper::Subscription<M>::SharedPtr |
create_wall_timer result |
AUTOWARE_TIMER_PTR |
rclcpp::TimerBase::SharedPtr |
agnocast_wrapper::Timer::SharedPtr |
create_publisher options arg |
AUTOWARE_PUBLISHER_OPTIONS |
rclcpp::PublisherOptions |
agnocast::PublisherOptions |
create_subscription options |
AUTOWARE_SUBSCRIPTION_OPTIONS |
rclcpp::SubscriptionOptions |
agnocast::SubscriptionOptions |
| Owning subscription callback arg | AUTOWARE_MESSAGE_CONST_SHARED_PTR(M) |
std::shared_ptr<const M> |
message_ptr<const M, Shared> |
async_send_request request arg |
AUTOWARE_CLIENT_REQUEST_PTR(S) |
std::shared_ptr<S::Request> |
message_ptr<S::Request, Shared> |
A subscription callback may also take the plain MessageT::ConstSharedPtr; it needs no macro because it is spelled the same in both builds.
On the Agnocast path an owning handle must not outlive the subscription that delivered it. This covers AUTOWARE_MESSAGE_CONST_SHARED_PTR, a callback taking MessageT::ConstSharedPtr, the pointer returned by polling::take_data(), and AUTOWARE_CLIENT_RESPONSE_PTR, which the client delivers through a response subscription of its own and which therefore must not outlive the client. Reading it afterwards can return recycled memory, and releasing it can abort the process. Members are destroyed in reverse declaration order, so declare the subscription before any member that caches a message:
AUTOWARE_SUBSCRIPTION_PTR(PointCloud2) sub_; // declared first -> destroyed last
std::shared_ptr<const PointCloud2> latest_; // destroyed first -> safe
AUTOWARE_CLIENT_PTR(SrvT) client_; // same rule for a cached client response
std::shared_ptr<const SrvT::Response> cached_;
The DDS path lets the same pointer be held indefinitely, so a node validated only with ENABLE_AGNOCAST=0 will not show the problem.
AUTOWARE_CLIENT_PTR(S) / AUTOWARE_SERVICE_PTR(S) and the AUTOWARE_CLIENT_*FUTURE* macros resolve to
the wrapper’s own Client<S> / Service<S> types in both builds, so client and service code needs no
File truncated at 100 lines see the full file
Changelog for package autoware_agnocast_wrapper
1.9.0 (2026-06-24)
-
Merge remote-tracking branch 'origin/main' into tmp/bot/bump_version_base
-
refactor(autoware_agnocast_wrapper): split service ptr macros into server/client variants (#1205)
* refactor(autoware_agnocast_wrapper): split service ptr macros into server/client variants
- Apply feedback review
* Remove const from is_shared_ptr_service_callback_v ---------
-
feat(autoware_agnocast_wrapper): add overload for service (#1203)
- add create_service overload
- add assert
* fix copilot review ---------
-
feat(autoware_agnocast_wrapper): add service and client support (#1074)
- Add service and client support to agnocast wrapper
- Mark service and client support as experimental in README
- Add missing macros
- Fix colcon flag typo in README
- fix
- style(pre-commit): autofix
- fix
- style(pre-commit): autofix
- Add a comment
- Adjust create_service/create_client calls depending on rclcpp version
- fix cpplint errors
- style(pre-commit): autofix
- Fix type deduction in create_client and create_service
- Add functional header
- Fix cpplint errors
- Remove experimental tag
- Add RCLCPP version check for client and service macros
* Propagate exception in client async callbacks ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Koichi Imai <<koichi.imai.2@tier4.jp>> Co-authored-by: Koichi Imai <<45482193+Koichi98@users.noreply.github.com>>
-
feat(autoware_agnocast_wrapper): support more args for synchronizer (#1104) support 8 args
-
feat(autoware_agnocast_wrapper): adopt glog to agnocast main templete (#1180) feat(autoware_agnocast_wrapper): use glog (#88)
- feat: use glog
- fix: tag name
- feat: link glog
- fix
* fix: add ament auto library ---------
-
fix(autoware_agnocast_wrapper): get_name,namespace,get_fully_qualified_name (#1178) fix get_name,namespace,get_fully_qualified_name
-
feat(autoware_agnocast_wrapper): spawn agnocast_discovery_agent from launch wrapper (#1084) Spawn exactly one agnocast_discovery_agent per ros2 launch tree from agnocast_env.launch.{py,xml} when ENABLE_AGNOCAST=1, deduplicated tree-wide via the LaunchContext globals and pinned to namespace="/".
-
feat(autoware_agnocast_wrapper): add ON_NODE macros (#1170)
-
feat(autoware_agnocast_wrapper): update [agnocast_env.launch]{.title-ref} to enable override [use_agnocast]{.title-ref} (#1123)
- update agnocast_env.launch to override use_agnocast
- style(pre-commit): autofix
* more description in README ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
| Name |
|---|
| libgoogle-glog-dev |
Dependant Packages
Launch files
- launch/agnocast_env.launch.xml
-
- agnocast_heaphook_path [default: /opt/ros/$(env ROS_DISTRO humble)/lib/libagnocast_heaphook.so]
- use_multithread [default: false]
- use_agnocast [default: $(env ENABLE_AGNOCAST 0)]
Messages
Services
Plugins
Recent questions tagged autoware_agnocast_wrapper at Robotics Stack Exchange
Package Summary
| Version | 1.9.0 |
| License | Apache License 2.0 |
| Build type | AMENT_CMAKE |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/autowarefoundation/autoware_core.git |
| VCS Type | git |
| VCS Version | main |
| Last Updated | 2026-09-09 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Takahiro Ishikawa-Aso
- Koichi Imai
- Atsushi Yano
- Yutaro Kobayashi
- Takumi Jin
- Tetsuhiro Kawaguchi
Authors
autoware_agnocast_wrapper
The purpose of this package is to integrate Agnocast, a zero-copy middleware, into each topic in Autoware with minimal side effects. Agnocast is a library designed to work alongside ROS 2, enabling true zero-copy publish/subscribe communication for all ROS 2 message types, including unsized message types.
- Agnocast Repository: https://github.com/autowarefoundation/agnocast
- Agnocast Documentation: https://autowarefoundation.github.io/agnocast_doc/main/
- Discussion on Agnocast Integration into Autoware: https://github.com/orgs/autowarefoundation/discussions/5835
- Review Guide for Agnocast Wrapper PRs
This package provides macros that wrap functions for publish/subscribe operations and smart pointer types for handling ROS 2 messages. When Autoware is built using the default build command, Agnocast is not enabled. However, setting the environment variable ENABLE_AGNOCAST=1 enables Agnocast and results in a build that includes its integration. This design ensures backward compatibility for users who are unaware of Agnocast, minimizing disruption.
Two Integration Approaches
This package provides two approaches for integrating Agnocast. Both will coexist for the foreseeable future.
1. Node Wrapper (agnocast_wrapper::Node)
Use this when you want the entire node to transparently switch between rclcpp::Node and agnocast::Node at runtime. The node wrapper automatically selects the correct underlying implementation based on the ENABLE_AGNOCAST environment variable.
agnocast_wrapper::Node does not publicly derive from rclcpp::Node. It exposes a curated subset
of the rclcpp::Node surface and forwards each member to the underlying implementation (rclcpp::Node
or agnocast::Node). The member names and argument lists are identical in both builds
(ENABLE_AGNOCAST=0 and =1), so a node written against it compiles unchanged either way — provided
you spell the handle, options and message types with the AUTOWARE_* macros (see
Type spellings). If you need an API that is not listed below, extend the wrapper, or
reach the underlying node via get_rclcpp_node() (declared in both builds, but it throws when the node
is in Agnocast mode — see the build-modes table).
Supported API surface
The following members / free functions are provided. Unless noted, signatures mirror their
rclcpp::Node counterparts.
| Category | Members |
|---|---|
| Construction |
Node(name, options), Node(name, namespace, options), virtual destructor, SharedPtr. Non-copyable and non-movable (copying would alias one backend behind two wrappers). Derives from std::enable_shared_from_this<Node>, so shared_from_this() is available when the node is owned by a shared_ptr
|
| Basic info |
get_name(), get_namespace(), get_fully_qualified_name(), get_logger()
|
| Time |
get_clock(), now()
|
| Node interfaces |
get_node_base_interface(), get_node_topics_interface(), get_node_parameters_interface() (partial — only these three) |
| Callback groups | create_callback_group() |
| Parameters |
declare_parameter() (typed + ParameterValue/ParameterType overloads), has_parameter(), undeclare_parameter(), get_parameter() / get_parameters() (typed + prefix overloads), set_parameter() / set_parameters() / set_parameters_atomically(), describe_parameter(s)(), get_parameter_types(), list_parameters(), add_on_set_parameters_callback(), remove_on_set_parameters_callback()
|
| Publisher |
create_publisher<MessageT>() (QoS and depth overloads) — see Publisher API
|
| Subscription |
create_subscription<MessageT>() (QoS and depth overloads, plus a callback-less form read with take()) — see Subscription API
|
| Client |
create_client<ServiceT>() (rclcpp::QoS); async_send_request() takes allocate_output_service_request()’s result, or a plain std::shared_ptr<S::Request> that the Agnocast backend copies |
| Service |
create_service<ServiceT>() (rclcpp::QoS) — message_ptr callback form and an rclcpp-style shared_ptr callback form |
| Timer |
create_wall_timer(); free create_timer(node, clock, period, cb, group) and free set_period(timer, period) (see Timer notes) |
| Underlying node |
get_rclcpp_node(); get_agnocast_node() (agnocast-enabled build only — not declared in an agnocast-disabled build, so calling it there is a compile error); free to_rclcpp_node(node)
|
| Context | free init(), shutdown() and ok() — mode-agnostic replacements for the rclcpp equivalents (see Context notes) |
OnSetParametersCallbackTypeis aliased in this namespace and resolves to the correct rclcpp type for both Humble (rclcpp 16.x) and Jazzy (rclcpp 28+).
Polling subscribers are not a Node member. Use the free function
polling::create_polling_subscriber<MessageT>(node, topic, qos) — see
Polling Subscriber.
Reading another node’s parameters is not a Node member either. Use
autoware::agnocast_wrapper::AsyncParametersClient, which takes a Method 2 node. Of the parameter
service calls it exposes only get_parameters(), alongside wait_for_service() and
service_is_ready(); the setter, descriptor and listing calls are not wrapped yet, and
on_parameter_event() has no Agnocast counterpart. On the Agnocast backend the response arrives
over an Agnocast subscription, so get_parameters() resolves its future only while an Agnocast
executor spins the node.
create_client()andcreate_service()also accept anrmw_qos_profile_t. This is not part of the supported surface: it exists so that Humble-era call sites passingrmw_qos_profile_services_defaultkeep compiling, and it will be removed. Pass anrclcpp::QoS.
Type spellings
The member names and argument lists above are the same in both builds, but the handle, options and
message types they use are not the same C++ types. Always spell them with the AUTOWARE_* macros so the
same source compiles in both builds:
| What | Spell it as | ENABLE_AGNOCAST=0 |
ENABLE_AGNOCAST=1 |
|---|---|---|---|
create_publisher result |
AUTOWARE_PUBLISHER_PTR(M) |
rclcpp::Publisher<M>::SharedPtr |
agnocast_wrapper::Publisher<M>::SharedPtr |
create_subscription result |
AUTOWARE_SUBSCRIPTION_PTR(M) |
rclcpp::Subscription<M>::SharedPtr |
agnocast_wrapper::Subscription<M>::SharedPtr |
create_wall_timer result |
AUTOWARE_TIMER_PTR |
rclcpp::TimerBase::SharedPtr |
agnocast_wrapper::Timer::SharedPtr |
create_publisher options arg |
AUTOWARE_PUBLISHER_OPTIONS |
rclcpp::PublisherOptions |
agnocast::PublisherOptions |
create_subscription options |
AUTOWARE_SUBSCRIPTION_OPTIONS |
rclcpp::SubscriptionOptions |
agnocast::SubscriptionOptions |
| Owning subscription callback arg | AUTOWARE_MESSAGE_CONST_SHARED_PTR(M) |
std::shared_ptr<const M> |
message_ptr<const M, Shared> |
async_send_request request arg |
AUTOWARE_CLIENT_REQUEST_PTR(S) |
std::shared_ptr<S::Request> |
message_ptr<S::Request, Shared> |
A subscription callback may also take the plain MessageT::ConstSharedPtr; it needs no macro because it is spelled the same in both builds.
On the Agnocast path an owning handle must not outlive the subscription that delivered it. This covers AUTOWARE_MESSAGE_CONST_SHARED_PTR, a callback taking MessageT::ConstSharedPtr, the pointer returned by polling::take_data(), and AUTOWARE_CLIENT_RESPONSE_PTR, which the client delivers through a response subscription of its own and which therefore must not outlive the client. Reading it afterwards can return recycled memory, and releasing it can abort the process. Members are destroyed in reverse declaration order, so declare the subscription before any member that caches a message:
AUTOWARE_SUBSCRIPTION_PTR(PointCloud2) sub_; // declared first -> destroyed last
std::shared_ptr<const PointCloud2> latest_; // destroyed first -> safe
AUTOWARE_CLIENT_PTR(SrvT) client_; // same rule for a cached client response
std::shared_ptr<const SrvT::Response> cached_;
The DDS path lets the same pointer be held indefinitely, so a node validated only with ENABLE_AGNOCAST=0 will not show the problem.
AUTOWARE_CLIENT_PTR(S) / AUTOWARE_SERVICE_PTR(S) and the AUTOWARE_CLIENT_*FUTURE* macros resolve to
the wrapper’s own Client<S> / Service<S> types in both builds, so client and service code needs no
File truncated at 100 lines see the full file
Changelog for package autoware_agnocast_wrapper
1.9.0 (2026-06-24)
-
Merge remote-tracking branch 'origin/main' into tmp/bot/bump_version_base
-
refactor(autoware_agnocast_wrapper): split service ptr macros into server/client variants (#1205)
* refactor(autoware_agnocast_wrapper): split service ptr macros into server/client variants
- Apply feedback review
* Remove const from is_shared_ptr_service_callback_v ---------
-
feat(autoware_agnocast_wrapper): add overload for service (#1203)
- add create_service overload
- add assert
* fix copilot review ---------
-
feat(autoware_agnocast_wrapper): add service and client support (#1074)
- Add service and client support to agnocast wrapper
- Mark service and client support as experimental in README
- Add missing macros
- Fix colcon flag typo in README
- fix
- style(pre-commit): autofix
- fix
- style(pre-commit): autofix
- Add a comment
- Adjust create_service/create_client calls depending on rclcpp version
- fix cpplint errors
- style(pre-commit): autofix
- Fix type deduction in create_client and create_service
- Add functional header
- Fix cpplint errors
- Remove experimental tag
- Add RCLCPP version check for client and service macros
* Propagate exception in client async callbacks ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Koichi Imai <<koichi.imai.2@tier4.jp>> Co-authored-by: Koichi Imai <<45482193+Koichi98@users.noreply.github.com>>
-
feat(autoware_agnocast_wrapper): support more args for synchronizer (#1104) support 8 args
-
feat(autoware_agnocast_wrapper): adopt glog to agnocast main templete (#1180) feat(autoware_agnocast_wrapper): use glog (#88)
- feat: use glog
- fix: tag name
- feat: link glog
- fix
* fix: add ament auto library ---------
-
fix(autoware_agnocast_wrapper): get_name,namespace,get_fully_qualified_name (#1178) fix get_name,namespace,get_fully_qualified_name
-
feat(autoware_agnocast_wrapper): spawn agnocast_discovery_agent from launch wrapper (#1084) Spawn exactly one agnocast_discovery_agent per ros2 launch tree from agnocast_env.launch.{py,xml} when ENABLE_AGNOCAST=1, deduplicated tree-wide via the LaunchContext globals and pinned to namespace="/".
-
feat(autoware_agnocast_wrapper): add ON_NODE macros (#1170)
-
feat(autoware_agnocast_wrapper): update [agnocast_env.launch]{.title-ref} to enable override [use_agnocast]{.title-ref} (#1123)
- update agnocast_env.launch to override use_agnocast
- style(pre-commit): autofix
* more description in README ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
| Name |
|---|
| libgoogle-glog-dev |
Dependant Packages
Launch files
- launch/agnocast_env.launch.xml
-
- agnocast_heaphook_path [default: /opt/ros/$(env ROS_DISTRO humble)/lib/libagnocast_heaphook.so]
- use_multithread [default: false]
- use_agnocast [default: $(env ENABLE_AGNOCAST 0)]
Messages
Services
Plugins
Recent questions tagged autoware_agnocast_wrapper at Robotics Stack Exchange
Package Summary
| Version | 1.9.0 |
| License | Apache License 2.0 |
| Build type | AMENT_CMAKE |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/autowarefoundation/autoware_core.git |
| VCS Type | git |
| VCS Version | main |
| Last Updated | 2026-09-09 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Takahiro Ishikawa-Aso
- Koichi Imai
- Atsushi Yano
- Yutaro Kobayashi
- Takumi Jin
- Tetsuhiro Kawaguchi
Authors
autoware_agnocast_wrapper
The purpose of this package is to integrate Agnocast, a zero-copy middleware, into each topic in Autoware with minimal side effects. Agnocast is a library designed to work alongside ROS 2, enabling true zero-copy publish/subscribe communication for all ROS 2 message types, including unsized message types.
- Agnocast Repository: https://github.com/autowarefoundation/agnocast
- Agnocast Documentation: https://autowarefoundation.github.io/agnocast_doc/main/
- Discussion on Agnocast Integration into Autoware: https://github.com/orgs/autowarefoundation/discussions/5835
- Review Guide for Agnocast Wrapper PRs
This package provides macros that wrap functions for publish/subscribe operations and smart pointer types for handling ROS 2 messages. When Autoware is built using the default build command, Agnocast is not enabled. However, setting the environment variable ENABLE_AGNOCAST=1 enables Agnocast and results in a build that includes its integration. This design ensures backward compatibility for users who are unaware of Agnocast, minimizing disruption.
Two Integration Approaches
This package provides two approaches for integrating Agnocast. Both will coexist for the foreseeable future.
1. Node Wrapper (agnocast_wrapper::Node)
Use this when you want the entire node to transparently switch between rclcpp::Node and agnocast::Node at runtime. The node wrapper automatically selects the correct underlying implementation based on the ENABLE_AGNOCAST environment variable.
agnocast_wrapper::Node does not publicly derive from rclcpp::Node. It exposes a curated subset
of the rclcpp::Node surface and forwards each member to the underlying implementation (rclcpp::Node
or agnocast::Node). The member names and argument lists are identical in both builds
(ENABLE_AGNOCAST=0 and =1), so a node written against it compiles unchanged either way — provided
you spell the handle, options and message types with the AUTOWARE_* macros (see
Type spellings). If you need an API that is not listed below, extend the wrapper, or
reach the underlying node via get_rclcpp_node() (declared in both builds, but it throws when the node
is in Agnocast mode — see the build-modes table).
Supported API surface
The following members / free functions are provided. Unless noted, signatures mirror their
rclcpp::Node counterparts.
| Category | Members |
|---|---|
| Construction |
Node(name, options), Node(name, namespace, options), virtual destructor, SharedPtr. Non-copyable and non-movable (copying would alias one backend behind two wrappers). Derives from std::enable_shared_from_this<Node>, so shared_from_this() is available when the node is owned by a shared_ptr
|
| Basic info |
get_name(), get_namespace(), get_fully_qualified_name(), get_logger()
|
| Time |
get_clock(), now()
|
| Node interfaces |
get_node_base_interface(), get_node_topics_interface(), get_node_parameters_interface() (partial — only these three) |
| Callback groups | create_callback_group() |
| Parameters |
declare_parameter() (typed + ParameterValue/ParameterType overloads), has_parameter(), undeclare_parameter(), get_parameter() / get_parameters() (typed + prefix overloads), set_parameter() / set_parameters() / set_parameters_atomically(), describe_parameter(s)(), get_parameter_types(), list_parameters(), add_on_set_parameters_callback(), remove_on_set_parameters_callback()
|
| Publisher |
create_publisher<MessageT>() (QoS and depth overloads) — see Publisher API
|
| Subscription |
create_subscription<MessageT>() (QoS and depth overloads, plus a callback-less form read with take()) — see Subscription API
|
| Client |
create_client<ServiceT>() (rclcpp::QoS); async_send_request() takes allocate_output_service_request()’s result, or a plain std::shared_ptr<S::Request> that the Agnocast backend copies |
| Service |
create_service<ServiceT>() (rclcpp::QoS) — message_ptr callback form and an rclcpp-style shared_ptr callback form |
| Timer |
create_wall_timer(); free create_timer(node, clock, period, cb, group) and free set_period(timer, period) (see Timer notes) |
| Underlying node |
get_rclcpp_node(); get_agnocast_node() (agnocast-enabled build only — not declared in an agnocast-disabled build, so calling it there is a compile error); free to_rclcpp_node(node)
|
| Context | free init(), shutdown() and ok() — mode-agnostic replacements for the rclcpp equivalents (see Context notes) |
OnSetParametersCallbackTypeis aliased in this namespace and resolves to the correct rclcpp type for both Humble (rclcpp 16.x) and Jazzy (rclcpp 28+).
Polling subscribers are not a Node member. Use the free function
polling::create_polling_subscriber<MessageT>(node, topic, qos) — see
Polling Subscriber.
Reading another node’s parameters is not a Node member either. Use
autoware::agnocast_wrapper::AsyncParametersClient, which takes a Method 2 node. Of the parameter
service calls it exposes only get_parameters(), alongside wait_for_service() and
service_is_ready(); the setter, descriptor and listing calls are not wrapped yet, and
on_parameter_event() has no Agnocast counterpart. On the Agnocast backend the response arrives
over an Agnocast subscription, so get_parameters() resolves its future only while an Agnocast
executor spins the node.
create_client()andcreate_service()also accept anrmw_qos_profile_t. This is not part of the supported surface: it exists so that Humble-era call sites passingrmw_qos_profile_services_defaultkeep compiling, and it will be removed. Pass anrclcpp::QoS.
Type spellings
The member names and argument lists above are the same in both builds, but the handle, options and
message types they use are not the same C++ types. Always spell them with the AUTOWARE_* macros so the
same source compiles in both builds:
| What | Spell it as | ENABLE_AGNOCAST=0 |
ENABLE_AGNOCAST=1 |
|---|---|---|---|
create_publisher result |
AUTOWARE_PUBLISHER_PTR(M) |
rclcpp::Publisher<M>::SharedPtr |
agnocast_wrapper::Publisher<M>::SharedPtr |
create_subscription result |
AUTOWARE_SUBSCRIPTION_PTR(M) |
rclcpp::Subscription<M>::SharedPtr |
agnocast_wrapper::Subscription<M>::SharedPtr |
create_wall_timer result |
AUTOWARE_TIMER_PTR |
rclcpp::TimerBase::SharedPtr |
agnocast_wrapper::Timer::SharedPtr |
create_publisher options arg |
AUTOWARE_PUBLISHER_OPTIONS |
rclcpp::PublisherOptions |
agnocast::PublisherOptions |
create_subscription options |
AUTOWARE_SUBSCRIPTION_OPTIONS |
rclcpp::SubscriptionOptions |
agnocast::SubscriptionOptions |
| Owning subscription callback arg | AUTOWARE_MESSAGE_CONST_SHARED_PTR(M) |
std::shared_ptr<const M> |
message_ptr<const M, Shared> |
async_send_request request arg |
AUTOWARE_CLIENT_REQUEST_PTR(S) |
std::shared_ptr<S::Request> |
message_ptr<S::Request, Shared> |
A subscription callback may also take the plain MessageT::ConstSharedPtr; it needs no macro because it is spelled the same in both builds.
On the Agnocast path an owning handle must not outlive the subscription that delivered it. This covers AUTOWARE_MESSAGE_CONST_SHARED_PTR, a callback taking MessageT::ConstSharedPtr, the pointer returned by polling::take_data(), and AUTOWARE_CLIENT_RESPONSE_PTR, which the client delivers through a response subscription of its own and which therefore must not outlive the client. Reading it afterwards can return recycled memory, and releasing it can abort the process. Members are destroyed in reverse declaration order, so declare the subscription before any member that caches a message:
AUTOWARE_SUBSCRIPTION_PTR(PointCloud2) sub_; // declared first -> destroyed last
std::shared_ptr<const PointCloud2> latest_; // destroyed first -> safe
AUTOWARE_CLIENT_PTR(SrvT) client_; // same rule for a cached client response
std::shared_ptr<const SrvT::Response> cached_;
The DDS path lets the same pointer be held indefinitely, so a node validated only with ENABLE_AGNOCAST=0 will not show the problem.
AUTOWARE_CLIENT_PTR(S) / AUTOWARE_SERVICE_PTR(S) and the AUTOWARE_CLIENT_*FUTURE* macros resolve to
the wrapper’s own Client<S> / Service<S> types in both builds, so client and service code needs no
File truncated at 100 lines see the full file
Changelog for package autoware_agnocast_wrapper
1.9.0 (2026-06-24)
-
Merge remote-tracking branch 'origin/main' into tmp/bot/bump_version_base
-
refactor(autoware_agnocast_wrapper): split service ptr macros into server/client variants (#1205)
* refactor(autoware_agnocast_wrapper): split service ptr macros into server/client variants
- Apply feedback review
* Remove const from is_shared_ptr_service_callback_v ---------
-
feat(autoware_agnocast_wrapper): add overload for service (#1203)
- add create_service overload
- add assert
* fix copilot review ---------
-
feat(autoware_agnocast_wrapper): add service and client support (#1074)
- Add service and client support to agnocast wrapper
- Mark service and client support as experimental in README
- Add missing macros
- Fix colcon flag typo in README
- fix
- style(pre-commit): autofix
- fix
- style(pre-commit): autofix
- Add a comment
- Adjust create_service/create_client calls depending on rclcpp version
- fix cpplint errors
- style(pre-commit): autofix
- Fix type deduction in create_client and create_service
- Add functional header
- Fix cpplint errors
- Remove experimental tag
- Add RCLCPP version check for client and service macros
* Propagate exception in client async callbacks ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Koichi Imai <<koichi.imai.2@tier4.jp>> Co-authored-by: Koichi Imai <<45482193+Koichi98@users.noreply.github.com>>
-
feat(autoware_agnocast_wrapper): support more args for synchronizer (#1104) support 8 args
-
feat(autoware_agnocast_wrapper): adopt glog to agnocast main templete (#1180) feat(autoware_agnocast_wrapper): use glog (#88)
- feat: use glog
- fix: tag name
- feat: link glog
- fix
* fix: add ament auto library ---------
-
fix(autoware_agnocast_wrapper): get_name,namespace,get_fully_qualified_name (#1178) fix get_name,namespace,get_fully_qualified_name
-
feat(autoware_agnocast_wrapper): spawn agnocast_discovery_agent from launch wrapper (#1084) Spawn exactly one agnocast_discovery_agent per ros2 launch tree from agnocast_env.launch.{py,xml} when ENABLE_AGNOCAST=1, deduplicated tree-wide via the LaunchContext globals and pinned to namespace="/".
-
feat(autoware_agnocast_wrapper): add ON_NODE macros (#1170)
-
feat(autoware_agnocast_wrapper): update [agnocast_env.launch]{.title-ref} to enable override [use_agnocast]{.title-ref} (#1123)
- update agnocast_env.launch to override use_agnocast
- style(pre-commit): autofix
* more description in README ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
| Name |
|---|
| libgoogle-glog-dev |
Dependant Packages
Launch files
- launch/agnocast_env.launch.xml
-
- agnocast_heaphook_path [default: /opt/ros/$(env ROS_DISTRO humble)/lib/libagnocast_heaphook.so]
- use_multithread [default: false]
- use_agnocast [default: $(env ENABLE_AGNOCAST 0)]
Messages
Services
Plugins
Recent questions tagged autoware_agnocast_wrapper at Robotics Stack Exchange
Package Summary
| Version | 1.9.0 |
| License | Apache License 2.0 |
| Build type | AMENT_CMAKE |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/autowarefoundation/autoware_core.git |
| VCS Type | git |
| VCS Version | main |
| Last Updated | 2026-09-09 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Takahiro Ishikawa-Aso
- Koichi Imai
- Atsushi Yano
- Yutaro Kobayashi
- Takumi Jin
- Tetsuhiro Kawaguchi
Authors
autoware_agnocast_wrapper
The purpose of this package is to integrate Agnocast, a zero-copy middleware, into each topic in Autoware with minimal side effects. Agnocast is a library designed to work alongside ROS 2, enabling true zero-copy publish/subscribe communication for all ROS 2 message types, including unsized message types.
- Agnocast Repository: https://github.com/autowarefoundation/agnocast
- Agnocast Documentation: https://autowarefoundation.github.io/agnocast_doc/main/
- Discussion on Agnocast Integration into Autoware: https://github.com/orgs/autowarefoundation/discussions/5835
- Review Guide for Agnocast Wrapper PRs
This package provides macros that wrap functions for publish/subscribe operations and smart pointer types for handling ROS 2 messages. When Autoware is built using the default build command, Agnocast is not enabled. However, setting the environment variable ENABLE_AGNOCAST=1 enables Agnocast and results in a build that includes its integration. This design ensures backward compatibility for users who are unaware of Agnocast, minimizing disruption.
Two Integration Approaches
This package provides two approaches for integrating Agnocast. Both will coexist for the foreseeable future.
1. Node Wrapper (agnocast_wrapper::Node)
Use this when you want the entire node to transparently switch between rclcpp::Node and agnocast::Node at runtime. The node wrapper automatically selects the correct underlying implementation based on the ENABLE_AGNOCAST environment variable.
agnocast_wrapper::Node does not publicly derive from rclcpp::Node. It exposes a curated subset
of the rclcpp::Node surface and forwards each member to the underlying implementation (rclcpp::Node
or agnocast::Node). The member names and argument lists are identical in both builds
(ENABLE_AGNOCAST=0 and =1), so a node written against it compiles unchanged either way — provided
you spell the handle, options and message types with the AUTOWARE_* macros (see
Type spellings). If you need an API that is not listed below, extend the wrapper, or
reach the underlying node via get_rclcpp_node() (declared in both builds, but it throws when the node
is in Agnocast mode — see the build-modes table).
Supported API surface
The following members / free functions are provided. Unless noted, signatures mirror their
rclcpp::Node counterparts.
| Category | Members |
|---|---|
| Construction |
Node(name, options), Node(name, namespace, options), virtual destructor, SharedPtr. Non-copyable and non-movable (copying would alias one backend behind two wrappers). Derives from std::enable_shared_from_this<Node>, so shared_from_this() is available when the node is owned by a shared_ptr
|
| Basic info |
get_name(), get_namespace(), get_fully_qualified_name(), get_logger()
|
| Time |
get_clock(), now()
|
| Node interfaces |
get_node_base_interface(), get_node_topics_interface(), get_node_parameters_interface() (partial — only these three) |
| Callback groups | create_callback_group() |
| Parameters |
declare_parameter() (typed + ParameterValue/ParameterType overloads), has_parameter(), undeclare_parameter(), get_parameter() / get_parameters() (typed + prefix overloads), set_parameter() / set_parameters() / set_parameters_atomically(), describe_parameter(s)(), get_parameter_types(), list_parameters(), add_on_set_parameters_callback(), remove_on_set_parameters_callback()
|
| Publisher |
create_publisher<MessageT>() (QoS and depth overloads) — see Publisher API
|
| Subscription |
create_subscription<MessageT>() (QoS and depth overloads, plus a callback-less form read with take()) — see Subscription API
|
| Client |
create_client<ServiceT>() (rclcpp::QoS); async_send_request() takes allocate_output_service_request()’s result, or a plain std::shared_ptr<S::Request> that the Agnocast backend copies |
| Service |
create_service<ServiceT>() (rclcpp::QoS) — message_ptr callback form and an rclcpp-style shared_ptr callback form |
| Timer |
create_wall_timer(); free create_timer(node, clock, period, cb, group) and free set_period(timer, period) (see Timer notes) |
| Underlying node |
get_rclcpp_node(); get_agnocast_node() (agnocast-enabled build only — not declared in an agnocast-disabled build, so calling it there is a compile error); free to_rclcpp_node(node)
|
| Context | free init(), shutdown() and ok() — mode-agnostic replacements for the rclcpp equivalents (see Context notes) |
OnSetParametersCallbackTypeis aliased in this namespace and resolves to the correct rclcpp type for both Humble (rclcpp 16.x) and Jazzy (rclcpp 28+).
Polling subscribers are not a Node member. Use the free function
polling::create_polling_subscriber<MessageT>(node, topic, qos) — see
Polling Subscriber.
Reading another node’s parameters is not a Node member either. Use
autoware::agnocast_wrapper::AsyncParametersClient, which takes a Method 2 node. Of the parameter
service calls it exposes only get_parameters(), alongside wait_for_service() and
service_is_ready(); the setter, descriptor and listing calls are not wrapped yet, and
on_parameter_event() has no Agnocast counterpart. On the Agnocast backend the response arrives
over an Agnocast subscription, so get_parameters() resolves its future only while an Agnocast
executor spins the node.
create_client()andcreate_service()also accept anrmw_qos_profile_t. This is not part of the supported surface: it exists so that Humble-era call sites passingrmw_qos_profile_services_defaultkeep compiling, and it will be removed. Pass anrclcpp::QoS.
Type spellings
The member names and argument lists above are the same in both builds, but the handle, options and
message types they use are not the same C++ types. Always spell them with the AUTOWARE_* macros so the
same source compiles in both builds:
| What | Spell it as | ENABLE_AGNOCAST=0 |
ENABLE_AGNOCAST=1 |
|---|---|---|---|
create_publisher result |
AUTOWARE_PUBLISHER_PTR(M) |
rclcpp::Publisher<M>::SharedPtr |
agnocast_wrapper::Publisher<M>::SharedPtr |
create_subscription result |
AUTOWARE_SUBSCRIPTION_PTR(M) |
rclcpp::Subscription<M>::SharedPtr |
agnocast_wrapper::Subscription<M>::SharedPtr |
create_wall_timer result |
AUTOWARE_TIMER_PTR |
rclcpp::TimerBase::SharedPtr |
agnocast_wrapper::Timer::SharedPtr |
create_publisher options arg |
AUTOWARE_PUBLISHER_OPTIONS |
rclcpp::PublisherOptions |
agnocast::PublisherOptions |
create_subscription options |
AUTOWARE_SUBSCRIPTION_OPTIONS |
rclcpp::SubscriptionOptions |
agnocast::SubscriptionOptions |
| Owning subscription callback arg | AUTOWARE_MESSAGE_CONST_SHARED_PTR(M) |
std::shared_ptr<const M> |
message_ptr<const M, Shared> |
async_send_request request arg |
AUTOWARE_CLIENT_REQUEST_PTR(S) |
std::shared_ptr<S::Request> |
message_ptr<S::Request, Shared> |
A subscription callback may also take the plain MessageT::ConstSharedPtr; it needs no macro because it is spelled the same in both builds.
On the Agnocast path an owning handle must not outlive the subscription that delivered it. This covers AUTOWARE_MESSAGE_CONST_SHARED_PTR, a callback taking MessageT::ConstSharedPtr, the pointer returned by polling::take_data(), and AUTOWARE_CLIENT_RESPONSE_PTR, which the client delivers through a response subscription of its own and which therefore must not outlive the client. Reading it afterwards can return recycled memory, and releasing it can abort the process. Members are destroyed in reverse declaration order, so declare the subscription before any member that caches a message:
AUTOWARE_SUBSCRIPTION_PTR(PointCloud2) sub_; // declared first -> destroyed last
std::shared_ptr<const PointCloud2> latest_; // destroyed first -> safe
AUTOWARE_CLIENT_PTR(SrvT) client_; // same rule for a cached client response
std::shared_ptr<const SrvT::Response> cached_;
The DDS path lets the same pointer be held indefinitely, so a node validated only with ENABLE_AGNOCAST=0 will not show the problem.
AUTOWARE_CLIENT_PTR(S) / AUTOWARE_SERVICE_PTR(S) and the AUTOWARE_CLIENT_*FUTURE* macros resolve to
the wrapper’s own Client<S> / Service<S> types in both builds, so client and service code needs no
File truncated at 100 lines see the full file
Changelog for package autoware_agnocast_wrapper
1.9.0 (2026-06-24)
-
Merge remote-tracking branch 'origin/main' into tmp/bot/bump_version_base
-
refactor(autoware_agnocast_wrapper): split service ptr macros into server/client variants (#1205)
* refactor(autoware_agnocast_wrapper): split service ptr macros into server/client variants
- Apply feedback review
* Remove const from is_shared_ptr_service_callback_v ---------
-
feat(autoware_agnocast_wrapper): add overload for service (#1203)
- add create_service overload
- add assert
* fix copilot review ---------
-
feat(autoware_agnocast_wrapper): add service and client support (#1074)
- Add service and client support to agnocast wrapper
- Mark service and client support as experimental in README
- Add missing macros
- Fix colcon flag typo in README
- fix
- style(pre-commit): autofix
- fix
- style(pre-commit): autofix
- Add a comment
- Adjust create_service/create_client calls depending on rclcpp version
- fix cpplint errors
- style(pre-commit): autofix
- Fix type deduction in create_client and create_service
- Add functional header
- Fix cpplint errors
- Remove experimental tag
- Add RCLCPP version check for client and service macros
* Propagate exception in client async callbacks ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Koichi Imai <<koichi.imai.2@tier4.jp>> Co-authored-by: Koichi Imai <<45482193+Koichi98@users.noreply.github.com>>
-
feat(autoware_agnocast_wrapper): support more args for synchronizer (#1104) support 8 args
-
feat(autoware_agnocast_wrapper): adopt glog to agnocast main templete (#1180) feat(autoware_agnocast_wrapper): use glog (#88)
- feat: use glog
- fix: tag name
- feat: link glog
- fix
* fix: add ament auto library ---------
-
fix(autoware_agnocast_wrapper): get_name,namespace,get_fully_qualified_name (#1178) fix get_name,namespace,get_fully_qualified_name
-
feat(autoware_agnocast_wrapper): spawn agnocast_discovery_agent from launch wrapper (#1084) Spawn exactly one agnocast_discovery_agent per ros2 launch tree from agnocast_env.launch.{py,xml} when ENABLE_AGNOCAST=1, deduplicated tree-wide via the LaunchContext globals and pinned to namespace="/".
-
feat(autoware_agnocast_wrapper): add ON_NODE macros (#1170)
-
feat(autoware_agnocast_wrapper): update [agnocast_env.launch]{.title-ref} to enable override [use_agnocast]{.title-ref} (#1123)
- update agnocast_env.launch to override use_agnocast
- style(pre-commit): autofix
* more description in README ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
| Name |
|---|
| libgoogle-glog-dev |
Dependant Packages
Launch files
- launch/agnocast_env.launch.xml
-
- agnocast_heaphook_path [default: /opt/ros/$(env ROS_DISTRO humble)/lib/libagnocast_heaphook.so]
- use_multithread [default: false]
- use_agnocast [default: $(env ENABLE_AGNOCAST 0)]
Messages
Services
Plugins
Recent questions tagged autoware_agnocast_wrapper at Robotics Stack Exchange
Package Summary
| Version | 1.9.0 |
| License | Apache License 2.0 |
| Build type | AMENT_CMAKE |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/autowarefoundation/autoware_core.git |
| VCS Type | git |
| VCS Version | main |
| Last Updated | 2026-09-09 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Takahiro Ishikawa-Aso
- Koichi Imai
- Atsushi Yano
- Yutaro Kobayashi
- Takumi Jin
- Tetsuhiro Kawaguchi
Authors
autoware_agnocast_wrapper
The purpose of this package is to integrate Agnocast, a zero-copy middleware, into each topic in Autoware with minimal side effects. Agnocast is a library designed to work alongside ROS 2, enabling true zero-copy publish/subscribe communication for all ROS 2 message types, including unsized message types.
- Agnocast Repository: https://github.com/autowarefoundation/agnocast
- Agnocast Documentation: https://autowarefoundation.github.io/agnocast_doc/main/
- Discussion on Agnocast Integration into Autoware: https://github.com/orgs/autowarefoundation/discussions/5835
- Review Guide for Agnocast Wrapper PRs
This package provides macros that wrap functions for publish/subscribe operations and smart pointer types for handling ROS 2 messages. When Autoware is built using the default build command, Agnocast is not enabled. However, setting the environment variable ENABLE_AGNOCAST=1 enables Agnocast and results in a build that includes its integration. This design ensures backward compatibility for users who are unaware of Agnocast, minimizing disruption.
Two Integration Approaches
This package provides two approaches for integrating Agnocast. Both will coexist for the foreseeable future.
1. Node Wrapper (agnocast_wrapper::Node)
Use this when you want the entire node to transparently switch between rclcpp::Node and agnocast::Node at runtime. The node wrapper automatically selects the correct underlying implementation based on the ENABLE_AGNOCAST environment variable.
agnocast_wrapper::Node does not publicly derive from rclcpp::Node. It exposes a curated subset
of the rclcpp::Node surface and forwards each member to the underlying implementation (rclcpp::Node
or agnocast::Node). The member names and argument lists are identical in both builds
(ENABLE_AGNOCAST=0 and =1), so a node written against it compiles unchanged either way — provided
you spell the handle, options and message types with the AUTOWARE_* macros (see
Type spellings). If you need an API that is not listed below, extend the wrapper, or
reach the underlying node via get_rclcpp_node() (declared in both builds, but it throws when the node
is in Agnocast mode — see the build-modes table).
Supported API surface
The following members / free functions are provided. Unless noted, signatures mirror their
rclcpp::Node counterparts.
| Category | Members |
|---|---|
| Construction |
Node(name, options), Node(name, namespace, options), virtual destructor, SharedPtr. Non-copyable and non-movable (copying would alias one backend behind two wrappers). Derives from std::enable_shared_from_this<Node>, so shared_from_this() is available when the node is owned by a shared_ptr
|
| Basic info |
get_name(), get_namespace(), get_fully_qualified_name(), get_logger()
|
| Time |
get_clock(), now()
|
| Node interfaces |
get_node_base_interface(), get_node_topics_interface(), get_node_parameters_interface() (partial — only these three) |
| Callback groups | create_callback_group() |
| Parameters |
declare_parameter() (typed + ParameterValue/ParameterType overloads), has_parameter(), undeclare_parameter(), get_parameter() / get_parameters() (typed + prefix overloads), set_parameter() / set_parameters() / set_parameters_atomically(), describe_parameter(s)(), get_parameter_types(), list_parameters(), add_on_set_parameters_callback(), remove_on_set_parameters_callback()
|
| Publisher |
create_publisher<MessageT>() (QoS and depth overloads) — see Publisher API
|
| Subscription |
create_subscription<MessageT>() (QoS and depth overloads, plus a callback-less form read with take()) — see Subscription API
|
| Client |
create_client<ServiceT>() (rclcpp::QoS); async_send_request() takes allocate_output_service_request()’s result, or a plain std::shared_ptr<S::Request> that the Agnocast backend copies |
| Service |
create_service<ServiceT>() (rclcpp::QoS) — message_ptr callback form and an rclcpp-style shared_ptr callback form |
| Timer |
create_wall_timer(); free create_timer(node, clock, period, cb, group) and free set_period(timer, period) (see Timer notes) |
| Underlying node |
get_rclcpp_node(); get_agnocast_node() (agnocast-enabled build only — not declared in an agnocast-disabled build, so calling it there is a compile error); free to_rclcpp_node(node)
|
| Context | free init(), shutdown() and ok() — mode-agnostic replacements for the rclcpp equivalents (see Context notes) |
OnSetParametersCallbackTypeis aliased in this namespace and resolves to the correct rclcpp type for both Humble (rclcpp 16.x) and Jazzy (rclcpp 28+).
Polling subscribers are not a Node member. Use the free function
polling::create_polling_subscriber<MessageT>(node, topic, qos) — see
Polling Subscriber.
Reading another node’s parameters is not a Node member either. Use
autoware::agnocast_wrapper::AsyncParametersClient, which takes a Method 2 node. Of the parameter
service calls it exposes only get_parameters(), alongside wait_for_service() and
service_is_ready(); the setter, descriptor and listing calls are not wrapped yet, and
on_parameter_event() has no Agnocast counterpart. On the Agnocast backend the response arrives
over an Agnocast subscription, so get_parameters() resolves its future only while an Agnocast
executor spins the node.
create_client()andcreate_service()also accept anrmw_qos_profile_t. This is not part of the supported surface: it exists so that Humble-era call sites passingrmw_qos_profile_services_defaultkeep compiling, and it will be removed. Pass anrclcpp::QoS.
Type spellings
The member names and argument lists above are the same in both builds, but the handle, options and
message types they use are not the same C++ types. Always spell them with the AUTOWARE_* macros so the
same source compiles in both builds:
| What | Spell it as | ENABLE_AGNOCAST=0 |
ENABLE_AGNOCAST=1 |
|---|---|---|---|
create_publisher result |
AUTOWARE_PUBLISHER_PTR(M) |
rclcpp::Publisher<M>::SharedPtr |
agnocast_wrapper::Publisher<M>::SharedPtr |
create_subscription result |
AUTOWARE_SUBSCRIPTION_PTR(M) |
rclcpp::Subscription<M>::SharedPtr |
agnocast_wrapper::Subscription<M>::SharedPtr |
create_wall_timer result |
AUTOWARE_TIMER_PTR |
rclcpp::TimerBase::SharedPtr |
agnocast_wrapper::Timer::SharedPtr |
create_publisher options arg |
AUTOWARE_PUBLISHER_OPTIONS |
rclcpp::PublisherOptions |
agnocast::PublisherOptions |
create_subscription options |
AUTOWARE_SUBSCRIPTION_OPTIONS |
rclcpp::SubscriptionOptions |
agnocast::SubscriptionOptions |
| Owning subscription callback arg | AUTOWARE_MESSAGE_CONST_SHARED_PTR(M) |
std::shared_ptr<const M> |
message_ptr<const M, Shared> |
async_send_request request arg |
AUTOWARE_CLIENT_REQUEST_PTR(S) |
std::shared_ptr<S::Request> |
message_ptr<S::Request, Shared> |
A subscription callback may also take the plain MessageT::ConstSharedPtr; it needs no macro because it is spelled the same in both builds.
On the Agnocast path an owning handle must not outlive the subscription that delivered it. This covers AUTOWARE_MESSAGE_CONST_SHARED_PTR, a callback taking MessageT::ConstSharedPtr, the pointer returned by polling::take_data(), and AUTOWARE_CLIENT_RESPONSE_PTR, which the client delivers through a response subscription of its own and which therefore must not outlive the client. Reading it afterwards can return recycled memory, and releasing it can abort the process. Members are destroyed in reverse declaration order, so declare the subscription before any member that caches a message:
AUTOWARE_SUBSCRIPTION_PTR(PointCloud2) sub_; // declared first -> destroyed last
std::shared_ptr<const PointCloud2> latest_; // destroyed first -> safe
AUTOWARE_CLIENT_PTR(SrvT) client_; // same rule for a cached client response
std::shared_ptr<const SrvT::Response> cached_;
The DDS path lets the same pointer be held indefinitely, so a node validated only with ENABLE_AGNOCAST=0 will not show the problem.
AUTOWARE_CLIENT_PTR(S) / AUTOWARE_SERVICE_PTR(S) and the AUTOWARE_CLIENT_*FUTURE* macros resolve to
the wrapper’s own Client<S> / Service<S> types in both builds, so client and service code needs no
File truncated at 100 lines see the full file
Changelog for package autoware_agnocast_wrapper
1.9.0 (2026-06-24)
-
Merge remote-tracking branch 'origin/main' into tmp/bot/bump_version_base
-
refactor(autoware_agnocast_wrapper): split service ptr macros into server/client variants (#1205)
* refactor(autoware_agnocast_wrapper): split service ptr macros into server/client variants
- Apply feedback review
* Remove const from is_shared_ptr_service_callback_v ---------
-
feat(autoware_agnocast_wrapper): add overload for service (#1203)
- add create_service overload
- add assert
* fix copilot review ---------
-
feat(autoware_agnocast_wrapper): add service and client support (#1074)
- Add service and client support to agnocast wrapper
- Mark service and client support as experimental in README
- Add missing macros
- Fix colcon flag typo in README
- fix
- style(pre-commit): autofix
- fix
- style(pre-commit): autofix
- Add a comment
- Adjust create_service/create_client calls depending on rclcpp version
- fix cpplint errors
- style(pre-commit): autofix
- Fix type deduction in create_client and create_service
- Add functional header
- Fix cpplint errors
- Remove experimental tag
- Add RCLCPP version check for client and service macros
* Propagate exception in client async callbacks ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Koichi Imai <<koichi.imai.2@tier4.jp>> Co-authored-by: Koichi Imai <<45482193+Koichi98@users.noreply.github.com>>
-
feat(autoware_agnocast_wrapper): support more args for synchronizer (#1104) support 8 args
-
feat(autoware_agnocast_wrapper): adopt glog to agnocast main templete (#1180) feat(autoware_agnocast_wrapper): use glog (#88)
- feat: use glog
- fix: tag name
- feat: link glog
- fix
* fix: add ament auto library ---------
-
fix(autoware_agnocast_wrapper): get_name,namespace,get_fully_qualified_name (#1178) fix get_name,namespace,get_fully_qualified_name
-
feat(autoware_agnocast_wrapper): spawn agnocast_discovery_agent from launch wrapper (#1084) Spawn exactly one agnocast_discovery_agent per ros2 launch tree from agnocast_env.launch.{py,xml} when ENABLE_AGNOCAST=1, deduplicated tree-wide via the LaunchContext globals and pinned to namespace="/".
-
feat(autoware_agnocast_wrapper): add ON_NODE macros (#1170)
-
feat(autoware_agnocast_wrapper): update [agnocast_env.launch]{.title-ref} to enable override [use_agnocast]{.title-ref} (#1123)
- update agnocast_env.launch to override use_agnocast
- style(pre-commit): autofix
* more description in README ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
| Name |
|---|
| libgoogle-glog-dev |
Dependant Packages
Launch files
- launch/agnocast_env.launch.xml
-
- agnocast_heaphook_path [default: /opt/ros/$(env ROS_DISTRO humble)/lib/libagnocast_heaphook.so]
- use_multithread [default: false]
- use_agnocast [default: $(env ENABLE_AGNOCAST 0)]
Messages
Services
Plugins
Recent questions tagged autoware_agnocast_wrapper at Robotics Stack Exchange
Package Summary
| Version | 1.9.0 |
| License | Apache License 2.0 |
| Build type | AMENT_CMAKE |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/autowarefoundation/autoware_core.git |
| VCS Type | git |
| VCS Version | main |
| Last Updated | 2026-09-09 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Takahiro Ishikawa-Aso
- Koichi Imai
- Atsushi Yano
- Yutaro Kobayashi
- Takumi Jin
- Tetsuhiro Kawaguchi
Authors
autoware_agnocast_wrapper
The purpose of this package is to integrate Agnocast, a zero-copy middleware, into each topic in Autoware with minimal side effects. Agnocast is a library designed to work alongside ROS 2, enabling true zero-copy publish/subscribe communication for all ROS 2 message types, including unsized message types.
- Agnocast Repository: https://github.com/autowarefoundation/agnocast
- Agnocast Documentation: https://autowarefoundation.github.io/agnocast_doc/main/
- Discussion on Agnocast Integration into Autoware: https://github.com/orgs/autowarefoundation/discussions/5835
- Review Guide for Agnocast Wrapper PRs
This package provides macros that wrap functions for publish/subscribe operations and smart pointer types for handling ROS 2 messages. When Autoware is built using the default build command, Agnocast is not enabled. However, setting the environment variable ENABLE_AGNOCAST=1 enables Agnocast and results in a build that includes its integration. This design ensures backward compatibility for users who are unaware of Agnocast, minimizing disruption.
Two Integration Approaches
This package provides two approaches for integrating Agnocast. Both will coexist for the foreseeable future.
1. Node Wrapper (agnocast_wrapper::Node)
Use this when you want the entire node to transparently switch between rclcpp::Node and agnocast::Node at runtime. The node wrapper automatically selects the correct underlying implementation based on the ENABLE_AGNOCAST environment variable.
agnocast_wrapper::Node does not publicly derive from rclcpp::Node. It exposes a curated subset
of the rclcpp::Node surface and forwards each member to the underlying implementation (rclcpp::Node
or agnocast::Node). The member names and argument lists are identical in both builds
(ENABLE_AGNOCAST=0 and =1), so a node written against it compiles unchanged either way — provided
you spell the handle, options and message types with the AUTOWARE_* macros (see
Type spellings). If you need an API that is not listed below, extend the wrapper, or
reach the underlying node via get_rclcpp_node() (declared in both builds, but it throws when the node
is in Agnocast mode — see the build-modes table).
Supported API surface
The following members / free functions are provided. Unless noted, signatures mirror their
rclcpp::Node counterparts.
| Category | Members |
|---|---|
| Construction |
Node(name, options), Node(name, namespace, options), virtual destructor, SharedPtr. Non-copyable and non-movable (copying would alias one backend behind two wrappers). Derives from std::enable_shared_from_this<Node>, so shared_from_this() is available when the node is owned by a shared_ptr
|
| Basic info |
get_name(), get_namespace(), get_fully_qualified_name(), get_logger()
|
| Time |
get_clock(), now()
|
| Node interfaces |
get_node_base_interface(), get_node_topics_interface(), get_node_parameters_interface() (partial — only these three) |
| Callback groups | create_callback_group() |
| Parameters |
declare_parameter() (typed + ParameterValue/ParameterType overloads), has_parameter(), undeclare_parameter(), get_parameter() / get_parameters() (typed + prefix overloads), set_parameter() / set_parameters() / set_parameters_atomically(), describe_parameter(s)(), get_parameter_types(), list_parameters(), add_on_set_parameters_callback(), remove_on_set_parameters_callback()
|
| Publisher |
create_publisher<MessageT>() (QoS and depth overloads) — see Publisher API
|
| Subscription |
create_subscription<MessageT>() (QoS and depth overloads, plus a callback-less form read with take()) — see Subscription API
|
| Client |
create_client<ServiceT>() (rclcpp::QoS); async_send_request() takes allocate_output_service_request()’s result, or a plain std::shared_ptr<S::Request> that the Agnocast backend copies |
| Service |
create_service<ServiceT>() (rclcpp::QoS) — message_ptr callback form and an rclcpp-style shared_ptr callback form |
| Timer |
create_wall_timer(); free create_timer(node, clock, period, cb, group) and free set_period(timer, period) (see Timer notes) |
| Underlying node |
get_rclcpp_node(); get_agnocast_node() (agnocast-enabled build only — not declared in an agnocast-disabled build, so calling it there is a compile error); free to_rclcpp_node(node)
|
| Context | free init(), shutdown() and ok() — mode-agnostic replacements for the rclcpp equivalents (see Context notes) |
OnSetParametersCallbackTypeis aliased in this namespace and resolves to the correct rclcpp type for both Humble (rclcpp 16.x) and Jazzy (rclcpp 28+).
Polling subscribers are not a Node member. Use the free function
polling::create_polling_subscriber<MessageT>(node, topic, qos) — see
Polling Subscriber.
Reading another node’s parameters is not a Node member either. Use
autoware::agnocast_wrapper::AsyncParametersClient, which takes a Method 2 node. Of the parameter
service calls it exposes only get_parameters(), alongside wait_for_service() and
service_is_ready(); the setter, descriptor and listing calls are not wrapped yet, and
on_parameter_event() has no Agnocast counterpart. On the Agnocast backend the response arrives
over an Agnocast subscription, so get_parameters() resolves its future only while an Agnocast
executor spins the node.
create_client()andcreate_service()also accept anrmw_qos_profile_t. This is not part of the supported surface: it exists so that Humble-era call sites passingrmw_qos_profile_services_defaultkeep compiling, and it will be removed. Pass anrclcpp::QoS.
Type spellings
The member names and argument lists above are the same in both builds, but the handle, options and
message types they use are not the same C++ types. Always spell them with the AUTOWARE_* macros so the
same source compiles in both builds:
| What | Spell it as | ENABLE_AGNOCAST=0 |
ENABLE_AGNOCAST=1 |
|---|---|---|---|
create_publisher result |
AUTOWARE_PUBLISHER_PTR(M) |
rclcpp::Publisher<M>::SharedPtr |
agnocast_wrapper::Publisher<M>::SharedPtr |
create_subscription result |
AUTOWARE_SUBSCRIPTION_PTR(M) |
rclcpp::Subscription<M>::SharedPtr |
agnocast_wrapper::Subscription<M>::SharedPtr |
create_wall_timer result |
AUTOWARE_TIMER_PTR |
rclcpp::TimerBase::SharedPtr |
agnocast_wrapper::Timer::SharedPtr |
create_publisher options arg |
AUTOWARE_PUBLISHER_OPTIONS |
rclcpp::PublisherOptions |
agnocast::PublisherOptions |
create_subscription options |
AUTOWARE_SUBSCRIPTION_OPTIONS |
rclcpp::SubscriptionOptions |
agnocast::SubscriptionOptions |
| Owning subscription callback arg | AUTOWARE_MESSAGE_CONST_SHARED_PTR(M) |
std::shared_ptr<const M> |
message_ptr<const M, Shared> |
async_send_request request arg |
AUTOWARE_CLIENT_REQUEST_PTR(S) |
std::shared_ptr<S::Request> |
message_ptr<S::Request, Shared> |
A subscription callback may also take the plain MessageT::ConstSharedPtr; it needs no macro because it is spelled the same in both builds.
On the Agnocast path an owning handle must not outlive the subscription that delivered it. This covers AUTOWARE_MESSAGE_CONST_SHARED_PTR, a callback taking MessageT::ConstSharedPtr, the pointer returned by polling::take_data(), and AUTOWARE_CLIENT_RESPONSE_PTR, which the client delivers through a response subscription of its own and which therefore must not outlive the client. Reading it afterwards can return recycled memory, and releasing it can abort the process. Members are destroyed in reverse declaration order, so declare the subscription before any member that caches a message:
AUTOWARE_SUBSCRIPTION_PTR(PointCloud2) sub_; // declared first -> destroyed last
std::shared_ptr<const PointCloud2> latest_; // destroyed first -> safe
AUTOWARE_CLIENT_PTR(SrvT) client_; // same rule for a cached client response
std::shared_ptr<const SrvT::Response> cached_;
The DDS path lets the same pointer be held indefinitely, so a node validated only with ENABLE_AGNOCAST=0 will not show the problem.
AUTOWARE_CLIENT_PTR(S) / AUTOWARE_SERVICE_PTR(S) and the AUTOWARE_CLIENT_*FUTURE* macros resolve to
the wrapper’s own Client<S> / Service<S> types in both builds, so client and service code needs no
File truncated at 100 lines see the full file
Changelog for package autoware_agnocast_wrapper
1.9.0 (2026-06-24)
-
Merge remote-tracking branch 'origin/main' into tmp/bot/bump_version_base
-
refactor(autoware_agnocast_wrapper): split service ptr macros into server/client variants (#1205)
* refactor(autoware_agnocast_wrapper): split service ptr macros into server/client variants
- Apply feedback review
* Remove const from is_shared_ptr_service_callback_v ---------
-
feat(autoware_agnocast_wrapper): add overload for service (#1203)
- add create_service overload
- add assert
* fix copilot review ---------
-
feat(autoware_agnocast_wrapper): add service and client support (#1074)
- Add service and client support to agnocast wrapper
- Mark service and client support as experimental in README
- Add missing macros
- Fix colcon flag typo in README
- fix
- style(pre-commit): autofix
- fix
- style(pre-commit): autofix
- Add a comment
- Adjust create_service/create_client calls depending on rclcpp version
- fix cpplint errors
- style(pre-commit): autofix
- Fix type deduction in create_client and create_service
- Add functional header
- Fix cpplint errors
- Remove experimental tag
- Add RCLCPP version check for client and service macros
* Propagate exception in client async callbacks ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Koichi Imai <<koichi.imai.2@tier4.jp>> Co-authored-by: Koichi Imai <<45482193+Koichi98@users.noreply.github.com>>
-
feat(autoware_agnocast_wrapper): support more args for synchronizer (#1104) support 8 args
-
feat(autoware_agnocast_wrapper): adopt glog to agnocast main templete (#1180) feat(autoware_agnocast_wrapper): use glog (#88)
- feat: use glog
- fix: tag name
- feat: link glog
- fix
* fix: add ament auto library ---------
-
fix(autoware_agnocast_wrapper): get_name,namespace,get_fully_qualified_name (#1178) fix get_name,namespace,get_fully_qualified_name
-
feat(autoware_agnocast_wrapper): spawn agnocast_discovery_agent from launch wrapper (#1084) Spawn exactly one agnocast_discovery_agent per ros2 launch tree from agnocast_env.launch.{py,xml} when ENABLE_AGNOCAST=1, deduplicated tree-wide via the LaunchContext globals and pinned to namespace="/".
-
feat(autoware_agnocast_wrapper): add ON_NODE macros (#1170)
-
feat(autoware_agnocast_wrapper): update [agnocast_env.launch]{.title-ref} to enable override [use_agnocast]{.title-ref} (#1123)
- update agnocast_env.launch to override use_agnocast
- style(pre-commit): autofix
* more description in README ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
| Name |
|---|
| libgoogle-glog-dev |
Dependant Packages
Launch files
- launch/agnocast_env.launch.xml
-
- agnocast_heaphook_path [default: /opt/ros/$(env ROS_DISTRO humble)/lib/libagnocast_heaphook.so]
- use_multithread [default: false]
- use_agnocast [default: $(env ENABLE_AGNOCAST 0)]
Messages
Services
Plugins
Recent questions tagged autoware_agnocast_wrapper at Robotics Stack Exchange
Package Summary
| Version | 1.9.0 |
| License | Apache License 2.0 |
| Build type | AMENT_CMAKE |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/autowarefoundation/autoware_core.git |
| VCS Type | git |
| VCS Version | main |
| Last Updated | 2026-09-09 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Takahiro Ishikawa-Aso
- Koichi Imai
- Atsushi Yano
- Yutaro Kobayashi
- Takumi Jin
- Tetsuhiro Kawaguchi
Authors
autoware_agnocast_wrapper
The purpose of this package is to integrate Agnocast, a zero-copy middleware, into each topic in Autoware with minimal side effects. Agnocast is a library designed to work alongside ROS 2, enabling true zero-copy publish/subscribe communication for all ROS 2 message types, including unsized message types.
- Agnocast Repository: https://github.com/autowarefoundation/agnocast
- Agnocast Documentation: https://autowarefoundation.github.io/agnocast_doc/main/
- Discussion on Agnocast Integration into Autoware: https://github.com/orgs/autowarefoundation/discussions/5835
- Review Guide for Agnocast Wrapper PRs
This package provides macros that wrap functions for publish/subscribe operations and smart pointer types for handling ROS 2 messages. When Autoware is built using the default build command, Agnocast is not enabled. However, setting the environment variable ENABLE_AGNOCAST=1 enables Agnocast and results in a build that includes its integration. This design ensures backward compatibility for users who are unaware of Agnocast, minimizing disruption.
Two Integration Approaches
This package provides two approaches for integrating Agnocast. Both will coexist for the foreseeable future.
1. Node Wrapper (agnocast_wrapper::Node)
Use this when you want the entire node to transparently switch between rclcpp::Node and agnocast::Node at runtime. The node wrapper automatically selects the correct underlying implementation based on the ENABLE_AGNOCAST environment variable.
agnocast_wrapper::Node does not publicly derive from rclcpp::Node. It exposes a curated subset
of the rclcpp::Node surface and forwards each member to the underlying implementation (rclcpp::Node
or agnocast::Node). The member names and argument lists are identical in both builds
(ENABLE_AGNOCAST=0 and =1), so a node written against it compiles unchanged either way — provided
you spell the handle, options and message types with the AUTOWARE_* macros (see
Type spellings). If you need an API that is not listed below, extend the wrapper, or
reach the underlying node via get_rclcpp_node() (declared in both builds, but it throws when the node
is in Agnocast mode — see the build-modes table).
Supported API surface
The following members / free functions are provided. Unless noted, signatures mirror their
rclcpp::Node counterparts.
| Category | Members |
|---|---|
| Construction |
Node(name, options), Node(name, namespace, options), virtual destructor, SharedPtr. Non-copyable and non-movable (copying would alias one backend behind two wrappers). Derives from std::enable_shared_from_this<Node>, so shared_from_this() is available when the node is owned by a shared_ptr
|
| Basic info |
get_name(), get_namespace(), get_fully_qualified_name(), get_logger()
|
| Time |
get_clock(), now()
|
| Node interfaces |
get_node_base_interface(), get_node_topics_interface(), get_node_parameters_interface() (partial — only these three) |
| Callback groups | create_callback_group() |
| Parameters |
declare_parameter() (typed + ParameterValue/ParameterType overloads), has_parameter(), undeclare_parameter(), get_parameter() / get_parameters() (typed + prefix overloads), set_parameter() / set_parameters() / set_parameters_atomically(), describe_parameter(s)(), get_parameter_types(), list_parameters(), add_on_set_parameters_callback(), remove_on_set_parameters_callback()
|
| Publisher |
create_publisher<MessageT>() (QoS and depth overloads) — see Publisher API
|
| Subscription |
create_subscription<MessageT>() (QoS and depth overloads, plus a callback-less form read with take()) — see Subscription API
|
| Client |
create_client<ServiceT>() (rclcpp::QoS); async_send_request() takes allocate_output_service_request()’s result, or a plain std::shared_ptr<S::Request> that the Agnocast backend copies |
| Service |
create_service<ServiceT>() (rclcpp::QoS) — message_ptr callback form and an rclcpp-style shared_ptr callback form |
| Timer |
create_wall_timer(); free create_timer(node, clock, period, cb, group) and free set_period(timer, period) (see Timer notes) |
| Underlying node |
get_rclcpp_node(); get_agnocast_node() (agnocast-enabled build only — not declared in an agnocast-disabled build, so calling it there is a compile error); free to_rclcpp_node(node)
|
| Context | free init(), shutdown() and ok() — mode-agnostic replacements for the rclcpp equivalents (see Context notes) |
OnSetParametersCallbackTypeis aliased in this namespace and resolves to the correct rclcpp type for both Humble (rclcpp 16.x) and Jazzy (rclcpp 28+).
Polling subscribers are not a Node member. Use the free function
polling::create_polling_subscriber<MessageT>(node, topic, qos) — see
Polling Subscriber.
Reading another node’s parameters is not a Node member either. Use
autoware::agnocast_wrapper::AsyncParametersClient, which takes a Method 2 node. Of the parameter
service calls it exposes only get_parameters(), alongside wait_for_service() and
service_is_ready(); the setter, descriptor and listing calls are not wrapped yet, and
on_parameter_event() has no Agnocast counterpart. On the Agnocast backend the response arrives
over an Agnocast subscription, so get_parameters() resolves its future only while an Agnocast
executor spins the node.
create_client()andcreate_service()also accept anrmw_qos_profile_t. This is not part of the supported surface: it exists so that Humble-era call sites passingrmw_qos_profile_services_defaultkeep compiling, and it will be removed. Pass anrclcpp::QoS.
Type spellings
The member names and argument lists above are the same in both builds, but the handle, options and
message types they use are not the same C++ types. Always spell them with the AUTOWARE_* macros so the
same source compiles in both builds:
| What | Spell it as | ENABLE_AGNOCAST=0 |
ENABLE_AGNOCAST=1 |
|---|---|---|---|
create_publisher result |
AUTOWARE_PUBLISHER_PTR(M) |
rclcpp::Publisher<M>::SharedPtr |
agnocast_wrapper::Publisher<M>::SharedPtr |
create_subscription result |
AUTOWARE_SUBSCRIPTION_PTR(M) |
rclcpp::Subscription<M>::SharedPtr |
agnocast_wrapper::Subscription<M>::SharedPtr |
create_wall_timer result |
AUTOWARE_TIMER_PTR |
rclcpp::TimerBase::SharedPtr |
agnocast_wrapper::Timer::SharedPtr |
create_publisher options arg |
AUTOWARE_PUBLISHER_OPTIONS |
rclcpp::PublisherOptions |
agnocast::PublisherOptions |
create_subscription options |
AUTOWARE_SUBSCRIPTION_OPTIONS |
rclcpp::SubscriptionOptions |
agnocast::SubscriptionOptions |
| Owning subscription callback arg | AUTOWARE_MESSAGE_CONST_SHARED_PTR(M) |
std::shared_ptr<const M> |
message_ptr<const M, Shared> |
async_send_request request arg |
AUTOWARE_CLIENT_REQUEST_PTR(S) |
std::shared_ptr<S::Request> |
message_ptr<S::Request, Shared> |
A subscription callback may also take the plain MessageT::ConstSharedPtr; it needs no macro because it is spelled the same in both builds.
On the Agnocast path an owning handle must not outlive the subscription that delivered it. This covers AUTOWARE_MESSAGE_CONST_SHARED_PTR, a callback taking MessageT::ConstSharedPtr, the pointer returned by polling::take_data(), and AUTOWARE_CLIENT_RESPONSE_PTR, which the client delivers through a response subscription of its own and which therefore must not outlive the client. Reading it afterwards can return recycled memory, and releasing it can abort the process. Members are destroyed in reverse declaration order, so declare the subscription before any member that caches a message:
AUTOWARE_SUBSCRIPTION_PTR(PointCloud2) sub_; // declared first -> destroyed last
std::shared_ptr<const PointCloud2> latest_; // destroyed first -> safe
AUTOWARE_CLIENT_PTR(SrvT) client_; // same rule for a cached client response
std::shared_ptr<const SrvT::Response> cached_;
The DDS path lets the same pointer be held indefinitely, so a node validated only with ENABLE_AGNOCAST=0 will not show the problem.
AUTOWARE_CLIENT_PTR(S) / AUTOWARE_SERVICE_PTR(S) and the AUTOWARE_CLIENT_*FUTURE* macros resolve to
the wrapper’s own Client<S> / Service<S> types in both builds, so client and service code needs no
File truncated at 100 lines see the full file
Changelog for package autoware_agnocast_wrapper
1.9.0 (2026-06-24)
-
Merge remote-tracking branch 'origin/main' into tmp/bot/bump_version_base
-
refactor(autoware_agnocast_wrapper): split service ptr macros into server/client variants (#1205)
* refactor(autoware_agnocast_wrapper): split service ptr macros into server/client variants
- Apply feedback review
* Remove const from is_shared_ptr_service_callback_v ---------
-
feat(autoware_agnocast_wrapper): add overload for service (#1203)
- add create_service overload
- add assert
* fix copilot review ---------
-
feat(autoware_agnocast_wrapper): add service and client support (#1074)
- Add service and client support to agnocast wrapper
- Mark service and client support as experimental in README
- Add missing macros
- Fix colcon flag typo in README
- fix
- style(pre-commit): autofix
- fix
- style(pre-commit): autofix
- Add a comment
- Adjust create_service/create_client calls depending on rclcpp version
- fix cpplint errors
- style(pre-commit): autofix
- Fix type deduction in create_client and create_service
- Add functional header
- Fix cpplint errors
- Remove experimental tag
- Add RCLCPP version check for client and service macros
* Propagate exception in client async callbacks ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Koichi Imai <<koichi.imai.2@tier4.jp>> Co-authored-by: Koichi Imai <<45482193+Koichi98@users.noreply.github.com>>
-
feat(autoware_agnocast_wrapper): support more args for synchronizer (#1104) support 8 args
-
feat(autoware_agnocast_wrapper): adopt glog to agnocast main templete (#1180) feat(autoware_agnocast_wrapper): use glog (#88)
- feat: use glog
- fix: tag name
- feat: link glog
- fix
* fix: add ament auto library ---------
-
fix(autoware_agnocast_wrapper): get_name,namespace,get_fully_qualified_name (#1178) fix get_name,namespace,get_fully_qualified_name
-
feat(autoware_agnocast_wrapper): spawn agnocast_discovery_agent from launch wrapper (#1084) Spawn exactly one agnocast_discovery_agent per ros2 launch tree from agnocast_env.launch.{py,xml} when ENABLE_AGNOCAST=1, deduplicated tree-wide via the LaunchContext globals and pinned to namespace="/".
-
feat(autoware_agnocast_wrapper): add ON_NODE macros (#1170)
-
feat(autoware_agnocast_wrapper): update [agnocast_env.launch]{.title-ref} to enable override [use_agnocast]{.title-ref} (#1123)
- update agnocast_env.launch to override use_agnocast
- style(pre-commit): autofix
* more description in README ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
| Name |
|---|
| libgoogle-glog-dev |
Dependant Packages
Launch files
- launch/agnocast_env.launch.xml
-
- agnocast_heaphook_path [default: /opt/ros/$(env ROS_DISTRO humble)/lib/libagnocast_heaphook.so]
- use_multithread [default: false]
- use_agnocast [default: $(env ENABLE_AGNOCAST 0)]
Messages
Services
Plugins
Recent questions tagged autoware_agnocast_wrapper at Robotics Stack Exchange
Package Summary
| Version | 1.9.0 |
| License | Apache License 2.0 |
| Build type | AMENT_CMAKE |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/autowarefoundation/autoware_core.git |
| VCS Type | git |
| VCS Version | main |
| Last Updated | 2026-09-09 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Takahiro Ishikawa-Aso
- Koichi Imai
- Atsushi Yano
- Yutaro Kobayashi
- Takumi Jin
- Tetsuhiro Kawaguchi
Authors
autoware_agnocast_wrapper
The purpose of this package is to integrate Agnocast, a zero-copy middleware, into each topic in Autoware with minimal side effects. Agnocast is a library designed to work alongside ROS 2, enabling true zero-copy publish/subscribe communication for all ROS 2 message types, including unsized message types.
- Agnocast Repository: https://github.com/autowarefoundation/agnocast
- Agnocast Documentation: https://autowarefoundation.github.io/agnocast_doc/main/
- Discussion on Agnocast Integration into Autoware: https://github.com/orgs/autowarefoundation/discussions/5835
- Review Guide for Agnocast Wrapper PRs
This package provides macros that wrap functions for publish/subscribe operations and smart pointer types for handling ROS 2 messages. When Autoware is built using the default build command, Agnocast is not enabled. However, setting the environment variable ENABLE_AGNOCAST=1 enables Agnocast and results in a build that includes its integration. This design ensures backward compatibility for users who are unaware of Agnocast, minimizing disruption.
Two Integration Approaches
This package provides two approaches for integrating Agnocast. Both will coexist for the foreseeable future.
1. Node Wrapper (agnocast_wrapper::Node)
Use this when you want the entire node to transparently switch between rclcpp::Node and agnocast::Node at runtime. The node wrapper automatically selects the correct underlying implementation based on the ENABLE_AGNOCAST environment variable.
agnocast_wrapper::Node does not publicly derive from rclcpp::Node. It exposes a curated subset
of the rclcpp::Node surface and forwards each member to the underlying implementation (rclcpp::Node
or agnocast::Node). The member names and argument lists are identical in both builds
(ENABLE_AGNOCAST=0 and =1), so a node written against it compiles unchanged either way — provided
you spell the handle, options and message types with the AUTOWARE_* macros (see
Type spellings). If you need an API that is not listed below, extend the wrapper, or
reach the underlying node via get_rclcpp_node() (declared in both builds, but it throws when the node
is in Agnocast mode — see the build-modes table).
Supported API surface
The following members / free functions are provided. Unless noted, signatures mirror their
rclcpp::Node counterparts.
| Category | Members |
|---|---|
| Construction |
Node(name, options), Node(name, namespace, options), virtual destructor, SharedPtr. Non-copyable and non-movable (copying would alias one backend behind two wrappers). Derives from std::enable_shared_from_this<Node>, so shared_from_this() is available when the node is owned by a shared_ptr
|
| Basic info |
get_name(), get_namespace(), get_fully_qualified_name(), get_logger()
|
| Time |
get_clock(), now()
|
| Node interfaces |
get_node_base_interface(), get_node_topics_interface(), get_node_parameters_interface() (partial — only these three) |
| Callback groups | create_callback_group() |
| Parameters |
declare_parameter() (typed + ParameterValue/ParameterType overloads), has_parameter(), undeclare_parameter(), get_parameter() / get_parameters() (typed + prefix overloads), set_parameter() / set_parameters() / set_parameters_atomically(), describe_parameter(s)(), get_parameter_types(), list_parameters(), add_on_set_parameters_callback(), remove_on_set_parameters_callback()
|
| Publisher |
create_publisher<MessageT>() (QoS and depth overloads) — see Publisher API
|
| Subscription |
create_subscription<MessageT>() (QoS and depth overloads, plus a callback-less form read with take()) — see Subscription API
|
| Client |
create_client<ServiceT>() (rclcpp::QoS); async_send_request() takes allocate_output_service_request()’s result, or a plain std::shared_ptr<S::Request> that the Agnocast backend copies |
| Service |
create_service<ServiceT>() (rclcpp::QoS) — message_ptr callback form and an rclcpp-style shared_ptr callback form |
| Timer |
create_wall_timer(); free create_timer(node, clock, period, cb, group) and free set_period(timer, period) (see Timer notes) |
| Underlying node |
get_rclcpp_node(); get_agnocast_node() (agnocast-enabled build only — not declared in an agnocast-disabled build, so calling it there is a compile error); free to_rclcpp_node(node)
|
| Context | free init(), shutdown() and ok() — mode-agnostic replacements for the rclcpp equivalents (see Context notes) |
OnSetParametersCallbackTypeis aliased in this namespace and resolves to the correct rclcpp type for both Humble (rclcpp 16.x) and Jazzy (rclcpp 28+).
Polling subscribers are not a Node member. Use the free function
polling::create_polling_subscriber<MessageT>(node, topic, qos) — see
Polling Subscriber.
Reading another node’s parameters is not a Node member either. Use
autoware::agnocast_wrapper::AsyncParametersClient, which takes a Method 2 node. Of the parameter
service calls it exposes only get_parameters(), alongside wait_for_service() and
service_is_ready(); the setter, descriptor and listing calls are not wrapped yet, and
on_parameter_event() has no Agnocast counterpart. On the Agnocast backend the response arrives
over an Agnocast subscription, so get_parameters() resolves its future only while an Agnocast
executor spins the node.
create_client()andcreate_service()also accept anrmw_qos_profile_t. This is not part of the supported surface: it exists so that Humble-era call sites passingrmw_qos_profile_services_defaultkeep compiling, and it will be removed. Pass anrclcpp::QoS.
Type spellings
The member names and argument lists above are the same in both builds, but the handle, options and
message types they use are not the same C++ types. Always spell them with the AUTOWARE_* macros so the
same source compiles in both builds:
| What | Spell it as | ENABLE_AGNOCAST=0 |
ENABLE_AGNOCAST=1 |
|---|---|---|---|
create_publisher result |
AUTOWARE_PUBLISHER_PTR(M) |
rclcpp::Publisher<M>::SharedPtr |
agnocast_wrapper::Publisher<M>::SharedPtr |
create_subscription result |
AUTOWARE_SUBSCRIPTION_PTR(M) |
rclcpp::Subscription<M>::SharedPtr |
agnocast_wrapper::Subscription<M>::SharedPtr |
create_wall_timer result |
AUTOWARE_TIMER_PTR |
rclcpp::TimerBase::SharedPtr |
agnocast_wrapper::Timer::SharedPtr |
create_publisher options arg |
AUTOWARE_PUBLISHER_OPTIONS |
rclcpp::PublisherOptions |
agnocast::PublisherOptions |
create_subscription options |
AUTOWARE_SUBSCRIPTION_OPTIONS |
rclcpp::SubscriptionOptions |
agnocast::SubscriptionOptions |
| Owning subscription callback arg | AUTOWARE_MESSAGE_CONST_SHARED_PTR(M) |
std::shared_ptr<const M> |
message_ptr<const M, Shared> |
async_send_request request arg |
AUTOWARE_CLIENT_REQUEST_PTR(S) |
std::shared_ptr<S::Request> |
message_ptr<S::Request, Shared> |
A subscription callback may also take the plain MessageT::ConstSharedPtr; it needs no macro because it is spelled the same in both builds.
On the Agnocast path an owning handle must not outlive the subscription that delivered it. This covers AUTOWARE_MESSAGE_CONST_SHARED_PTR, a callback taking MessageT::ConstSharedPtr, the pointer returned by polling::take_data(), and AUTOWARE_CLIENT_RESPONSE_PTR, which the client delivers through a response subscription of its own and which therefore must not outlive the client. Reading it afterwards can return recycled memory, and releasing it can abort the process. Members are destroyed in reverse declaration order, so declare the subscription before any member that caches a message:
AUTOWARE_SUBSCRIPTION_PTR(PointCloud2) sub_; // declared first -> destroyed last
std::shared_ptr<const PointCloud2> latest_; // destroyed first -> safe
AUTOWARE_CLIENT_PTR(SrvT) client_; // same rule for a cached client response
std::shared_ptr<const SrvT::Response> cached_;
The DDS path lets the same pointer be held indefinitely, so a node validated only with ENABLE_AGNOCAST=0 will not show the problem.
AUTOWARE_CLIENT_PTR(S) / AUTOWARE_SERVICE_PTR(S) and the AUTOWARE_CLIENT_*FUTURE* macros resolve to
the wrapper’s own Client<S> / Service<S> types in both builds, so client and service code needs no
File truncated at 100 lines see the full file
Changelog for package autoware_agnocast_wrapper
1.9.0 (2026-06-24)
-
Merge remote-tracking branch 'origin/main' into tmp/bot/bump_version_base
-
refactor(autoware_agnocast_wrapper): split service ptr macros into server/client variants (#1205)
* refactor(autoware_agnocast_wrapper): split service ptr macros into server/client variants
- Apply feedback review
* Remove const from is_shared_ptr_service_callback_v ---------
-
feat(autoware_agnocast_wrapper): add overload for service (#1203)
- add create_service overload
- add assert
* fix copilot review ---------
-
feat(autoware_agnocast_wrapper): add service and client support (#1074)
- Add service and client support to agnocast wrapper
- Mark service and client support as experimental in README
- Add missing macros
- Fix colcon flag typo in README
- fix
- style(pre-commit): autofix
- fix
- style(pre-commit): autofix
- Add a comment
- Adjust create_service/create_client calls depending on rclcpp version
- fix cpplint errors
- style(pre-commit): autofix
- Fix type deduction in create_client and create_service
- Add functional header
- Fix cpplint errors
- Remove experimental tag
- Add RCLCPP version check for client and service macros
* Propagate exception in client async callbacks ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Koichi Imai <<koichi.imai.2@tier4.jp>> Co-authored-by: Koichi Imai <<45482193+Koichi98@users.noreply.github.com>>
-
feat(autoware_agnocast_wrapper): support more args for synchronizer (#1104) support 8 args
-
feat(autoware_agnocast_wrapper): adopt glog to agnocast main templete (#1180) feat(autoware_agnocast_wrapper): use glog (#88)
- feat: use glog
- fix: tag name
- feat: link glog
- fix
* fix: add ament auto library ---------
-
fix(autoware_agnocast_wrapper): get_name,namespace,get_fully_qualified_name (#1178) fix get_name,namespace,get_fully_qualified_name
-
feat(autoware_agnocast_wrapper): spawn agnocast_discovery_agent from launch wrapper (#1084) Spawn exactly one agnocast_discovery_agent per ros2 launch tree from agnocast_env.launch.{py,xml} when ENABLE_AGNOCAST=1, deduplicated tree-wide via the LaunchContext globals and pinned to namespace="/".
-
feat(autoware_agnocast_wrapper): add ON_NODE macros (#1170)
-
feat(autoware_agnocast_wrapper): update [agnocast_env.launch]{.title-ref} to enable override [use_agnocast]{.title-ref} (#1123)
- update agnocast_env.launch to override use_agnocast
- style(pre-commit): autofix
* more description in README ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
| Name |
|---|
| libgoogle-glog-dev |
Dependant Packages
Launch files
- launch/agnocast_env.launch.xml
-
- agnocast_heaphook_path [default: /opt/ros/$(env ROS_DISTRO humble)/lib/libagnocast_heaphook.so]
- use_multithread [default: false]
- use_agnocast [default: $(env ENABLE_AGNOCAST 0)]
Messages
Services
Plugins
Recent questions tagged autoware_agnocast_wrapper at Robotics Stack Exchange
Package Summary
| Version | 1.9.0 |
| License | Apache License 2.0 |
| Build type | AMENT_CMAKE |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/autowarefoundation/autoware_core.git |
| VCS Type | git |
| VCS Version | main |
| Last Updated | 2026-09-09 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Takahiro Ishikawa-Aso
- Koichi Imai
- Atsushi Yano
- Yutaro Kobayashi
- Takumi Jin
- Tetsuhiro Kawaguchi
Authors
autoware_agnocast_wrapper
The purpose of this package is to integrate Agnocast, a zero-copy middleware, into each topic in Autoware with minimal side effects. Agnocast is a library designed to work alongside ROS 2, enabling true zero-copy publish/subscribe communication for all ROS 2 message types, including unsized message types.
- Agnocast Repository: https://github.com/autowarefoundation/agnocast
- Agnocast Documentation: https://autowarefoundation.github.io/agnocast_doc/main/
- Discussion on Agnocast Integration into Autoware: https://github.com/orgs/autowarefoundation/discussions/5835
- Review Guide for Agnocast Wrapper PRs
This package provides macros that wrap functions for publish/subscribe operations and smart pointer types for handling ROS 2 messages. When Autoware is built using the default build command, Agnocast is not enabled. However, setting the environment variable ENABLE_AGNOCAST=1 enables Agnocast and results in a build that includes its integration. This design ensures backward compatibility for users who are unaware of Agnocast, minimizing disruption.
Two Integration Approaches
This package provides two approaches for integrating Agnocast. Both will coexist for the foreseeable future.
1. Node Wrapper (agnocast_wrapper::Node)
Use this when you want the entire node to transparently switch between rclcpp::Node and agnocast::Node at runtime. The node wrapper automatically selects the correct underlying implementation based on the ENABLE_AGNOCAST environment variable.
agnocast_wrapper::Node does not publicly derive from rclcpp::Node. It exposes a curated subset
of the rclcpp::Node surface and forwards each member to the underlying implementation (rclcpp::Node
or agnocast::Node). The member names and argument lists are identical in both builds
(ENABLE_AGNOCAST=0 and =1), so a node written against it compiles unchanged either way — provided
you spell the handle, options and message types with the AUTOWARE_* macros (see
Type spellings). If you need an API that is not listed below, extend the wrapper, or
reach the underlying node via get_rclcpp_node() (declared in both builds, but it throws when the node
is in Agnocast mode — see the build-modes table).
Supported API surface
The following members / free functions are provided. Unless noted, signatures mirror their
rclcpp::Node counterparts.
| Category | Members |
|---|---|
| Construction |
Node(name, options), Node(name, namespace, options), virtual destructor, SharedPtr. Non-copyable and non-movable (copying would alias one backend behind two wrappers). Derives from std::enable_shared_from_this<Node>, so shared_from_this() is available when the node is owned by a shared_ptr
|
| Basic info |
get_name(), get_namespace(), get_fully_qualified_name(), get_logger()
|
| Time |
get_clock(), now()
|
| Node interfaces |
get_node_base_interface(), get_node_topics_interface(), get_node_parameters_interface() (partial — only these three) |
| Callback groups | create_callback_group() |
| Parameters |
declare_parameter() (typed + ParameterValue/ParameterType overloads), has_parameter(), undeclare_parameter(), get_parameter() / get_parameters() (typed + prefix overloads), set_parameter() / set_parameters() / set_parameters_atomically(), describe_parameter(s)(), get_parameter_types(), list_parameters(), add_on_set_parameters_callback(), remove_on_set_parameters_callback()
|
| Publisher |
create_publisher<MessageT>() (QoS and depth overloads) — see Publisher API
|
| Subscription |
create_subscription<MessageT>() (QoS and depth overloads, plus a callback-less form read with take()) — see Subscription API
|
| Client |
create_client<ServiceT>() (rclcpp::QoS); async_send_request() takes allocate_output_service_request()’s result, or a plain std::shared_ptr<S::Request> that the Agnocast backend copies |
| Service |
create_service<ServiceT>() (rclcpp::QoS) — message_ptr callback form and an rclcpp-style shared_ptr callback form |
| Timer |
create_wall_timer(); free create_timer(node, clock, period, cb, group) and free set_period(timer, period) (see Timer notes) |
| Underlying node |
get_rclcpp_node(); get_agnocast_node() (agnocast-enabled build only — not declared in an agnocast-disabled build, so calling it there is a compile error); free to_rclcpp_node(node)
|
| Context | free init(), shutdown() and ok() — mode-agnostic replacements for the rclcpp equivalents (see Context notes) |
OnSetParametersCallbackTypeis aliased in this namespace and resolves to the correct rclcpp type for both Humble (rclcpp 16.x) and Jazzy (rclcpp 28+).
Polling subscribers are not a Node member. Use the free function
polling::create_polling_subscriber<MessageT>(node, topic, qos) — see
Polling Subscriber.
Reading another node’s parameters is not a Node member either. Use
autoware::agnocast_wrapper::AsyncParametersClient, which takes a Method 2 node. Of the parameter
service calls it exposes only get_parameters(), alongside wait_for_service() and
service_is_ready(); the setter, descriptor and listing calls are not wrapped yet, and
on_parameter_event() has no Agnocast counterpart. On the Agnocast backend the response arrives
over an Agnocast subscription, so get_parameters() resolves its future only while an Agnocast
executor spins the node.
create_client()andcreate_service()also accept anrmw_qos_profile_t. This is not part of the supported surface: it exists so that Humble-era call sites passingrmw_qos_profile_services_defaultkeep compiling, and it will be removed. Pass anrclcpp::QoS.
Type spellings
The member names and argument lists above are the same in both builds, but the handle, options and
message types they use are not the same C++ types. Always spell them with the AUTOWARE_* macros so the
same source compiles in both builds:
| What | Spell it as | ENABLE_AGNOCAST=0 |
ENABLE_AGNOCAST=1 |
|---|---|---|---|
create_publisher result |
AUTOWARE_PUBLISHER_PTR(M) |
rclcpp::Publisher<M>::SharedPtr |
agnocast_wrapper::Publisher<M>::SharedPtr |
create_subscription result |
AUTOWARE_SUBSCRIPTION_PTR(M) |
rclcpp::Subscription<M>::SharedPtr |
agnocast_wrapper::Subscription<M>::SharedPtr |
create_wall_timer result |
AUTOWARE_TIMER_PTR |
rclcpp::TimerBase::SharedPtr |
agnocast_wrapper::Timer::SharedPtr |
create_publisher options arg |
AUTOWARE_PUBLISHER_OPTIONS |
rclcpp::PublisherOptions |
agnocast::PublisherOptions |
create_subscription options |
AUTOWARE_SUBSCRIPTION_OPTIONS |
rclcpp::SubscriptionOptions |
agnocast::SubscriptionOptions |
| Owning subscription callback arg | AUTOWARE_MESSAGE_CONST_SHARED_PTR(M) |
std::shared_ptr<const M> |
message_ptr<const M, Shared> |
async_send_request request arg |
AUTOWARE_CLIENT_REQUEST_PTR(S) |
std::shared_ptr<S::Request> |
message_ptr<S::Request, Shared> |
A subscription callback may also take the plain MessageT::ConstSharedPtr; it needs no macro because it is spelled the same in both builds.
On the Agnocast path an owning handle must not outlive the subscription that delivered it. This covers AUTOWARE_MESSAGE_CONST_SHARED_PTR, a callback taking MessageT::ConstSharedPtr, the pointer returned by polling::take_data(), and AUTOWARE_CLIENT_RESPONSE_PTR, which the client delivers through a response subscription of its own and which therefore must not outlive the client. Reading it afterwards can return recycled memory, and releasing it can abort the process. Members are destroyed in reverse declaration order, so declare the subscription before any member that caches a message:
AUTOWARE_SUBSCRIPTION_PTR(PointCloud2) sub_; // declared first -> destroyed last
std::shared_ptr<const PointCloud2> latest_; // destroyed first -> safe
AUTOWARE_CLIENT_PTR(SrvT) client_; // same rule for a cached client response
std::shared_ptr<const SrvT::Response> cached_;
The DDS path lets the same pointer be held indefinitely, so a node validated only with ENABLE_AGNOCAST=0 will not show the problem.
AUTOWARE_CLIENT_PTR(S) / AUTOWARE_SERVICE_PTR(S) and the AUTOWARE_CLIENT_*FUTURE* macros resolve to
the wrapper’s own Client<S> / Service<S> types in both builds, so client and service code needs no
File truncated at 100 lines see the full file
Changelog for package autoware_agnocast_wrapper
1.9.0 (2026-06-24)
-
Merge remote-tracking branch 'origin/main' into tmp/bot/bump_version_base
-
refactor(autoware_agnocast_wrapper): split service ptr macros into server/client variants (#1205)
* refactor(autoware_agnocast_wrapper): split service ptr macros into server/client variants
- Apply feedback review
* Remove const from is_shared_ptr_service_callback_v ---------
-
feat(autoware_agnocast_wrapper): add overload for service (#1203)
- add create_service overload
- add assert
* fix copilot review ---------
-
feat(autoware_agnocast_wrapper): add service and client support (#1074)
- Add service and client support to agnocast wrapper
- Mark service and client support as experimental in README
- Add missing macros
- Fix colcon flag typo in README
- fix
- style(pre-commit): autofix
- fix
- style(pre-commit): autofix
- Add a comment
- Adjust create_service/create_client calls depending on rclcpp version
- fix cpplint errors
- style(pre-commit): autofix
- Fix type deduction in create_client and create_service
- Add functional header
- Fix cpplint errors
- Remove experimental tag
- Add RCLCPP version check for client and service macros
* Propagate exception in client async callbacks ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Koichi Imai <<koichi.imai.2@tier4.jp>> Co-authored-by: Koichi Imai <<45482193+Koichi98@users.noreply.github.com>>
-
feat(autoware_agnocast_wrapper): support more args for synchronizer (#1104) support 8 args
-
feat(autoware_agnocast_wrapper): adopt glog to agnocast main templete (#1180) feat(autoware_agnocast_wrapper): use glog (#88)
- feat: use glog
- fix: tag name
- feat: link glog
- fix
* fix: add ament auto library ---------
-
fix(autoware_agnocast_wrapper): get_name,namespace,get_fully_qualified_name (#1178) fix get_name,namespace,get_fully_qualified_name
-
feat(autoware_agnocast_wrapper): spawn agnocast_discovery_agent from launch wrapper (#1084) Spawn exactly one agnocast_discovery_agent per ros2 launch tree from agnocast_env.launch.{py,xml} when ENABLE_AGNOCAST=1, deduplicated tree-wide via the LaunchContext globals and pinned to namespace="/".
-
feat(autoware_agnocast_wrapper): add ON_NODE macros (#1170)
-
feat(autoware_agnocast_wrapper): update [agnocast_env.launch]{.title-ref} to enable override [use_agnocast]{.title-ref} (#1123)
- update agnocast_env.launch to override use_agnocast
- style(pre-commit): autofix
* more description in README ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
| Name |
|---|
| libgoogle-glog-dev |
Dependant Packages
Launch files
- launch/agnocast_env.launch.xml
-
- agnocast_heaphook_path [default: /opt/ros/$(env ROS_DISTRO humble)/lib/libagnocast_heaphook.so]
- use_multithread [default: false]
- use_agnocast [default: $(env ENABLE_AGNOCAST 0)]
Messages
Services
Plugins
Recent questions tagged autoware_agnocast_wrapper at Robotics Stack Exchange
Package Summary
| Version | 1.9.0 |
| License | Apache License 2.0 |
| Build type | AMENT_CMAKE |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/autowarefoundation/autoware_core.git |
| VCS Type | git |
| VCS Version | main |
| Last Updated | 2026-09-09 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Takahiro Ishikawa-Aso
- Koichi Imai
- Atsushi Yano
- Yutaro Kobayashi
- Takumi Jin
- Tetsuhiro Kawaguchi
Authors
autoware_agnocast_wrapper
The purpose of this package is to integrate Agnocast, a zero-copy middleware, into each topic in Autoware with minimal side effects. Agnocast is a library designed to work alongside ROS 2, enabling true zero-copy publish/subscribe communication for all ROS 2 message types, including unsized message types.
- Agnocast Repository: https://github.com/autowarefoundation/agnocast
- Agnocast Documentation: https://autowarefoundation.github.io/agnocast_doc/main/
- Discussion on Agnocast Integration into Autoware: https://github.com/orgs/autowarefoundation/discussions/5835
- Review Guide for Agnocast Wrapper PRs
This package provides macros that wrap functions for publish/subscribe operations and smart pointer types for handling ROS 2 messages. When Autoware is built using the default build command, Agnocast is not enabled. However, setting the environment variable ENABLE_AGNOCAST=1 enables Agnocast and results in a build that includes its integration. This design ensures backward compatibility for users who are unaware of Agnocast, minimizing disruption.
Two Integration Approaches
This package provides two approaches for integrating Agnocast. Both will coexist for the foreseeable future.
1. Node Wrapper (agnocast_wrapper::Node)
Use this when you want the entire node to transparently switch between rclcpp::Node and agnocast::Node at runtime. The node wrapper automatically selects the correct underlying implementation based on the ENABLE_AGNOCAST environment variable.
agnocast_wrapper::Node does not publicly derive from rclcpp::Node. It exposes a curated subset
of the rclcpp::Node surface and forwards each member to the underlying implementation (rclcpp::Node
or agnocast::Node). The member names and argument lists are identical in both builds
(ENABLE_AGNOCAST=0 and =1), so a node written against it compiles unchanged either way — provided
you spell the handle, options and message types with the AUTOWARE_* macros (see
Type spellings). If you need an API that is not listed below, extend the wrapper, or
reach the underlying node via get_rclcpp_node() (declared in both builds, but it throws when the node
is in Agnocast mode — see the build-modes table).
Supported API surface
The following members / free functions are provided. Unless noted, signatures mirror their
rclcpp::Node counterparts.
| Category | Members |
|---|---|
| Construction |
Node(name, options), Node(name, namespace, options), virtual destructor, SharedPtr. Non-copyable and non-movable (copying would alias one backend behind two wrappers). Derives from std::enable_shared_from_this<Node>, so shared_from_this() is available when the node is owned by a shared_ptr
|
| Basic info |
get_name(), get_namespace(), get_fully_qualified_name(), get_logger()
|
| Time |
get_clock(), now()
|
| Node interfaces |
get_node_base_interface(), get_node_topics_interface(), get_node_parameters_interface() (partial — only these three) |
| Callback groups | create_callback_group() |
| Parameters |
declare_parameter() (typed + ParameterValue/ParameterType overloads), has_parameter(), undeclare_parameter(), get_parameter() / get_parameters() (typed + prefix overloads), set_parameter() / set_parameters() / set_parameters_atomically(), describe_parameter(s)(), get_parameter_types(), list_parameters(), add_on_set_parameters_callback(), remove_on_set_parameters_callback()
|
| Publisher |
create_publisher<MessageT>() (QoS and depth overloads) — see Publisher API
|
| Subscription |
create_subscription<MessageT>() (QoS and depth overloads, plus a callback-less form read with take()) — see Subscription API
|
| Client |
create_client<ServiceT>() (rclcpp::QoS); async_send_request() takes allocate_output_service_request()’s result, or a plain std::shared_ptr<S::Request> that the Agnocast backend copies |
| Service |
create_service<ServiceT>() (rclcpp::QoS) — message_ptr callback form and an rclcpp-style shared_ptr callback form |
| Timer |
create_wall_timer(); free create_timer(node, clock, period, cb, group) and free set_period(timer, period) (see Timer notes) |
| Underlying node |
get_rclcpp_node(); get_agnocast_node() (agnocast-enabled build only — not declared in an agnocast-disabled build, so calling it there is a compile error); free to_rclcpp_node(node)
|
| Context | free init(), shutdown() and ok() — mode-agnostic replacements for the rclcpp equivalents (see Context notes) |
OnSetParametersCallbackTypeis aliased in this namespace and resolves to the correct rclcpp type for both Humble (rclcpp 16.x) and Jazzy (rclcpp 28+).
Polling subscribers are not a Node member. Use the free function
polling::create_polling_subscriber<MessageT>(node, topic, qos) — see
Polling Subscriber.
Reading another node’s parameters is not a Node member either. Use
autoware::agnocast_wrapper::AsyncParametersClient, which takes a Method 2 node. Of the parameter
service calls it exposes only get_parameters(), alongside wait_for_service() and
service_is_ready(); the setter, descriptor and listing calls are not wrapped yet, and
on_parameter_event() has no Agnocast counterpart. On the Agnocast backend the response arrives
over an Agnocast subscription, so get_parameters() resolves its future only while an Agnocast
executor spins the node.
create_client()andcreate_service()also accept anrmw_qos_profile_t. This is not part of the supported surface: it exists so that Humble-era call sites passingrmw_qos_profile_services_defaultkeep compiling, and it will be removed. Pass anrclcpp::QoS.
Type spellings
The member names and argument lists above are the same in both builds, but the handle, options and
message types they use are not the same C++ types. Always spell them with the AUTOWARE_* macros so the
same source compiles in both builds:
| What | Spell it as | ENABLE_AGNOCAST=0 |
ENABLE_AGNOCAST=1 |
|---|---|---|---|
create_publisher result |
AUTOWARE_PUBLISHER_PTR(M) |
rclcpp::Publisher<M>::SharedPtr |
agnocast_wrapper::Publisher<M>::SharedPtr |
create_subscription result |
AUTOWARE_SUBSCRIPTION_PTR(M) |
rclcpp::Subscription<M>::SharedPtr |
agnocast_wrapper::Subscription<M>::SharedPtr |
create_wall_timer result |
AUTOWARE_TIMER_PTR |
rclcpp::TimerBase::SharedPtr |
agnocast_wrapper::Timer::SharedPtr |
create_publisher options arg |
AUTOWARE_PUBLISHER_OPTIONS |
rclcpp::PublisherOptions |
agnocast::PublisherOptions |
create_subscription options |
AUTOWARE_SUBSCRIPTION_OPTIONS |
rclcpp::SubscriptionOptions |
agnocast::SubscriptionOptions |
| Owning subscription callback arg | AUTOWARE_MESSAGE_CONST_SHARED_PTR(M) |
std::shared_ptr<const M> |
message_ptr<const M, Shared> |
async_send_request request arg |
AUTOWARE_CLIENT_REQUEST_PTR(S) |
std::shared_ptr<S::Request> |
message_ptr<S::Request, Shared> |
A subscription callback may also take the plain MessageT::ConstSharedPtr; it needs no macro because it is spelled the same in both builds.
On the Agnocast path an owning handle must not outlive the subscription that delivered it. This covers AUTOWARE_MESSAGE_CONST_SHARED_PTR, a callback taking MessageT::ConstSharedPtr, the pointer returned by polling::take_data(), and AUTOWARE_CLIENT_RESPONSE_PTR, which the client delivers through a response subscription of its own and which therefore must not outlive the client. Reading it afterwards can return recycled memory, and releasing it can abort the process. Members are destroyed in reverse declaration order, so declare the subscription before any member that caches a message:
AUTOWARE_SUBSCRIPTION_PTR(PointCloud2) sub_; // declared first -> destroyed last
std::shared_ptr<const PointCloud2> latest_; // destroyed first -> safe
AUTOWARE_CLIENT_PTR(SrvT) client_; // same rule for a cached client response
std::shared_ptr<const SrvT::Response> cached_;
The DDS path lets the same pointer be held indefinitely, so a node validated only with ENABLE_AGNOCAST=0 will not show the problem.
AUTOWARE_CLIENT_PTR(S) / AUTOWARE_SERVICE_PTR(S) and the AUTOWARE_CLIENT_*FUTURE* macros resolve to
the wrapper’s own Client<S> / Service<S> types in both builds, so client and service code needs no
File truncated at 100 lines see the full file
Changelog for package autoware_agnocast_wrapper
1.9.0 (2026-06-24)
-
Merge remote-tracking branch 'origin/main' into tmp/bot/bump_version_base
-
refactor(autoware_agnocast_wrapper): split service ptr macros into server/client variants (#1205)
* refactor(autoware_agnocast_wrapper): split service ptr macros into server/client variants
- Apply feedback review
* Remove const from is_shared_ptr_service_callback_v ---------
-
feat(autoware_agnocast_wrapper): add overload for service (#1203)
- add create_service overload
- add assert
* fix copilot review ---------
-
feat(autoware_agnocast_wrapper): add service and client support (#1074)
- Add service and client support to agnocast wrapper
- Mark service and client support as experimental in README
- Add missing macros
- Fix colcon flag typo in README
- fix
- style(pre-commit): autofix
- fix
- style(pre-commit): autofix
- Add a comment
- Adjust create_service/create_client calls depending on rclcpp version
- fix cpplint errors
- style(pre-commit): autofix
- Fix type deduction in create_client and create_service
- Add functional header
- Fix cpplint errors
- Remove experimental tag
- Add RCLCPP version check for client and service macros
* Propagate exception in client async callbacks ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Koichi Imai <<koichi.imai.2@tier4.jp>> Co-authored-by: Koichi Imai <<45482193+Koichi98@users.noreply.github.com>>
-
feat(autoware_agnocast_wrapper): support more args for synchronizer (#1104) support 8 args
-
feat(autoware_agnocast_wrapper): adopt glog to agnocast main templete (#1180) feat(autoware_agnocast_wrapper): use glog (#88)
- feat: use glog
- fix: tag name
- feat: link glog
- fix
* fix: add ament auto library ---------
-
fix(autoware_agnocast_wrapper): get_name,namespace,get_fully_qualified_name (#1178) fix get_name,namespace,get_fully_qualified_name
-
feat(autoware_agnocast_wrapper): spawn agnocast_discovery_agent from launch wrapper (#1084) Spawn exactly one agnocast_discovery_agent per ros2 launch tree from agnocast_env.launch.{py,xml} when ENABLE_AGNOCAST=1, deduplicated tree-wide via the LaunchContext globals and pinned to namespace="/".
-
feat(autoware_agnocast_wrapper): add ON_NODE macros (#1170)
-
feat(autoware_agnocast_wrapper): update [agnocast_env.launch]{.title-ref} to enable override [use_agnocast]{.title-ref} (#1123)
- update agnocast_env.launch to override use_agnocast
- style(pre-commit): autofix
* more description in README ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
| Name |
|---|
| libgoogle-glog-dev |
Dependant Packages
Launch files
- launch/agnocast_env.launch.xml
-
- agnocast_heaphook_path [default: /opt/ros/$(env ROS_DISTRO humble)/lib/libagnocast_heaphook.so]
- use_multithread [default: false]
- use_agnocast [default: $(env ENABLE_AGNOCAST 0)]
Messages
Services
Plugins
Recent questions tagged autoware_agnocast_wrapper at Robotics Stack Exchange
Package Summary
| Version | 1.9.0 |
| License | Apache License 2.0 |
| Build type | AMENT_CMAKE |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/autowarefoundation/autoware_core.git |
| VCS Type | git |
| VCS Version | main |
| Last Updated | 2026-09-09 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Takahiro Ishikawa-Aso
- Koichi Imai
- Atsushi Yano
- Yutaro Kobayashi
- Takumi Jin
- Tetsuhiro Kawaguchi
Authors
autoware_agnocast_wrapper
The purpose of this package is to integrate Agnocast, a zero-copy middleware, into each topic in Autoware with minimal side effects. Agnocast is a library designed to work alongside ROS 2, enabling true zero-copy publish/subscribe communication for all ROS 2 message types, including unsized message types.
- Agnocast Repository: https://github.com/autowarefoundation/agnocast
- Agnocast Documentation: https://autowarefoundation.github.io/agnocast_doc/main/
- Discussion on Agnocast Integration into Autoware: https://github.com/orgs/autowarefoundation/discussions/5835
- Review Guide for Agnocast Wrapper PRs
This package provides macros that wrap functions for publish/subscribe operations and smart pointer types for handling ROS 2 messages. When Autoware is built using the default build command, Agnocast is not enabled. However, setting the environment variable ENABLE_AGNOCAST=1 enables Agnocast and results in a build that includes its integration. This design ensures backward compatibility for users who are unaware of Agnocast, minimizing disruption.
Two Integration Approaches
This package provides two approaches for integrating Agnocast. Both will coexist for the foreseeable future.
1. Node Wrapper (agnocast_wrapper::Node)
Use this when you want the entire node to transparently switch between rclcpp::Node and agnocast::Node at runtime. The node wrapper automatically selects the correct underlying implementation based on the ENABLE_AGNOCAST environment variable.
agnocast_wrapper::Node does not publicly derive from rclcpp::Node. It exposes a curated subset
of the rclcpp::Node surface and forwards each member to the underlying implementation (rclcpp::Node
or agnocast::Node). The member names and argument lists are identical in both builds
(ENABLE_AGNOCAST=0 and =1), so a node written against it compiles unchanged either way — provided
you spell the handle, options and message types with the AUTOWARE_* macros (see
Type spellings). If you need an API that is not listed below, extend the wrapper, or
reach the underlying node via get_rclcpp_node() (declared in both builds, but it throws when the node
is in Agnocast mode — see the build-modes table).
Supported API surface
The following members / free functions are provided. Unless noted, signatures mirror their
rclcpp::Node counterparts.
| Category | Members |
|---|---|
| Construction |
Node(name, options), Node(name, namespace, options), virtual destructor, SharedPtr. Non-copyable and non-movable (copying would alias one backend behind two wrappers). Derives from std::enable_shared_from_this<Node>, so shared_from_this() is available when the node is owned by a shared_ptr
|
| Basic info |
get_name(), get_namespace(), get_fully_qualified_name(), get_logger()
|
| Time |
get_clock(), now()
|
| Node interfaces |
get_node_base_interface(), get_node_topics_interface(), get_node_parameters_interface() (partial — only these three) |
| Callback groups | create_callback_group() |
| Parameters |
declare_parameter() (typed + ParameterValue/ParameterType overloads), has_parameter(), undeclare_parameter(), get_parameter() / get_parameters() (typed + prefix overloads), set_parameter() / set_parameters() / set_parameters_atomically(), describe_parameter(s)(), get_parameter_types(), list_parameters(), add_on_set_parameters_callback(), remove_on_set_parameters_callback()
|
| Publisher |
create_publisher<MessageT>() (QoS and depth overloads) — see Publisher API
|
| Subscription |
create_subscription<MessageT>() (QoS and depth overloads, plus a callback-less form read with take()) — see Subscription API
|
| Client |
create_client<ServiceT>() (rclcpp::QoS); async_send_request() takes allocate_output_service_request()’s result, or a plain std::shared_ptr<S::Request> that the Agnocast backend copies |
| Service |
create_service<ServiceT>() (rclcpp::QoS) — message_ptr callback form and an rclcpp-style shared_ptr callback form |
| Timer |
create_wall_timer(); free create_timer(node, clock, period, cb, group) and free set_period(timer, period) (see Timer notes) |
| Underlying node |
get_rclcpp_node(); get_agnocast_node() (agnocast-enabled build only — not declared in an agnocast-disabled build, so calling it there is a compile error); free to_rclcpp_node(node)
|
| Context | free init(), shutdown() and ok() — mode-agnostic replacements for the rclcpp equivalents (see Context notes) |
OnSetParametersCallbackTypeis aliased in this namespace and resolves to the correct rclcpp type for both Humble (rclcpp 16.x) and Jazzy (rclcpp 28+).
Polling subscribers are not a Node member. Use the free function
polling::create_polling_subscriber<MessageT>(node, topic, qos) — see
Polling Subscriber.
Reading another node’s parameters is not a Node member either. Use
autoware::agnocast_wrapper::AsyncParametersClient, which takes a Method 2 node. Of the parameter
service calls it exposes only get_parameters(), alongside wait_for_service() and
service_is_ready(); the setter, descriptor and listing calls are not wrapped yet, and
on_parameter_event() has no Agnocast counterpart. On the Agnocast backend the response arrives
over an Agnocast subscription, so get_parameters() resolves its future only while an Agnocast
executor spins the node.
create_client()andcreate_service()also accept anrmw_qos_profile_t. This is not part of the supported surface: it exists so that Humble-era call sites passingrmw_qos_profile_services_defaultkeep compiling, and it will be removed. Pass anrclcpp::QoS.
Type spellings
The member names and argument lists above are the same in both builds, but the handle, options and
message types they use are not the same C++ types. Always spell them with the AUTOWARE_* macros so the
same source compiles in both builds:
| What | Spell it as | ENABLE_AGNOCAST=0 |
ENABLE_AGNOCAST=1 |
|---|---|---|---|
create_publisher result |
AUTOWARE_PUBLISHER_PTR(M) |
rclcpp::Publisher<M>::SharedPtr |
agnocast_wrapper::Publisher<M>::SharedPtr |
create_subscription result |
AUTOWARE_SUBSCRIPTION_PTR(M) |
rclcpp::Subscription<M>::SharedPtr |
agnocast_wrapper::Subscription<M>::SharedPtr |
create_wall_timer result |
AUTOWARE_TIMER_PTR |
rclcpp::TimerBase::SharedPtr |
agnocast_wrapper::Timer::SharedPtr |
create_publisher options arg |
AUTOWARE_PUBLISHER_OPTIONS |
rclcpp::PublisherOptions |
agnocast::PublisherOptions |
create_subscription options |
AUTOWARE_SUBSCRIPTION_OPTIONS |
rclcpp::SubscriptionOptions |
agnocast::SubscriptionOptions |
| Owning subscription callback arg | AUTOWARE_MESSAGE_CONST_SHARED_PTR(M) |
std::shared_ptr<const M> |
message_ptr<const M, Shared> |
async_send_request request arg |
AUTOWARE_CLIENT_REQUEST_PTR(S) |
std::shared_ptr<S::Request> |
message_ptr<S::Request, Shared> |
A subscription callback may also take the plain MessageT::ConstSharedPtr; it needs no macro because it is spelled the same in both builds.
On the Agnocast path an owning handle must not outlive the subscription that delivered it. This covers AUTOWARE_MESSAGE_CONST_SHARED_PTR, a callback taking MessageT::ConstSharedPtr, the pointer returned by polling::take_data(), and AUTOWARE_CLIENT_RESPONSE_PTR, which the client delivers through a response subscription of its own and which therefore must not outlive the client. Reading it afterwards can return recycled memory, and releasing it can abort the process. Members are destroyed in reverse declaration order, so declare the subscription before any member that caches a message:
AUTOWARE_SUBSCRIPTION_PTR(PointCloud2) sub_; // declared first -> destroyed last
std::shared_ptr<const PointCloud2> latest_; // destroyed first -> safe
AUTOWARE_CLIENT_PTR(SrvT) client_; // same rule for a cached client response
std::shared_ptr<const SrvT::Response> cached_;
The DDS path lets the same pointer be held indefinitely, so a node validated only with ENABLE_AGNOCAST=0 will not show the problem.
AUTOWARE_CLIENT_PTR(S) / AUTOWARE_SERVICE_PTR(S) and the AUTOWARE_CLIENT_*FUTURE* macros resolve to
the wrapper’s own Client<S> / Service<S> types in both builds, so client and service code needs no
File truncated at 100 lines see the full file
Changelog for package autoware_agnocast_wrapper
1.9.0 (2026-06-24)
-
Merge remote-tracking branch 'origin/main' into tmp/bot/bump_version_base
-
refactor(autoware_agnocast_wrapper): split service ptr macros into server/client variants (#1205)
* refactor(autoware_agnocast_wrapper): split service ptr macros into server/client variants
- Apply feedback review
* Remove const from is_shared_ptr_service_callback_v ---------
-
feat(autoware_agnocast_wrapper): add overload for service (#1203)
- add create_service overload
- add assert
* fix copilot review ---------
-
feat(autoware_agnocast_wrapper): add service and client support (#1074)
- Add service and client support to agnocast wrapper
- Mark service and client support as experimental in README
- Add missing macros
- Fix colcon flag typo in README
- fix
- style(pre-commit): autofix
- fix
- style(pre-commit): autofix
- Add a comment
- Adjust create_service/create_client calls depending on rclcpp version
- fix cpplint errors
- style(pre-commit): autofix
- Fix type deduction in create_client and create_service
- Add functional header
- Fix cpplint errors
- Remove experimental tag
- Add RCLCPP version check for client and service macros
* Propagate exception in client async callbacks ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Koichi Imai <<koichi.imai.2@tier4.jp>> Co-authored-by: Koichi Imai <<45482193+Koichi98@users.noreply.github.com>>
-
feat(autoware_agnocast_wrapper): support more args for synchronizer (#1104) support 8 args
-
feat(autoware_agnocast_wrapper): adopt glog to agnocast main templete (#1180) feat(autoware_agnocast_wrapper): use glog (#88)
- feat: use glog
- fix: tag name
- feat: link glog
- fix
* fix: add ament auto library ---------
-
fix(autoware_agnocast_wrapper): get_name,namespace,get_fully_qualified_name (#1178) fix get_name,namespace,get_fully_qualified_name
-
feat(autoware_agnocast_wrapper): spawn agnocast_discovery_agent from launch wrapper (#1084) Spawn exactly one agnocast_discovery_agent per ros2 launch tree from agnocast_env.launch.{py,xml} when ENABLE_AGNOCAST=1, deduplicated tree-wide via the LaunchContext globals and pinned to namespace="/".
-
feat(autoware_agnocast_wrapper): add ON_NODE macros (#1170)
-
feat(autoware_agnocast_wrapper): update [agnocast_env.launch]{.title-ref} to enable override [use_agnocast]{.title-ref} (#1123)
- update agnocast_env.launch to override use_agnocast
- style(pre-commit): autofix
* more description in README ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
| Name |
|---|
| libgoogle-glog-dev |
Dependant Packages
Launch files
- launch/agnocast_env.launch.xml
-
- agnocast_heaphook_path [default: /opt/ros/$(env ROS_DISTRO humble)/lib/libagnocast_heaphook.so]
- use_multithread [default: false]
- use_agnocast [default: $(env ENABLE_AGNOCAST 0)]
Messages
Services
Plugins
Recent questions tagged autoware_agnocast_wrapper at Robotics Stack Exchange
Package Summary
| Version | 1.9.0 |
| License | Apache License 2.0 |
| Build type | AMENT_CMAKE |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/autowarefoundation/autoware_core.git |
| VCS Type | git |
| VCS Version | main |
| Last Updated | 2026-09-09 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Takahiro Ishikawa-Aso
- Koichi Imai
- Atsushi Yano
- Yutaro Kobayashi
- Takumi Jin
- Tetsuhiro Kawaguchi
Authors
autoware_agnocast_wrapper
The purpose of this package is to integrate Agnocast, a zero-copy middleware, into each topic in Autoware with minimal side effects. Agnocast is a library designed to work alongside ROS 2, enabling true zero-copy publish/subscribe communication for all ROS 2 message types, including unsized message types.
- Agnocast Repository: https://github.com/autowarefoundation/agnocast
- Agnocast Documentation: https://autowarefoundation.github.io/agnocast_doc/main/
- Discussion on Agnocast Integration into Autoware: https://github.com/orgs/autowarefoundation/discussions/5835
- Review Guide for Agnocast Wrapper PRs
This package provides macros that wrap functions for publish/subscribe operations and smart pointer types for handling ROS 2 messages. When Autoware is built using the default build command, Agnocast is not enabled. However, setting the environment variable ENABLE_AGNOCAST=1 enables Agnocast and results in a build that includes its integration. This design ensures backward compatibility for users who are unaware of Agnocast, minimizing disruption.
Two Integration Approaches
This package provides two approaches for integrating Agnocast. Both will coexist for the foreseeable future.
1. Node Wrapper (agnocast_wrapper::Node)
Use this when you want the entire node to transparently switch between rclcpp::Node and agnocast::Node at runtime. The node wrapper automatically selects the correct underlying implementation based on the ENABLE_AGNOCAST environment variable.
agnocast_wrapper::Node does not publicly derive from rclcpp::Node. It exposes a curated subset
of the rclcpp::Node surface and forwards each member to the underlying implementation (rclcpp::Node
or agnocast::Node). The member names and argument lists are identical in both builds
(ENABLE_AGNOCAST=0 and =1), so a node written against it compiles unchanged either way — provided
you spell the handle, options and message types with the AUTOWARE_* macros (see
Type spellings). If you need an API that is not listed below, extend the wrapper, or
reach the underlying node via get_rclcpp_node() (declared in both builds, but it throws when the node
is in Agnocast mode — see the build-modes table).
Supported API surface
The following members / free functions are provided. Unless noted, signatures mirror their
rclcpp::Node counterparts.
| Category | Members |
|---|---|
| Construction |
Node(name, options), Node(name, namespace, options), virtual destructor, SharedPtr. Non-copyable and non-movable (copying would alias one backend behind two wrappers). Derives from std::enable_shared_from_this<Node>, so shared_from_this() is available when the node is owned by a shared_ptr
|
| Basic info |
get_name(), get_namespace(), get_fully_qualified_name(), get_logger()
|
| Time |
get_clock(), now()
|
| Node interfaces |
get_node_base_interface(), get_node_topics_interface(), get_node_parameters_interface() (partial — only these three) |
| Callback groups | create_callback_group() |
| Parameters |
declare_parameter() (typed + ParameterValue/ParameterType overloads), has_parameter(), undeclare_parameter(), get_parameter() / get_parameters() (typed + prefix overloads), set_parameter() / set_parameters() / set_parameters_atomically(), describe_parameter(s)(), get_parameter_types(), list_parameters(), add_on_set_parameters_callback(), remove_on_set_parameters_callback()
|
| Publisher |
create_publisher<MessageT>() (QoS and depth overloads) — see Publisher API
|
| Subscription |
create_subscription<MessageT>() (QoS and depth overloads, plus a callback-less form read with take()) — see Subscription API
|
| Client |
create_client<ServiceT>() (rclcpp::QoS); async_send_request() takes allocate_output_service_request()’s result, or a plain std::shared_ptr<S::Request> that the Agnocast backend copies |
| Service |
create_service<ServiceT>() (rclcpp::QoS) — message_ptr callback form and an rclcpp-style shared_ptr callback form |
| Timer |
create_wall_timer(); free create_timer(node, clock, period, cb, group) and free set_period(timer, period) (see Timer notes) |
| Underlying node |
get_rclcpp_node(); get_agnocast_node() (agnocast-enabled build only — not declared in an agnocast-disabled build, so calling it there is a compile error); free to_rclcpp_node(node)
|
| Context | free init(), shutdown() and ok() — mode-agnostic replacements for the rclcpp equivalents (see Context notes) |
OnSetParametersCallbackTypeis aliased in this namespace and resolves to the correct rclcpp type for both Humble (rclcpp 16.x) and Jazzy (rclcpp 28+).
Polling subscribers are not a Node member. Use the free function
polling::create_polling_subscriber<MessageT>(node, topic, qos) — see
Polling Subscriber.
Reading another node’s parameters is not a Node member either. Use
autoware::agnocast_wrapper::AsyncParametersClient, which takes a Method 2 node. Of the parameter
service calls it exposes only get_parameters(), alongside wait_for_service() and
service_is_ready(); the setter, descriptor and listing calls are not wrapped yet, and
on_parameter_event() has no Agnocast counterpart. On the Agnocast backend the response arrives
over an Agnocast subscription, so get_parameters() resolves its future only while an Agnocast
executor spins the node.
create_client()andcreate_service()also accept anrmw_qos_profile_t. This is not part of the supported surface: it exists so that Humble-era call sites passingrmw_qos_profile_services_defaultkeep compiling, and it will be removed. Pass anrclcpp::QoS.
Type spellings
The member names and argument lists above are the same in both builds, but the handle, options and
message types they use are not the same C++ types. Always spell them with the AUTOWARE_* macros so the
same source compiles in both builds:
| What | Spell it as | ENABLE_AGNOCAST=0 |
ENABLE_AGNOCAST=1 |
|---|---|---|---|
create_publisher result |
AUTOWARE_PUBLISHER_PTR(M) |
rclcpp::Publisher<M>::SharedPtr |
agnocast_wrapper::Publisher<M>::SharedPtr |
create_subscription result |
AUTOWARE_SUBSCRIPTION_PTR(M) |
rclcpp::Subscription<M>::SharedPtr |
agnocast_wrapper::Subscription<M>::SharedPtr |
create_wall_timer result |
AUTOWARE_TIMER_PTR |
rclcpp::TimerBase::SharedPtr |
agnocast_wrapper::Timer::SharedPtr |
create_publisher options arg |
AUTOWARE_PUBLISHER_OPTIONS |
rclcpp::PublisherOptions |
agnocast::PublisherOptions |
create_subscription options |
AUTOWARE_SUBSCRIPTION_OPTIONS |
rclcpp::SubscriptionOptions |
agnocast::SubscriptionOptions |
| Owning subscription callback arg | AUTOWARE_MESSAGE_CONST_SHARED_PTR(M) |
std::shared_ptr<const M> |
message_ptr<const M, Shared> |
async_send_request request arg |
AUTOWARE_CLIENT_REQUEST_PTR(S) |
std::shared_ptr<S::Request> |
message_ptr<S::Request, Shared> |
A subscription callback may also take the plain MessageT::ConstSharedPtr; it needs no macro because it is spelled the same in both builds.
On the Agnocast path an owning handle must not outlive the subscription that delivered it. This covers AUTOWARE_MESSAGE_CONST_SHARED_PTR, a callback taking MessageT::ConstSharedPtr, the pointer returned by polling::take_data(), and AUTOWARE_CLIENT_RESPONSE_PTR, which the client delivers through a response subscription of its own and which therefore must not outlive the client. Reading it afterwards can return recycled memory, and releasing it can abort the process. Members are destroyed in reverse declaration order, so declare the subscription before any member that caches a message:
AUTOWARE_SUBSCRIPTION_PTR(PointCloud2) sub_; // declared first -> destroyed last
std::shared_ptr<const PointCloud2> latest_; // destroyed first -> safe
AUTOWARE_CLIENT_PTR(SrvT) client_; // same rule for a cached client response
std::shared_ptr<const SrvT::Response> cached_;
The DDS path lets the same pointer be held indefinitely, so a node validated only with ENABLE_AGNOCAST=0 will not show the problem.
AUTOWARE_CLIENT_PTR(S) / AUTOWARE_SERVICE_PTR(S) and the AUTOWARE_CLIENT_*FUTURE* macros resolve to
the wrapper’s own Client<S> / Service<S> types in both builds, so client and service code needs no
File truncated at 100 lines see the full file
Changelog for package autoware_agnocast_wrapper
1.9.0 (2026-06-24)
-
Merge remote-tracking branch 'origin/main' into tmp/bot/bump_version_base
-
refactor(autoware_agnocast_wrapper): split service ptr macros into server/client variants (#1205)
* refactor(autoware_agnocast_wrapper): split service ptr macros into server/client variants
- Apply feedback review
* Remove const from is_shared_ptr_service_callback_v ---------
-
feat(autoware_agnocast_wrapper): add overload for service (#1203)
- add create_service overload
- add assert
* fix copilot review ---------
-
feat(autoware_agnocast_wrapper): add service and client support (#1074)
- Add service and client support to agnocast wrapper
- Mark service and client support as experimental in README
- Add missing macros
- Fix colcon flag typo in README
- fix
- style(pre-commit): autofix
- fix
- style(pre-commit): autofix
- Add a comment
- Adjust create_service/create_client calls depending on rclcpp version
- fix cpplint errors
- style(pre-commit): autofix
- Fix type deduction in create_client and create_service
- Add functional header
- Fix cpplint errors
- Remove experimental tag
- Add RCLCPP version check for client and service macros
* Propagate exception in client async callbacks ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Koichi Imai <<koichi.imai.2@tier4.jp>> Co-authored-by: Koichi Imai <<45482193+Koichi98@users.noreply.github.com>>
-
feat(autoware_agnocast_wrapper): support more args for synchronizer (#1104) support 8 args
-
feat(autoware_agnocast_wrapper): adopt glog to agnocast main templete (#1180) feat(autoware_agnocast_wrapper): use glog (#88)
- feat: use glog
- fix: tag name
- feat: link glog
- fix
* fix: add ament auto library ---------
-
fix(autoware_agnocast_wrapper): get_name,namespace,get_fully_qualified_name (#1178) fix get_name,namespace,get_fully_qualified_name
-
feat(autoware_agnocast_wrapper): spawn agnocast_discovery_agent from launch wrapper (#1084) Spawn exactly one agnocast_discovery_agent per ros2 launch tree from agnocast_env.launch.{py,xml} when ENABLE_AGNOCAST=1, deduplicated tree-wide via the LaunchContext globals and pinned to namespace="/".
-
feat(autoware_agnocast_wrapper): add ON_NODE macros (#1170)
-
feat(autoware_agnocast_wrapper): update [agnocast_env.launch]{.title-ref} to enable override [use_agnocast]{.title-ref} (#1123)
- update agnocast_env.launch to override use_agnocast
- style(pre-commit): autofix
* more description in README ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
| Name |
|---|
| libgoogle-glog-dev |
Dependant Packages
Launch files
- launch/agnocast_env.launch.xml
-
- agnocast_heaphook_path [default: /opt/ros/$(env ROS_DISTRO humble)/lib/libagnocast_heaphook.so]
- use_multithread [default: false]
- use_agnocast [default: $(env ENABLE_AGNOCAST 0)]