diff --git a/rmf_robot_sim_common/src/slotcar_common.cpp b/rmf_robot_sim_common/src/slotcar_common.cpp index 92c6cda..9a62e9f 100644 --- a/rmf_robot_sim_common/src/slotcar_common.cpp +++ b/rmf_robot_sim_common/src/slotcar_common.cpp @@ -918,10 +918,7 @@ double SlotcarCommon::compute_change_in_rotation( void SlotcarCommon::publish_robot_state(const double time) { - const int32_t t_sec = static_cast(time); - const uint32_t t_nsec = - static_cast((time-static_cast(t_sec)) *1e9); - const rclcpp::Time ros_time{t_sec, t_nsec, RCL_ROS_TIME}; + const rclcpp::Time ros_time = rmf_plugins_utils::simulation_now(time); if ((time - last_tf2_pub) > (1.0 / TF2_RATE)) { // Publish tf2