|
| 1 | +# ROS Behavior Wrappers |
| 2 | + |
| 3 | +A base class is used to implement each Behavior type for a ROS Action, Service or Topic Publisher / Subscriber. |
| 4 | + |
| 5 | +Users are expected to create a derived class and can implement the following methods. |
| 6 | + |
| 7 | +# ROS Action Behavior Wrapper |
| 8 | + |
| 9 | +### bool setGoal(Goal& goal) |
| 10 | + |
| 11 | +Required callback that allows the user to set the goal message. |
| 12 | +Return false if the request should not be sent. In that case, RosActionNode::onFailure(INVALID_GOAL) will be called. |
| 13 | + |
| 14 | +### BT::NodeStatus onResultReceived(const WrappedResult& result) |
| 15 | + |
| 16 | +Required callback invoked when the result is received by the server. |
| 17 | +It is up to the user to define if the action returns SUCCESS or FAILURE. |
| 18 | + |
| 19 | +### BT::NodeStatus onFeedback(const std::shared_ptr<const Feedback> feedback) |
| 20 | + |
| 21 | +Optional callback invoked when the feedback is received. |
| 22 | +It generally returns RUNNING, but the user can also use this callback to cancel the current action and return SUCCESS or FAILURE. |
| 23 | + |
| 24 | +### BT::NodeStatus onFailure(ActionNodeErrorCode error) |
| 25 | + |
| 26 | +Optional callback invoked when something goes wrong. |
| 27 | +It must return either SUCCESS or FAILURE. |
| 28 | + |
| 29 | +### void onHalt() |
| 30 | + |
| 31 | +Optional callback executed when the node is halted. |
| 32 | +Note that cancelGoal() is done automatically. |
| 33 | + |
| 34 | +# ROS Service Behavior Wrapper |
| 35 | + |
| 36 | +### setRequest(typename Request::SharedPtr& request) |
| 37 | + |
| 38 | +Required callback that allows the user to set the request message (ServiceT::Request). |
| 39 | + |
| 40 | +### BT::NodeStatus onResponseReceived(const typename Response::SharedPtr& response) |
| 41 | + |
| 42 | +Required callback invoked when the response is received by the server. |
| 43 | +It is up to the user to define if this returns SUCCESS or FAILURE. |
| 44 | + |
| 45 | +### BT::NodeStatus onFailure(ServiceNodeErrorCode error) |
| 46 | + |
| 47 | +Optional callback invoked when something goes wrong; you can override it. |
| 48 | +It must return either SUCCESS or FAILURE. |
| 49 | + |
| 50 | +# ROS Topic Publisher Wrapper |
| 51 | + |
| 52 | +### bool setMessage(TopicT& msg) |
| 53 | + |
| 54 | +Required callback invoked in tick to allow the user to pass the message to be published. |
| 55 | + |
| 56 | +# ROS Topic Subscriber Wrapper |
| 57 | + |
| 58 | +### NodeStatus onTick(const std::shared_ptr<TopicT>& last_msg) |
| 59 | + |
| 60 | +Required callback invoked in the tick. You must return either SUCCESS of FAILURE. |
| 61 | + |
| 62 | +### bool latchLastMessage() |
| 63 | + |
| 64 | +Optional callback to latch the message that has been processed. |
| 65 | +If returns false and no new message is received, before next call there will be no message to process. |
| 66 | +If returns true, the next call will process the same message again, if no new message received. |
0 commit comments