berkeleyauv / behavior_tree

ROS2 package for managing the AUV's behavior using BTCPP behavior trees.
10 stars 2 forks source link

Always [bt_engine-1] [ERROR] [1670381930.543971309] [bt_node]: Action server not available after waiting #5

Open lunanueva opened 1 year ago

lunanueva commented 1 year ago

What action server is waiting ??

I have fibonacci_service.cpp in plugin/action

include "std_srvs/srv/trigger.hpp"

include "behaviortree_cpp_v3/bt_factory.h"

include "behavior_tree/BtService.hpp"

using namespace BT; using FibonacciService = std_srvs::srv::Trigger;

class Fibonacci : public BtService { public: Fibonacci(const std::string & name, const BT::NodeConfiguration & config) : BtService(name, config) {}

FibonacciService::Request::SharedPtr populate_request() override { FibonacciService::Request::SharedPtr request; return request; }

BT::NodeStatus handle_response(FibonacciService::Response::SharedPtr response) override { RCLCPP_INFO(_node->get_logger(), "Service call complete: ", response->message); return BT::NodeStatus::SUCCESS; } };

BT_REGISTER_NODES(factory) { factory.registerNodeType("FibonacciService"); }

shonigmann commented 1 year ago

I know this is a bit of an old issue now, but I was just playing around with this and found that (at least in Humble) the test server I was using (action_tutorials_cpp fibonacci_action_server) defines a server with action type action_tutorials_interfaces::action::Fibonacci while the demo action client defined in this repo is looking for example_interfaces::action::Fibonacci. The contents of the action definition are identical, but presumably the type mismatch is enough to prevent the client from "finding" a valid server.

Editing Fibonacci.cpp and the CMakeLists.txt to replace example_interfaces with action_tutorials_interfaces resolved the issue, but you could also do the inverse and edit your server.

EDIT: the included fibonacci_action_server.py node should work without modification; I somehow missed that on first glance