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;