diff --git a/mg_navigation/src/path_buffer.cpp b/mg_navigation/src/path_buffer.cpp index 09776a1..41ab424 100644 --- a/mg_navigation/src/path_buffer.cpp +++ b/mg_navigation/src/path_buffer.cpp @@ -2,6 +2,9 @@ #include +#include +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();