fixing id

Signed-off-by: Jakub Delicat <jakub.delicat@pwr.edu.pl>
This commit is contained in:
Jakub Delicat 2023-08-17 09:43:58 +02:00
parent 93a170d2bf
commit c3cf21b882

View File

@ -17,8 +17,10 @@ void Ros2Aria::publishState()
if (this->robot_info_pub_->get_subscription_count() > 0) if (this->robot_info_pub_->get_subscription_count() > 0)
{ {
ros2aria_msgs::msg::RobotInfoMsg robot_info_msg; ros2aria_msgs::msg::RobotInfoMsg robot_info_msg;
auto ns = get_namespace();
robot_info_msg.robot_id.data = static_cast<uint8_t>(std::string(get_namespace()).back()); // TODO: id
robot_info_msg.robot_id.data = ns[sizeof(ns) - 1] - '0';
robot_info_msg.battery_voltage.data = r->getRealBatteryVoltageNow(); robot_info_msg.battery_voltage.data = r->getRealBatteryVoltageNow();
robot_info_msg.minimal_distance.data = minimal_distance; robot_info_msg.minimal_distance.data = minimal_distance;
robot_info_msg.twist.linear.x = r->getVel() / 1000; robot_info_msg.twist.linear.x = r->getVel() / 1000;