Skip to content

Commit 108b60a

Browse files
Implement push retry
1 parent 73be41b commit 108b60a

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
@@ -420,7 +420,17 @@ controller_interface::CallbackReturn DiffDriveController::on_configure(
420420
"time, this message will only be shown once");
421421
msg->header.stamp = get_node()->get_clock()->now();
422422
}
423-
(void)received_velocity_msg_ptr_.bounded_push(std::move(msg));
423+
for (size_t i = 0; i < 5; ++i)
424+
{
425+
if (received_velocity_msg_ptr_.bounded_push(msg))
426+
{
427+
break;
428+
}
429+
RCLCPP_WARN(
430+
get_node()->get_logger(),
431+
"Velocity command could not be stored in the queue, trying again");
432+
std::this_thread::sleep_for(100us);
433+
}
424434
});
425435

426436
// initialize odometry publisher and message

0 commit comments

Comments
 (0)