From c3cf21b882c61a646552b9ae224c32a1d6998c7c Mon Sep 17 00:00:00 2001 From: Jakub Delicat Date: Thu, 17 Aug 2023 09:43:58 +0200 Subject: [PATCH] fixing id Signed-off-by: Jakub Delicat --- src/ros2aria/src/state.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ros2aria/src/state.cpp b/src/ros2aria/src/state.cpp index 5d48f05..30fb425 100644 --- a/src/ros2aria/src/state.cpp +++ b/src/ros2aria/src/state.cpp @@ -17,8 +17,10 @@ void Ros2Aria::publishState() if (this->robot_info_pub_->get_subscription_count() > 0) { ros2aria_msgs::msg::RobotInfoMsg robot_info_msg; - - robot_info_msg.robot_id.data = static_cast(std::string(get_namespace()).back()); + auto ns = get_namespace(); + // TODO: id + + robot_info_msg.robot_id.data = ns[sizeof(ns) - 1] - '0'; robot_info_msg.battery_voltage.data = r->getRealBatteryVoltageNow(); robot_info_msg.minimal_distance.data = minimal_distance; robot_info_msg.twist.linear.x = r->getVel() / 1000;