Package Summary

Version 1.6.0
License Apache License 2.0
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Description C++ common utilities for Autoware
Checkout URI https://github.com/autowarefoundation/autoware_utils.git
VCS Type git
VCS Version main
Last Updated 2026-02-20
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

The autoware_utils_rclcpp package

Maintainers

  • Jian Kang
  • Ryohsuke Mitsudome
  • Esteve Fernandez
  • Yutaka Kondo
  • Takagi, Isamu

Authors

No additional authors.

autoware_utils_rclcpp

Overview

The autoware_utils library is a comprehensive toolkit designed to facilitate the development of autonomous driving applications. This package provides essential utilities for rclcpp. It is extensively used in the Autoware project to handle common tasks such as handling parameters, topics and services.

Design

  • parameter.hpp: Simplifies parameter declaration, retrieval, updating, and waiting.
  • polling_subscriber.hpp: A subscriber class with different polling policies (latest, newest, all).

Example Code Snippets

Update Parameters Dynamically with update_param.hpp

#include <autoware_utils_rclcpp/update_param.hpp>
#include <rclcpp/rclcpp.hpp>

int main(int argc, char * argv[]) {
  rclcpp::init(argc, argv);
  auto node = rclcpp::Node::make_shared("param_node");

  double param_value = 0.0;
  std::vector<rclcpp::Parameter> params = node->get_parameters({"my_param"});

  if (autoware_utils::update_param(params, "my_param", param_value)) {
    RCLCPP_INFO(node->get_logger(), "Updated parameter value: %f", param_value);
  } else {
    RCLCPP_WARN(node->get_logger(), "Parameter 'my_param' not found.");
  }

  rclcpp::shutdown();
  return 0;
}

Subscribe to Topics with polling_subscriber.hpp

#include <autoware_utils_rclcpp/polling_subscriber.hpp>
#include <std_msgs/msg/string.hpp>
#include <rclcpp/rclcpp.hpp>

int main(int argc, char * argv[]) {
  rclcpp::init(argc, argv);
  auto node = rclcpp::Node::make_shared("polling_node");

  // Latest policy (default): returns the last received message, or the previous one if no new data.
  auto latest_sub = autoware_utils_rclcpp::InterProcessPollingSubscriber<
    std_msgs::msg::String>::create_subscription(node.get(), "/topic", 1);

  // Newest policy: returns the new message only, or nullptr if no new data.
  auto newest_sub = autoware_utils_rclcpp::InterProcessPollingSubscriber<
    std_msgs::msg::String, autoware_utils_rclcpp::polling_policy::Newest>::
    create_subscription(node.get(), "/topic", 1);

  // All policy: returns all received messages as a vector.
  auto all_sub = autoware_utils_rclcpp::InterProcessPollingSubscriber<
    std_msgs::msg::String, autoware_utils_rclcpp::polling_policy::All>::
    create_subscription(node.get(), "/topic", rclcpp::QoS{10});

  // Retrieve data and timestamp.
  auto msg = latest_sub->take_data();                         // std_msgs::msg::String::ConstSharedPtr
  auto stamp = latest_sub->last_taken_data_timestamp();       // std::optional<rclcpp::Time>

  rclcpp::shutdown();
  return 0;
}

The last_taken_data_timestamp() method returns the source timestamp of the last message retrieved by take_data() as std::optional<rclcpp::Time>.

Note: The timestamp behavior differs depending on the polling policy:

  • Latest policy: The timestamp is retained until a new message is received. To get a valid timestamp, take_data() must be called at least once to retrieve a message.
  • Newest/All policies: The timestamp is cleared when take_data() returns no data (nullptr or empty vector). To get a valid timestamp, the most recent take_data() call must have successfully received a message.
CHANGELOG

Changelog for package autoware_utils_rclcpp

1.6.0 (2026-02-20)

  • feat(autoware_utils_rclcpp): add function to get the timestamp of the latest message (#91)

    • feat(polling_subscriber): add getter of latest_timestamp.
    • fix(rclcpp): fixed dead code.
    • add explanation of PollingSubscriber in README.md
    • update explanation of PollingSubscriber in README.md
    • add testcase to check initial value of PollingSubscriber
    • style(pre-commit): autofix
    • use std::optional instead of the magic number.
    • updated README.md for the previous commit
    • chore(autoware_utils_rclcpp): add precondition of latest_timestamp() method
    • style(pre-commit): autofix
    • change latest_timestamp() to return std::nullopt if there is no valid data received
    • style(pre-commit): autofix
    • chore(polling_subscriber): rename method name

    * style(pre-commit): autofix ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

  • Contributors: Takayuki AKAMINE

1.5.0 (2025-12-30)

1.4.2 (2025-05-21)

1.4.1 (2025-05-15)

1.4.0 (2025-04-22)

1.3.0 (2025-03-21)

  • unify version

  • update changelog

  • feat(autoware_utils_rclcpp): split package (#40)

    • feat(autoware_utils_rclcpp): split package
    • update test

    * update readme ---------

  • Contributors: Takagi, Isamu, Yutaka Kondo

  • feat(autoware_utils_rclcpp): split package (#40)

    • feat(autoware_utils_rclcpp): split package
    • update test

    * update readme ---------

  • Contributors: Takagi, Isamu

1.2.0 (2025-02-26)

1.1.0 (2025-01-27)

1.0.0 (2024-05-02)

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged autoware_utils_rclcpp at Robotics Stack Exchange

Package Summary

Version 1.6.0
License Apache License 2.0
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Description C++ common utilities for Autoware
Checkout URI https://github.com/autowarefoundation/autoware_utils.git
VCS Type git
VCS Version main
Last Updated 2026-02-20
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

The autoware_utils_rclcpp package

Maintainers

  • Jian Kang
  • Ryohsuke Mitsudome
  • Esteve Fernandez
  • Yutaka Kondo
  • Takagi, Isamu

Authors

No additional authors.

autoware_utils_rclcpp

Overview

The autoware_utils library is a comprehensive toolkit designed to facilitate the development of autonomous driving applications. This package provides essential utilities for rclcpp. It is extensively used in the Autoware project to handle common tasks such as handling parameters, topics and services.

Design

  • parameter.hpp: Simplifies parameter declaration, retrieval, updating, and waiting.
  • polling_subscriber.hpp: A subscriber class with different polling policies (latest, newest, all).

Example Code Snippets

Update Parameters Dynamically with update_param.hpp

#include <autoware_utils_rclcpp/update_param.hpp>
#include <rclcpp/rclcpp.hpp>

int main(int argc, char * argv[]) {
  rclcpp::init(argc, argv);
  auto node = rclcpp::Node::make_shared("param_node");

  double param_value = 0.0;
  std::vector<rclcpp::Parameter> params = node->get_parameters({"my_param"});

  if (autoware_utils::update_param(params, "my_param", param_value)) {
    RCLCPP_INFO(node->get_logger(), "Updated parameter value: %f", param_value);
  } else {
    RCLCPP_WARN(node->get_logger(), "Parameter 'my_param' not found.");
  }

  rclcpp::shutdown();
  return 0;
}

Subscribe to Topics with polling_subscriber.hpp

#include <autoware_utils_rclcpp/polling_subscriber.hpp>
#include <std_msgs/msg/string.hpp>
#include <rclcpp/rclcpp.hpp>

int main(int argc, char * argv[]) {
  rclcpp::init(argc, argv);
  auto node = rclcpp::Node::make_shared("polling_node");

  // Latest policy (default): returns the last received message, or the previous one if no new data.
  auto latest_sub = autoware_utils_rclcpp::InterProcessPollingSubscriber<
    std_msgs::msg::String>::create_subscription(node.get(), "/topic", 1);

  // Newest policy: returns the new message only, or nullptr if no new data.
  auto newest_sub = autoware_utils_rclcpp::InterProcessPollingSubscriber<
    std_msgs::msg::String, autoware_utils_rclcpp::polling_policy::Newest>::
    create_subscription(node.get(), "/topic", 1);

  // All policy: returns all received messages as a vector.
  auto all_sub = autoware_utils_rclcpp::InterProcessPollingSubscriber<
    std_msgs::msg::String, autoware_utils_rclcpp::polling_policy::All>::
    create_subscription(node.get(), "/topic", rclcpp::QoS{10});

  // Retrieve data and timestamp.
  auto msg = latest_sub->take_data();                         // std_msgs::msg::String::ConstSharedPtr
  auto stamp = latest_sub->last_taken_data_timestamp();       // std::optional<rclcpp::Time>

  rclcpp::shutdown();
  return 0;
}

The last_taken_data_timestamp() method returns the source timestamp of the last message retrieved by take_data() as std::optional<rclcpp::Time>.

Note: The timestamp behavior differs depending on the polling policy:

  • Latest policy: The timestamp is retained until a new message is received. To get a valid timestamp, take_data() must be called at least once to retrieve a message.
  • Newest/All policies: The timestamp is cleared when take_data() returns no data (nullptr or empty vector). To get a valid timestamp, the most recent take_data() call must have successfully received a message.
CHANGELOG

Changelog for package autoware_utils_rclcpp

1.6.0 (2026-02-20)

  • feat(autoware_utils_rclcpp): add function to get the timestamp of the latest message (#91)

    • feat(polling_subscriber): add getter of latest_timestamp.
    • fix(rclcpp): fixed dead code.
    • add explanation of PollingSubscriber in README.md
    • update explanation of PollingSubscriber in README.md
    • add testcase to check initial value of PollingSubscriber
    • style(pre-commit): autofix
    • use std::optional instead of the magic number.
    • updated README.md for the previous commit
    • chore(autoware_utils_rclcpp): add precondition of latest_timestamp() method
    • style(pre-commit): autofix
    • change latest_timestamp() to return std::nullopt if there is no valid data received
    • style(pre-commit): autofix
    • chore(polling_subscriber): rename method name

    * style(pre-commit): autofix ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

  • Contributors: Takayuki AKAMINE

1.5.0 (2025-12-30)

1.4.2 (2025-05-21)

1.4.1 (2025-05-15)

1.4.0 (2025-04-22)

1.3.0 (2025-03-21)

  • unify version

  • update changelog

  • feat(autoware_utils_rclcpp): split package (#40)

    • feat(autoware_utils_rclcpp): split package
    • update test

    * update readme ---------

  • Contributors: Takagi, Isamu, Yutaka Kondo

  • feat(autoware_utils_rclcpp): split package (#40)

    • feat(autoware_utils_rclcpp): split package
    • update test

    * update readme ---------

  • Contributors: Takagi, Isamu

1.2.0 (2025-02-26)

1.1.0 (2025-01-27)

1.0.0 (2024-05-02)

Package Dependencies

System Dependencies

No direct system dependencies.

Dependant Packages

Name Deps
autoware_utils

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged autoware_utils_rclcpp at Robotics Stack Exchange

No version for distro kilted showing humble. Known supported distros are highlighted in the buttons above.

Package Summary

Version 1.6.0
License Apache License 2.0
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Description C++ common utilities for Autoware
Checkout URI https://github.com/autowarefoundation/autoware_utils.git
VCS Type git
VCS Version main
Last Updated 2026-02-20
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

The autoware_utils_rclcpp package

Maintainers

  • Jian Kang
  • Ryohsuke Mitsudome
  • Esteve Fernandez
  • Yutaka Kondo
  • Takagi, Isamu

Authors

No additional authors.

autoware_utils_rclcpp

Overview

The autoware_utils library is a comprehensive toolkit designed to facilitate the development of autonomous driving applications. This package provides essential utilities for rclcpp. It is extensively used in the Autoware project to handle common tasks such as handling parameters, topics and services.

Design

  • parameter.hpp: Simplifies parameter declaration, retrieval, updating, and waiting.
  • polling_subscriber.hpp: A subscriber class with different polling policies (latest, newest, all).

Example Code Snippets

Update Parameters Dynamically with update_param.hpp

#include <autoware_utils_rclcpp/update_param.hpp>
#include <rclcpp/rclcpp.hpp>

int main(int argc, char * argv[]) {
  rclcpp::init(argc, argv);
  auto node = rclcpp::Node::make_shared("param_node");

  double param_value = 0.0;
  std::vector<rclcpp::Parameter> params = node->get_parameters({"my_param"});

  if (autoware_utils::update_param(params, "my_param", param_value)) {
    RCLCPP_INFO(node->get_logger(), "Updated parameter value: %f", param_value);
  } else {
    RCLCPP_WARN(node->get_logger(), "Parameter 'my_param' not found.");
  }

  rclcpp::shutdown();
  return 0;
}

Subscribe to Topics with polling_subscriber.hpp

#include <autoware_utils_rclcpp/polling_subscriber.hpp>
#include <std_msgs/msg/string.hpp>
#include <rclcpp/rclcpp.hpp>

int main(int argc, char * argv[]) {
  rclcpp::init(argc, argv);
  auto node = rclcpp::Node::make_shared("polling_node");

  // Latest policy (default): returns the last received message, or the previous one if no new data.
  auto latest_sub = autoware_utils_rclcpp::InterProcessPollingSubscriber<
    std_msgs::msg::String>::create_subscription(node.get(), "/topic", 1);

  // Newest policy: returns the new message only, or nullptr if no new data.
  auto newest_sub = autoware_utils_rclcpp::InterProcessPollingSubscriber<
    std_msgs::msg::String, autoware_utils_rclcpp::polling_policy::Newest>::
    create_subscription(node.get(), "/topic", 1);

  // All policy: returns all received messages as a vector.
  auto all_sub = autoware_utils_rclcpp::InterProcessPollingSubscriber<
    std_msgs::msg::String, autoware_utils_rclcpp::polling_policy::All>::
    create_subscription(node.get(), "/topic", rclcpp::QoS{10});

  // Retrieve data and timestamp.
  auto msg = latest_sub->take_data();                         // std_msgs::msg::String::ConstSharedPtr
  auto stamp = latest_sub->last_taken_data_timestamp();       // std::optional<rclcpp::Time>

  rclcpp::shutdown();
  return 0;
}

The last_taken_data_timestamp() method returns the source timestamp of the last message retrieved by take_data() as std::optional<rclcpp::Time>.

Note: The timestamp behavior differs depending on the polling policy:

  • Latest policy: The timestamp is retained until a new message is received. To get a valid timestamp, take_data() must be called at least once to retrieve a message.
  • Newest/All policies: The timestamp is cleared when take_data() returns no data (nullptr or empty vector). To get a valid timestamp, the most recent take_data() call must have successfully received a message.
CHANGELOG

Changelog for package autoware_utils_rclcpp

1.6.0 (2026-02-20)

  • feat(autoware_utils_rclcpp): add function to get the timestamp of the latest message (#91)

    • feat(polling_subscriber): add getter of latest_timestamp.
    • fix(rclcpp): fixed dead code.
    • add explanation of PollingSubscriber in README.md
    • update explanation of PollingSubscriber in README.md
    • add testcase to check initial value of PollingSubscriber
    • style(pre-commit): autofix
    • use std::optional instead of the magic number.
    • updated README.md for the previous commit
    • chore(autoware_utils_rclcpp): add precondition of latest_timestamp() method
    • style(pre-commit): autofix
    • change latest_timestamp() to return std::nullopt if there is no valid data received
    • style(pre-commit): autofix
    • chore(polling_subscriber): rename method name

    * style(pre-commit): autofix ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

  • Contributors: Takayuki AKAMINE

1.5.0 (2025-12-30)

1.4.2 (2025-05-21)

1.4.1 (2025-05-15)

1.4.0 (2025-04-22)

1.3.0 (2025-03-21)

  • unify version

  • update changelog

  • feat(autoware_utils_rclcpp): split package (#40)

    • feat(autoware_utils_rclcpp): split package
    • update test

    * update readme ---------

  • Contributors: Takagi, Isamu, Yutaka Kondo

  • feat(autoware_utils_rclcpp): split package (#40)

    • feat(autoware_utils_rclcpp): split package
    • update test

    * update readme ---------

  • Contributors: Takagi, Isamu

1.2.0 (2025-02-26)

1.1.0 (2025-01-27)

1.0.0 (2024-05-02)

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged autoware_utils_rclcpp at Robotics Stack Exchange

Package Summary

Version 1.6.0
License Apache License 2.0
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Description C++ common utilities for Autoware
Checkout URI https://github.com/autowarefoundation/autoware_utils.git
VCS Type git
VCS Version main
Last Updated 2026-02-20
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

The autoware_utils_rclcpp package

Maintainers

  • Jian Kang
  • Ryohsuke Mitsudome
  • Esteve Fernandez
  • Yutaka Kondo
  • Takagi, Isamu

Authors

No additional authors.

autoware_utils_rclcpp

Overview

The autoware_utils library is a comprehensive toolkit designed to facilitate the development of autonomous driving applications. This package provides essential utilities for rclcpp. It is extensively used in the Autoware project to handle common tasks such as handling parameters, topics and services.

Design

  • parameter.hpp: Simplifies parameter declaration, retrieval, updating, and waiting.
  • polling_subscriber.hpp: A subscriber class with different polling policies (latest, newest, all).

Example Code Snippets

Update Parameters Dynamically with update_param.hpp

#include <autoware_utils_rclcpp/update_param.hpp>
#include <rclcpp/rclcpp.hpp>

int main(int argc, char * argv[]) {
  rclcpp::init(argc, argv);
  auto node = rclcpp::Node::make_shared("param_node");

  double param_value = 0.0;
  std::vector<rclcpp::Parameter> params = node->get_parameters({"my_param"});

  if (autoware_utils::update_param(params, "my_param", param_value)) {
    RCLCPP_INFO(node->get_logger(), "Updated parameter value: %f", param_value);
  } else {
    RCLCPP_WARN(node->get_logger(), "Parameter 'my_param' not found.");
  }

  rclcpp::shutdown();
  return 0;
}

Subscribe to Topics with polling_subscriber.hpp

#include <autoware_utils_rclcpp/polling_subscriber.hpp>
#include <std_msgs/msg/string.hpp>
#include <rclcpp/rclcpp.hpp>

int main(int argc, char * argv[]) {
  rclcpp::init(argc, argv);
  auto node = rclcpp::Node::make_shared("polling_node");

  // Latest policy (default): returns the last received message, or the previous one if no new data.
  auto latest_sub = autoware_utils_rclcpp::InterProcessPollingSubscriber<
    std_msgs::msg::String>::create_subscription(node.get(), "/topic", 1);

  // Newest policy: returns the new message only, or nullptr if no new data.
  auto newest_sub = autoware_utils_rclcpp::InterProcessPollingSubscriber<
    std_msgs::msg::String, autoware_utils_rclcpp::polling_policy::Newest>::
    create_subscription(node.get(), "/topic", 1);

  // All policy: returns all received messages as a vector.
  auto all_sub = autoware_utils_rclcpp::InterProcessPollingSubscriber<
    std_msgs::msg::String, autoware_utils_rclcpp::polling_policy::All>::
    create_subscription(node.get(), "/topic", rclcpp::QoS{10});

  // Retrieve data and timestamp.
  auto msg = latest_sub->take_data();                         // std_msgs::msg::String::ConstSharedPtr
  auto stamp = latest_sub->last_taken_data_timestamp();       // std::optional<rclcpp::Time>

  rclcpp::shutdown();
  return 0;
}

The last_taken_data_timestamp() method returns the source timestamp of the last message retrieved by take_data() as std::optional<rclcpp::Time>.

Note: The timestamp behavior differs depending on the polling policy:

  • Latest policy: The timestamp is retained until a new message is received. To get a valid timestamp, take_data() must be called at least once to retrieve a message.
  • Newest/All policies: The timestamp is cleared when take_data() returns no data (nullptr or empty vector). To get a valid timestamp, the most recent take_data() call must have successfully received a message.
CHANGELOG

Changelog for package autoware_utils_rclcpp

1.6.0 (2026-02-20)

  • feat(autoware_utils_rclcpp): add function to get the timestamp of the latest message (#91)

    • feat(polling_subscriber): add getter of latest_timestamp.
    • fix(rclcpp): fixed dead code.
    • add explanation of PollingSubscriber in README.md
    • update explanation of PollingSubscriber in README.md
    • add testcase to check initial value of PollingSubscriber
    • style(pre-commit): autofix
    • use std::optional instead of the magic number.
    • updated README.md for the previous commit
    • chore(autoware_utils_rclcpp): add precondition of latest_timestamp() method
    • style(pre-commit): autofix
    • change latest_timestamp() to return std::nullopt if there is no valid data received
    • style(pre-commit): autofix
    • chore(polling_subscriber): rename method name

    * style(pre-commit): autofix ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

  • Contributors: Takayuki AKAMINE

1.5.0 (2025-12-30)

1.4.2 (2025-05-21)

1.4.1 (2025-05-15)

1.4.0 (2025-04-22)

1.3.0 (2025-03-21)

  • unify version

  • update changelog

  • feat(autoware_utils_rclcpp): split package (#40)

    • feat(autoware_utils_rclcpp): split package
    • update test

    * update readme ---------

  • Contributors: Takagi, Isamu, Yutaka Kondo

  • feat(autoware_utils_rclcpp): split package (#40)

    • feat(autoware_utils_rclcpp): split package
    • update test

    * update readme ---------

  • Contributors: Takagi, Isamu

1.2.0 (2025-02-26)

1.1.0 (2025-01-27)

1.0.0 (2024-05-02)

Package Dependencies

System Dependencies

No direct system dependencies.

Dependant Packages

Name Deps
autoware_utils

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged autoware_utils_rclcpp at Robotics Stack Exchange

No version for distro github showing humble. Known supported distros are highlighted in the buttons above.

Package Summary

Version 1.6.0
License Apache License 2.0
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Description C++ common utilities for Autoware
Checkout URI https://github.com/autowarefoundation/autoware_utils.git
VCS Type git
VCS Version main
Last Updated 2026-02-20
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

The autoware_utils_rclcpp package

Maintainers

  • Jian Kang
  • Ryohsuke Mitsudome
  • Esteve Fernandez
  • Yutaka Kondo
  • Takagi, Isamu

Authors

No additional authors.

autoware_utils_rclcpp

Overview

The autoware_utils library is a comprehensive toolkit designed to facilitate the development of autonomous driving applications. This package provides essential utilities for rclcpp. It is extensively used in the Autoware project to handle common tasks such as handling parameters, topics and services.

Design

  • parameter.hpp: Simplifies parameter declaration, retrieval, updating, and waiting.
  • polling_subscriber.hpp: A subscriber class with different polling policies (latest, newest, all).

Example Code Snippets

Update Parameters Dynamically with update_param.hpp

#include <autoware_utils_rclcpp/update_param.hpp>
#include <rclcpp/rclcpp.hpp>

int main(int argc, char * argv[]) {
  rclcpp::init(argc, argv);
  auto node = rclcpp::Node::make_shared("param_node");

  double param_value = 0.0;
  std::vector<rclcpp::Parameter> params = node->get_parameters({"my_param"});

  if (autoware_utils::update_param(params, "my_param", param_value)) {
    RCLCPP_INFO(node->get_logger(), "Updated parameter value: %f", param_value);
  } else {
    RCLCPP_WARN(node->get_logger(), "Parameter 'my_param' not found.");
  }

  rclcpp::shutdown();
  return 0;
}

Subscribe to Topics with polling_subscriber.hpp

#include <autoware_utils_rclcpp/polling_subscriber.hpp>
#include <std_msgs/msg/string.hpp>
#include <rclcpp/rclcpp.hpp>

int main(int argc, char * argv[]) {
  rclcpp::init(argc, argv);
  auto node = rclcpp::Node::make_shared("polling_node");

  // Latest policy (default): returns the last received message, or the previous one if no new data.
  auto latest_sub = autoware_utils_rclcpp::InterProcessPollingSubscriber<
    std_msgs::msg::String>::create_subscription(node.get(), "/topic", 1);

  // Newest policy: returns the new message only, or nullptr if no new data.
  auto newest_sub = autoware_utils_rclcpp::InterProcessPollingSubscriber<
    std_msgs::msg::String, autoware_utils_rclcpp::polling_policy::Newest>::
    create_subscription(node.get(), "/topic", 1);

  // All policy: returns all received messages as a vector.
  auto all_sub = autoware_utils_rclcpp::InterProcessPollingSubscriber<
    std_msgs::msg::String, autoware_utils_rclcpp::polling_policy::All>::
    create_subscription(node.get(), "/topic", rclcpp::QoS{10});

  // Retrieve data and timestamp.
  auto msg = latest_sub->take_data();                         // std_msgs::msg::String::ConstSharedPtr
  auto stamp = latest_sub->last_taken_data_timestamp();       // std::optional<rclcpp::Time>

  rclcpp::shutdown();
  return 0;
}

The last_taken_data_timestamp() method returns the source timestamp of the last message retrieved by take_data() as std::optional<rclcpp::Time>.

Note: The timestamp behavior differs depending on the polling policy:

  • Latest policy: The timestamp is retained until a new message is received. To get a valid timestamp, take_data() must be called at least once to retrieve a message.
  • Newest/All policies: The timestamp is cleared when take_data() returns no data (nullptr or empty vector). To get a valid timestamp, the most recent take_data() call must have successfully received a message.
CHANGELOG

Changelog for package autoware_utils_rclcpp

1.6.0 (2026-02-20)

  • feat(autoware_utils_rclcpp): add function to get the timestamp of the latest message (#91)

    • feat(polling_subscriber): add getter of latest_timestamp.
    • fix(rclcpp): fixed dead code.
    • add explanation of PollingSubscriber in README.md
    • update explanation of PollingSubscriber in README.md
    • add testcase to check initial value of PollingSubscriber
    • style(pre-commit): autofix
    • use std::optional instead of the magic number.
    • updated README.md for the previous commit
    • chore(autoware_utils_rclcpp): add precondition of latest_timestamp() method
    • style(pre-commit): autofix
    • change latest_timestamp() to return std::nullopt if there is no valid data received
    • style(pre-commit): autofix
    • chore(polling_subscriber): rename method name

    * style(pre-commit): autofix ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

  • Contributors: Takayuki AKAMINE

1.5.0 (2025-12-30)

1.4.2 (2025-05-21)

1.4.1 (2025-05-15)

1.4.0 (2025-04-22)

1.3.0 (2025-03-21)

  • unify version

  • update changelog

  • feat(autoware_utils_rclcpp): split package (#40)

    • feat(autoware_utils_rclcpp): split package
    • update test

    * update readme ---------

  • Contributors: Takagi, Isamu, Yutaka Kondo

  • feat(autoware_utils_rclcpp): split package (#40)

    • feat(autoware_utils_rclcpp): split package
    • update test

    * update readme ---------

  • Contributors: Takagi, Isamu

1.2.0 (2025-02-26)

1.1.0 (2025-01-27)

1.0.0 (2024-05-02)

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged autoware_utils_rclcpp at Robotics Stack Exchange

No version for distro galactic showing humble. Known supported distros are highlighted in the buttons above.

Package Summary

Version 1.6.0
License Apache License 2.0
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Description C++ common utilities for Autoware
Checkout URI https://github.com/autowarefoundation/autoware_utils.git
VCS Type git
VCS Version main
Last Updated 2026-02-20
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

The autoware_utils_rclcpp package

Maintainers

  • Jian Kang
  • Ryohsuke Mitsudome
  • Esteve Fernandez
  • Yutaka Kondo
  • Takagi, Isamu

Authors

No additional authors.

autoware_utils_rclcpp

Overview

The autoware_utils library is a comprehensive toolkit designed to facilitate the development of autonomous driving applications. This package provides essential utilities for rclcpp. It is extensively used in the Autoware project to handle common tasks such as handling parameters, topics and services.

Design

  • parameter.hpp: Simplifies parameter declaration, retrieval, updating, and waiting.
  • polling_subscriber.hpp: A subscriber class with different polling policies (latest, newest, all).

Example Code Snippets

Update Parameters Dynamically with update_param.hpp

#include <autoware_utils_rclcpp/update_param.hpp>
#include <rclcpp/rclcpp.hpp>

int main(int argc, char * argv[]) {
  rclcpp::init(argc, argv);
  auto node = rclcpp::Node::make_shared("param_node");

  double param_value = 0.0;
  std::vector<rclcpp::Parameter> params = node->get_parameters({"my_param"});

  if (autoware_utils::update_param(params, "my_param", param_value)) {
    RCLCPP_INFO(node->get_logger(), "Updated parameter value: %f", param_value);
  } else {
    RCLCPP_WARN(node->get_logger(), "Parameter 'my_param' not found.");
  }

  rclcpp::shutdown();
  return 0;
}

Subscribe to Topics with polling_subscriber.hpp

#include <autoware_utils_rclcpp/polling_subscriber.hpp>
#include <std_msgs/msg/string.hpp>
#include <rclcpp/rclcpp.hpp>

int main(int argc, char * argv[]) {
  rclcpp::init(argc, argv);
  auto node = rclcpp::Node::make_shared("polling_node");

  // Latest policy (default): returns the last received message, or the previous one if no new data.
  auto latest_sub = autoware_utils_rclcpp::InterProcessPollingSubscriber<
    std_msgs::msg::String>::create_subscription(node.get(), "/topic", 1);

  // Newest policy: returns the new message only, or nullptr if no new data.
  auto newest_sub = autoware_utils_rclcpp::InterProcessPollingSubscriber<
    std_msgs::msg::String, autoware_utils_rclcpp::polling_policy::Newest>::
    create_subscription(node.get(), "/topic", 1);

  // All policy: returns all received messages as a vector.
  auto all_sub = autoware_utils_rclcpp::InterProcessPollingSubscriber<
    std_msgs::msg::String, autoware_utils_rclcpp::polling_policy::All>::
    create_subscription(node.get(), "/topic", rclcpp::QoS{10});

  // Retrieve data and timestamp.
  auto msg = latest_sub->take_data();                         // std_msgs::msg::String::ConstSharedPtr
  auto stamp = latest_sub->last_taken_data_timestamp();       // std::optional<rclcpp::Time>

  rclcpp::shutdown();
  return 0;
}

The last_taken_data_timestamp() method returns the source timestamp of the last message retrieved by take_data() as std::optional<rclcpp::Time>.

Note: The timestamp behavior differs depending on the polling policy:

  • Latest policy: The timestamp is retained until a new message is received. To get a valid timestamp, take_data() must be called at least once to retrieve a message.
  • Newest/All policies: The timestamp is cleared when take_data() returns no data (nullptr or empty vector). To get a valid timestamp, the most recent take_data() call must have successfully received a message.
CHANGELOG

Changelog for package autoware_utils_rclcpp

1.6.0 (2026-02-20)

  • feat(autoware_utils_rclcpp): add function to get the timestamp of the latest message (#91)

    • feat(polling_subscriber): add getter of latest_timestamp.
    • fix(rclcpp): fixed dead code.
    • add explanation of PollingSubscriber in README.md
    • update explanation of PollingSubscriber in README.md
    • add testcase to check initial value of PollingSubscriber
    • style(pre-commit): autofix
    • use std::optional instead of the magic number.
    • updated README.md for the previous commit
    • chore(autoware_utils_rclcpp): add precondition of latest_timestamp() method
    • style(pre-commit): autofix
    • change latest_timestamp() to return std::nullopt if there is no valid data received
    • style(pre-commit): autofix
    • chore(polling_subscriber): rename method name

    * style(pre-commit): autofix ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

  • Contributors: Takayuki AKAMINE

1.5.0 (2025-12-30)

1.4.2 (2025-05-21)

1.4.1 (2025-05-15)

1.4.0 (2025-04-22)

1.3.0 (2025-03-21)

  • unify version

  • update changelog

  • feat(autoware_utils_rclcpp): split package (#40)

    • feat(autoware_utils_rclcpp): split package
    • update test

    * update readme ---------

  • Contributors: Takagi, Isamu, Yutaka Kondo

  • feat(autoware_utils_rclcpp): split package (#40)

    • feat(autoware_utils_rclcpp): split package
    • update test

    * update readme ---------

  • Contributors: Takagi, Isamu

1.2.0 (2025-02-26)

1.1.0 (2025-01-27)

1.0.0 (2024-05-02)

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged autoware_utils_rclcpp at Robotics Stack Exchange

No version for distro iron showing humble. Known supported distros are highlighted in the buttons above.

Package Summary

Version 1.6.0
License Apache License 2.0
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Description C++ common utilities for Autoware
Checkout URI https://github.com/autowarefoundation/autoware_utils.git
VCS Type git
VCS Version main
Last Updated 2026-02-20
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

The autoware_utils_rclcpp package

Maintainers

  • Jian Kang
  • Ryohsuke Mitsudome
  • Esteve Fernandez
  • Yutaka Kondo
  • Takagi, Isamu

Authors

No additional authors.

autoware_utils_rclcpp

Overview

The autoware_utils library is a comprehensive toolkit designed to facilitate the development of autonomous driving applications. This package provides essential utilities for rclcpp. It is extensively used in the Autoware project to handle common tasks such as handling parameters, topics and services.

Design

  • parameter.hpp: Simplifies parameter declaration, retrieval, updating, and waiting.
  • polling_subscriber.hpp: A subscriber class with different polling policies (latest, newest, all).

Example Code Snippets

Update Parameters Dynamically with update_param.hpp

#include <autoware_utils_rclcpp/update_param.hpp>
#include <rclcpp/rclcpp.hpp>

int main(int argc, char * argv[]) {
  rclcpp::init(argc, argv);
  auto node = rclcpp::Node::make_shared("param_node");

  double param_value = 0.0;
  std::vector<rclcpp::Parameter> params = node->get_parameters({"my_param"});

  if (autoware_utils::update_param(params, "my_param", param_value)) {
    RCLCPP_INFO(node->get_logger(), "Updated parameter value: %f", param_value);
  } else {
    RCLCPP_WARN(node->get_logger(), "Parameter 'my_param' not found.");
  }

  rclcpp::shutdown();
  return 0;
}

Subscribe to Topics with polling_subscriber.hpp

#include <autoware_utils_rclcpp/polling_subscriber.hpp>
#include <std_msgs/msg/string.hpp>
#include <rclcpp/rclcpp.hpp>

int main(int argc, char * argv[]) {
  rclcpp::init(argc, argv);
  auto node = rclcpp::Node::make_shared("polling_node");

  // Latest policy (default): returns the last received message, or the previous one if no new data.
  auto latest_sub = autoware_utils_rclcpp::InterProcessPollingSubscriber<
    std_msgs::msg::String>::create_subscription(node.get(), "/topic", 1);

  // Newest policy: returns the new message only, or nullptr if no new data.
  auto newest_sub = autoware_utils_rclcpp::InterProcessPollingSubscriber<
    std_msgs::msg::String, autoware_utils_rclcpp::polling_policy::Newest>::
    create_subscription(node.get(), "/topic", 1);

  // All policy: returns all received messages as a vector.
  auto all_sub = autoware_utils_rclcpp::InterProcessPollingSubscriber<
    std_msgs::msg::String, autoware_utils_rclcpp::polling_policy::All>::
    create_subscription(node.get(), "/topic", rclcpp::QoS{10});

  // Retrieve data and timestamp.
  auto msg = latest_sub->take_data();                         // std_msgs::msg::String::ConstSharedPtr
  auto stamp = latest_sub->last_taken_data_timestamp();       // std::optional<rclcpp::Time>

  rclcpp::shutdown();
  return 0;
}

The last_taken_data_timestamp() method returns the source timestamp of the last message retrieved by take_data() as std::optional<rclcpp::Time>.

Note: The timestamp behavior differs depending on the polling policy:

  • Latest policy: The timestamp is retained until a new message is received. To get a valid timestamp, take_data() must be called at least once to retrieve a message.
  • Newest/All policies: The timestamp is cleared when take_data() returns no data (nullptr or empty vector). To get a valid timestamp, the most recent take_data() call must have successfully received a message.
CHANGELOG

Changelog for package autoware_utils_rclcpp

1.6.0 (2026-02-20)

  • feat(autoware_utils_rclcpp): add function to get the timestamp of the latest message (#91)

    • feat(polling_subscriber): add getter of latest_timestamp.
    • fix(rclcpp): fixed dead code.
    • add explanation of PollingSubscriber in README.md
    • update explanation of PollingSubscriber in README.md
    • add testcase to check initial value of PollingSubscriber
    • style(pre-commit): autofix
    • use std::optional instead of the magic number.
    • updated README.md for the previous commit
    • chore(autoware_utils_rclcpp): add precondition of latest_timestamp() method
    • style(pre-commit): autofix
    • change latest_timestamp() to return std::nullopt if there is no valid data received
    • style(pre-commit): autofix
    • chore(polling_subscriber): rename method name

    * style(pre-commit): autofix ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

  • Contributors: Takayuki AKAMINE

1.5.0 (2025-12-30)

1.4.2 (2025-05-21)

1.4.1 (2025-05-15)

1.4.0 (2025-04-22)

1.3.0 (2025-03-21)

  • unify version

  • update changelog

  • feat(autoware_utils_rclcpp): split package (#40)

    • feat(autoware_utils_rclcpp): split package
    • update test

    * update readme ---------

  • Contributors: Takagi, Isamu, Yutaka Kondo

  • feat(autoware_utils_rclcpp): split package (#40)

    • feat(autoware_utils_rclcpp): split package
    • update test

    * update readme ---------

  • Contributors: Takagi, Isamu

1.2.0 (2025-02-26)

1.1.0 (2025-01-27)

1.0.0 (2024-05-02)

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged autoware_utils_rclcpp at Robotics Stack Exchange

No version for distro melodic showing humble. Known supported distros are highlighted in the buttons above.

Package Summary

Version 1.6.0
License Apache License 2.0
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Description C++ common utilities for Autoware
Checkout URI https://github.com/autowarefoundation/autoware_utils.git
VCS Type git
VCS Version main
Last Updated 2026-02-20
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

The autoware_utils_rclcpp package

Maintainers

  • Jian Kang
  • Ryohsuke Mitsudome
  • Esteve Fernandez
  • Yutaka Kondo
  • Takagi, Isamu

Authors

No additional authors.

autoware_utils_rclcpp

Overview

The autoware_utils library is a comprehensive toolkit designed to facilitate the development of autonomous driving applications. This package provides essential utilities for rclcpp. It is extensively used in the Autoware project to handle common tasks such as handling parameters, topics and services.

Design

  • parameter.hpp: Simplifies parameter declaration, retrieval, updating, and waiting.
  • polling_subscriber.hpp: A subscriber class with different polling policies (latest, newest, all).

Example Code Snippets

Update Parameters Dynamically with update_param.hpp

#include <autoware_utils_rclcpp/update_param.hpp>
#include <rclcpp/rclcpp.hpp>

int main(int argc, char * argv[]) {
  rclcpp::init(argc, argv);
  auto node = rclcpp::Node::make_shared("param_node");

  double param_value = 0.0;
  std::vector<rclcpp::Parameter> params = node->get_parameters({"my_param"});

  if (autoware_utils::update_param(params, "my_param", param_value)) {
    RCLCPP_INFO(node->get_logger(), "Updated parameter value: %f", param_value);
  } else {
    RCLCPP_WARN(node->get_logger(), "Parameter 'my_param' not found.");
  }

  rclcpp::shutdown();
  return 0;
}

Subscribe to Topics with polling_subscriber.hpp

#include <autoware_utils_rclcpp/polling_subscriber.hpp>
#include <std_msgs/msg/string.hpp>
#include <rclcpp/rclcpp.hpp>

int main(int argc, char * argv[]) {
  rclcpp::init(argc, argv);
  auto node = rclcpp::Node::make_shared("polling_node");

  // Latest policy (default): returns the last received message, or the previous one if no new data.
  auto latest_sub = autoware_utils_rclcpp::InterProcessPollingSubscriber<
    std_msgs::msg::String>::create_subscription(node.get(), "/topic", 1);

  // Newest policy: returns the new message only, or nullptr if no new data.
  auto newest_sub = autoware_utils_rclcpp::InterProcessPollingSubscriber<
    std_msgs::msg::String, autoware_utils_rclcpp::polling_policy::Newest>::
    create_subscription(node.get(), "/topic", 1);

  // All policy: returns all received messages as a vector.
  auto all_sub = autoware_utils_rclcpp::InterProcessPollingSubscriber<
    std_msgs::msg::String, autoware_utils_rclcpp::polling_policy::All>::
    create_subscription(node.get(), "/topic", rclcpp::QoS{10});

  // Retrieve data and timestamp.
  auto msg = latest_sub->take_data();                         // std_msgs::msg::String::ConstSharedPtr
  auto stamp = latest_sub->last_taken_data_timestamp();       // std::optional<rclcpp::Time>

  rclcpp::shutdown();
  return 0;
}

The last_taken_data_timestamp() method returns the source timestamp of the last message retrieved by take_data() as std::optional<rclcpp::Time>.

Note: The timestamp behavior differs depending on the polling policy:

  • Latest policy: The timestamp is retained until a new message is received. To get a valid timestamp, take_data() must be called at least once to retrieve a message.
  • Newest/All policies: The timestamp is cleared when take_data() returns no data (nullptr or empty vector). To get a valid timestamp, the most recent take_data() call must have successfully received a message.
CHANGELOG

Changelog for package autoware_utils_rclcpp

1.6.0 (2026-02-20)

  • feat(autoware_utils_rclcpp): add function to get the timestamp of the latest message (#91)

    • feat(polling_subscriber): add getter of latest_timestamp.
    • fix(rclcpp): fixed dead code.
    • add explanation of PollingSubscriber in README.md
    • update explanation of PollingSubscriber in README.md
    • add testcase to check initial value of PollingSubscriber
    • style(pre-commit): autofix
    • use std::optional instead of the magic number.
    • updated README.md for the previous commit
    • chore(autoware_utils_rclcpp): add precondition of latest_timestamp() method
    • style(pre-commit): autofix
    • change latest_timestamp() to return std::nullopt if there is no valid data received
    • style(pre-commit): autofix
    • chore(polling_subscriber): rename method name

    * style(pre-commit): autofix ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

  • Contributors: Takayuki AKAMINE

1.5.0 (2025-12-30)

1.4.2 (2025-05-21)

1.4.1 (2025-05-15)

1.4.0 (2025-04-22)

1.3.0 (2025-03-21)

  • unify version

  • update changelog

  • feat(autoware_utils_rclcpp): split package (#40)

    • feat(autoware_utils_rclcpp): split package
    • update test

    * update readme ---------

  • Contributors: Takagi, Isamu, Yutaka Kondo

  • feat(autoware_utils_rclcpp): split package (#40)

    • feat(autoware_utils_rclcpp): split package
    • update test

    * update readme ---------

  • Contributors: Takagi, Isamu

1.2.0 (2025-02-26)

1.1.0 (2025-01-27)

1.0.0 (2024-05-02)

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged autoware_utils_rclcpp at Robotics Stack Exchange

No version for distro noetic showing humble. Known supported distros are highlighted in the buttons above.

Package Summary

Version 1.6.0
License Apache License 2.0
Build type AMENT_CMAKE
Use RECOMMENDED

Repository Summary

Description C++ common utilities for Autoware
Checkout URI https://github.com/autowarefoundation/autoware_utils.git
VCS Type git
VCS Version main
Last Updated 2026-02-20
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

The autoware_utils_rclcpp package

Maintainers

  • Jian Kang
  • Ryohsuke Mitsudome
  • Esteve Fernandez
  • Yutaka Kondo
  • Takagi, Isamu

Authors

No additional authors.

autoware_utils_rclcpp

Overview

The autoware_utils library is a comprehensive toolkit designed to facilitate the development of autonomous driving applications. This package provides essential utilities for rclcpp. It is extensively used in the Autoware project to handle common tasks such as handling parameters, topics and services.

Design

  • parameter.hpp: Simplifies parameter declaration, retrieval, updating, and waiting.
  • polling_subscriber.hpp: A subscriber class with different polling policies (latest, newest, all).

Example Code Snippets

Update Parameters Dynamically with update_param.hpp

#include <autoware_utils_rclcpp/update_param.hpp>
#include <rclcpp/rclcpp.hpp>

int main(int argc, char * argv[]) {
  rclcpp::init(argc, argv);
  auto node = rclcpp::Node::make_shared("param_node");

  double param_value = 0.0;
  std::vector<rclcpp::Parameter> params = node->get_parameters({"my_param"});

  if (autoware_utils::update_param(params, "my_param", param_value)) {
    RCLCPP_INFO(node->get_logger(), "Updated parameter value: %f", param_value);
  } else {
    RCLCPP_WARN(node->get_logger(), "Parameter 'my_param' not found.");
  }

  rclcpp::shutdown();
  return 0;
}

Subscribe to Topics with polling_subscriber.hpp

#include <autoware_utils_rclcpp/polling_subscriber.hpp>
#include <std_msgs/msg/string.hpp>
#include <rclcpp/rclcpp.hpp>

int main(int argc, char * argv[]) {
  rclcpp::init(argc, argv);
  auto node = rclcpp::Node::make_shared("polling_node");

  // Latest policy (default): returns the last received message, or the previous one if no new data.
  auto latest_sub = autoware_utils_rclcpp::InterProcessPollingSubscriber<
    std_msgs::msg::String>::create_subscription(node.get(), "/topic", 1);

  // Newest policy: returns the new message only, or nullptr if no new data.
  auto newest_sub = autoware_utils_rclcpp::InterProcessPollingSubscriber<
    std_msgs::msg::String, autoware_utils_rclcpp::polling_policy::Newest>::
    create_subscription(node.get(), "/topic", 1);

  // All policy: returns all received messages as a vector.
  auto all_sub = autoware_utils_rclcpp::InterProcessPollingSubscriber<
    std_msgs::msg::String, autoware_utils_rclcpp::polling_policy::All>::
    create_subscription(node.get(), "/topic", rclcpp::QoS{10});

  // Retrieve data and timestamp.
  auto msg = latest_sub->take_data();                         // std_msgs::msg::String::ConstSharedPtr
  auto stamp = latest_sub->last_taken_data_timestamp();       // std::optional<rclcpp::Time>

  rclcpp::shutdown();
  return 0;
}

The last_taken_data_timestamp() method returns the source timestamp of the last message retrieved by take_data() as std::optional<rclcpp::Time>.

Note: The timestamp behavior differs depending on the polling policy:

  • Latest policy: The timestamp is retained until a new message is received. To get a valid timestamp, take_data() must be called at least once to retrieve a message.
  • Newest/All policies: The timestamp is cleared when take_data() returns no data (nullptr or empty vector). To get a valid timestamp, the most recent take_data() call must have successfully received a message.
CHANGELOG

Changelog for package autoware_utils_rclcpp

1.6.0 (2026-02-20)

  • feat(autoware_utils_rclcpp): add function to get the timestamp of the latest message (#91)

    • feat(polling_subscriber): add getter of latest_timestamp.
    • fix(rclcpp): fixed dead code.
    • add explanation of PollingSubscriber in README.md
    • update explanation of PollingSubscriber in README.md
    • add testcase to check initial value of PollingSubscriber
    • style(pre-commit): autofix
    • use std::optional instead of the magic number.
    • updated README.md for the previous commit
    • chore(autoware_utils_rclcpp): add precondition of latest_timestamp() method
    • style(pre-commit): autofix
    • change latest_timestamp() to return std::nullopt if there is no valid data received
    • style(pre-commit): autofix
    • chore(polling_subscriber): rename method name

    * style(pre-commit): autofix ---------Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

  • Contributors: Takayuki AKAMINE

1.5.0 (2025-12-30)

1.4.2 (2025-05-21)

1.4.1 (2025-05-15)

1.4.0 (2025-04-22)

1.3.0 (2025-03-21)

  • unify version

  • update changelog

  • feat(autoware_utils_rclcpp): split package (#40)

    • feat(autoware_utils_rclcpp): split package
    • update test

    * update readme ---------

  • Contributors: Takagi, Isamu, Yutaka Kondo

  • feat(autoware_utils_rclcpp): split package (#40)

    • feat(autoware_utils_rclcpp): split package
    • update test

    * update readme ---------

  • Contributors: Takagi, Isamu

1.2.0 (2025-02-26)

1.1.0 (2025-01-27)

1.0.0 (2024-05-02)

Launch files

No launch files found

Messages

No message files found.

Services

No service files found

Plugins

No plugins found.

Recent questions tagged autoware_utils_rclcpp at Robotics Stack Exchange