Robotics StackExchange | Archived questions

async_cancel_goal thread not exiting

My specific project requires me to cancel the previous action goal before I can send a new one. Therefor im calling asynccancelgoal with the currently running goal handle. No matter what I do the new thread never returns. Specifically in my code:

    auto cancel_result_future = this->client_ptr_->async_cancel_goal(this->goal_handle_);
    switch (cancel_result_future.wait_for(std::chrono::milliseconds(100))) {
        case std::future_status::deferred:
            std::cerr << "deferred" << std::endl;
            break;
        case std::future_status::timeout:
            std::cerr << "timeout" << std::endl;
            break;
        case std::future_status::ready:
            std::cerr << "ready!" << std::endl;
            break;
    }

it always prints "timeout" instead of "ready!". I've tried multiple things like a multi threaded executor. The only strange thing I noticed is that my result_callback receives a result code of unknow instead of the expected canceled status. Might this be a problem with my action server? In case it is needed I uploaded a copy of both the client and the server here.

Asked by iehfned on 2023-08-01 02:36:34 UTC

Comments

Answers