Fixed path_buffer waiting for a-star to finish

This commit is contained in:
2025-05-02 19:00:34 +02:00
parent ed9c5bab45
commit a160af8de3

View File

@ -2,6 +2,9 @@
#include <glm/gtx/norm.hpp>
#include <chrono>
using namespace std::chrono_literals;
namespace mg {
PathBuffer::PathBuffer(rclcpp::Node* node) : current(-1), node_(node) {
@ -20,7 +23,6 @@ namespace mg {
&& glm::distance2(pos, IdToCoords(path_msg_->indicies[current])) < lookahead * lookahead) {
current++;
}
if (current == (int)path_msg_->indicies.size()) {
double best = 10000000;
int id = 0;
@ -46,7 +48,7 @@ namespace mg {
req->y = goal_->y;
resp_ = client_->async_send_request(req).share();
}
if (resp_.valid()) {
if (resp_.wait_for(0s) == std::future_status::ready) {
path_msg_ = resp_.get();
auto req = std::make_shared<PathService::Request>();