AutoAPMS
Resilient Robot Mission Management
Loading...
Searching...
No Matches
ActionContext< ActionT > Class Template Reference

Helper class that stores contextual information related to a ROS 2 action. More...

#include <auto_apms_util/action_context.hpp>

Public Member Functions

 ActionContext (rclcpp::Logger logger)
 Constructor.
 
void setUp (std::shared_ptr< GoalHandle > goal_handle_ptr)
 Initialize the action context using the current goal handle.
 
void publishFeedback ()
 Publish the feedback written to the internal buffer.
 
void succeed ()
 Terminate the current goal and mark it as succeeded.
 
void cancel ()
 Terminate the current goal and mark it as canceled.
 
void abort ()
 Terminate the current goal and mark it as aborted.
 
void invalidate ()
 Invalidate the goal handle managed by this ActionContext instance.
 
bool isValid ()
 Check if this ActionContext is valid (e.g. is managing a valid action goal handle).
 
std::shared_ptr< GoalHandle > getGoalHandlePtr ()
 Get the goal handle managed by this ActionContext instance.
 
std::shared_ptr< Feedback > getFeedbackPtr ()
 Access the internal action feedback buffer.
 
std::shared_ptr< Result > getResultPtr ()
 Access the internal action result buffer.
 

Detailed Description

template<typename ActionT>
class auto_apms_util::ActionContext< ActionT >

Helper class that stores contextual information related to a ROS 2 action.

Template Parameters
ActionTType of the ROS 2 action interface.

Definition at line 28 of file action_context.hpp.

Constructor & Destructor Documentation

◆ ActionContext()

template<class ActionT>
ActionContext ( rclcpp::Logger logger)

Constructor.

Parameters
loggerLogger instance of the action's parent node.

---------------— DEFINITIONS ---------------—

Definition at line 121 of file action_context.hpp.

Member Function Documentation

◆ setUp()

template<class ActionT>
void setUp ( std::shared_ptr< GoalHandle > goal_handle_ptr)

Initialize the action context using the current goal handle.

Parameters
goal_handle_ptrAction goal handle pointer.

Definition at line 126 of file action_context.hpp.

◆ publishFeedback()

template<class ActionT>
void publishFeedback ( )

Publish the feedback written to the internal buffer.

You may access the internal buffer using getFeedbackPtr().

Definition at line 134 of file action_context.hpp.

◆ succeed()

template<class ActionT>
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().

Definition at line 150 of file action_context.hpp.

◆ cancel()

template<class ActionT>
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().

Definition at line 161 of file action_context.hpp.

◆ abort()

template<class ActionT>
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().

Definition at line 172 of file action_context.hpp.

◆ invalidate()

template<typename ActionT>
void invalidate ( )
inline

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.

Definition at line 183 of file action_context.hpp.

◆ isValid()

template<typename ActionT>
bool isValid ( )
inline

Check if this ActionContext is valid (e.g. is managing a valid action goal handle).

Returns
true if the context is ok, false otherwise.

Definition at line 189 of file action_context.hpp.

◆ getGoalHandlePtr()

template<class ActionT>
std::shared_ptr< typename ActionContext< ActionT >::GoalHandle > getGoalHandlePtr ( )

Get the goal handle managed by this ActionContext instance.

Returns
Current action goal handle.

Definition at line 195 of file action_context.hpp.

◆ getFeedbackPtr()

template<typename ActionT>
std::shared_ptr< typename ActionContext< ActionT >::Feedback > getFeedbackPtr ( )
inline

Access the internal action feedback buffer.

Returns
Shared pointer of the feedback data structure.

Definition at line 206 of file action_context.hpp.

◆ getResultPtr()

template<typename ActionT>
std::shared_ptr< typename ActionContext< ActionT >::Result > getResultPtr ( )
inline

Access the internal action result buffer.

Returns
Shared pointer of the result data structure.

Definition at line 212 of file action_context.hpp.


The documentation for this class was generated from the following file: