Template Class ActionContext
Defined in File action_context.hpp
Class Documentation
-
template<typename ActionT>
class ActionContext Helper class that stores contextual information related to a ROS 2 action.
- Template Parameters:
ActionT – Type of the ROS 2 action interface.
Public Types
Public Functions
-
ActionContext(rclcpp::Logger logger)
Constructor.
—————— DEFINITIONS ——————
- Parameters:
logger – Logger instance of the action’s parent node.
Initialize the action context using the current goal handle.
- Parameters:
goal_handle_ptr – Action goal handle pointer.
-
void publishFeedback()
Publish the feedback written to the internal buffer.
You may access the internal buffer using getFeedbackPtr().
-
void succeed()
Terminate the current goal and mark it as succeeded.
The goal will be terminated using the internal actio result buffer, which you may access using getResultPtr().
-
void cancel()
Terminate the current goal and mark it as canceled.
The goal will be terminated using the internal actio result buffer, which you may access using getResultPtr().
-
void abort()
Terminate the current goal and mark it as aborted.
The goal will be terminated using the internal actio result buffer, which you may access using getResultPtr().
-
inline void invalidate()
Invalidate the goal handle managed by this ActionContext instance.
You must initialize the context using a new goal handle before you may call one of publishFeedback(), succeed(), cancel() or abort() again.
-
inline bool isValid()
Check if this ActionContext is valid (e.g. is managing a valid action goal handle).
- Returns:
trueif the context is ok,falseotherwise.
-
std::shared_ptr<GoalHandle> getGoalHandlePtr()
Get the goal handle managed by this ActionContext instance.
- Returns:
Current action goal handle.