From f003c19b5cb55f9cb127bb83973d3c338f651108 Mon Sep 17 00:00:00 2001 From: James Pace Date: Wed, 16 Sep 2026 19:56:11 -0400 Subject: [PATCH] Add identity publisher. --- src/IdentityPublisher.cpp | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/IdentityPublisher.cpp diff --git a/src/IdentityPublisher.cpp b/src/IdentityPublisher.cpp new file mode 100644 index 0000000..4410404 --- /dev/null +++ b/src/IdentityPublisher.cpp @@ -0,0 +1,36 @@ +#include +#include +#include + +#include + +using namespace std::chrono_literals; + + +namespace j7s { + class IdentityPublisher : public rclcpp::Node { + public: + IdentityPublisher(const rclcpp::NodeOptions& options); + private: + std::shared_ptr> m_publisher; + rclcpp::TimerBase::SharedPtr m_timer; + }; +}; + +namespace j7s { + IdentityPublisher::IdentityPublisher(const rclcpp::NodeOptions& options): + Node("identity_publisher", options), + m_publisher(this->create_publisher("identity", 1)), + m_timer{} + { + const std::string identity = "namespace: data_simulator\njaus_id: 123.1.1"; + m_timer = this->create_timer(1000ms, [this, identity]() -> void { + std_msgs::msg::String msg; + msg.data = identity; + m_publisher->publish(msg); + }); + } +}; + +#include +RCLCPP_COMPONENTS_REGISTER_NODE(j7s::IdentityPublisher)