Skip to content

Commit 9e39b05

Browse files
Implement push retry
1 parent e8c6bda commit 9e39b05

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

diff_drive_controller/src/diff_drive_controller.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,17 @@ controller_interface::CallbackReturn DiffDriveController::on_configure(
457457
cmd_vel_timeout_ == rclcpp::Duration::from_seconds(0.0) ||
458458
current_time_diff < cmd_vel_timeout_)
459459
{
460-
(void)received_velocity_msg_ptr_.bounded_push(std::move(msg));
460+
for (size_t i = 0; i < 5; ++i)
461+
{
462+
if (received_velocity_msg_ptr_.bounded_push(msg))
463+
{
464+
break;
465+
}
466+
RCLCPP_WARN(
467+
get_node()->get_logger(),
468+
"Velocity command could not be stored in the queue, trying again");
469+
std::this_thread::sleep_for(100us);
470+
}
461471
}
462472
else
463473
{

0 commit comments

Comments
 (0)