C++ YASMIN (Yet Another State MachINe)
Loading...
Searching...
No Matches
FibonacciState Class Reference

Represents the action state for the Fibonacci action. More...

Inheritance diagram for FibonacciState:
Collaboration diagram for FibonacciState:

Public Member Functions

 FibonacciState ()
 Constructs a new FibonacciState object and initializes callbacks.
 
Fibonacci::Goal create_goal_handler (yasmin::Blackboard::SharedPtr blackboard)
 Callback for creating the Fibonacci action goal.
 
std::string response_handler (yasmin::Blackboard::SharedPtr blackboard, Fibonacci::Result::SharedPtr response)
 Callback for handling the action response.
 
void print_feedback (yasmin::Blackboard::SharedPtr blackboard, std::shared_ptr< const Fibonacci::Feedback > feedback)
 Callback for printing action feedback.
 
- Public Member Functions inherited from yasmin_ros::ActionState< Fibonacci >
 ActionState (const std::string &action_name, CreateGoalHandler create_goal_handler, const yasmin::Outcomes &outcomes, int wait_timeout=-1, int response_timeout=-1, int maximum_retry=3)
 Shared pointer type for ActionState.
 
 ActionState (const std::string &action_name, CreateGoalHandler create_goal_handler, const yasmin::Outcomes &outcomes, rclcpp::CallbackGroup::SharedPtr callback_group=nullptr, int wait_timeout=-1, int response_timeout=-1, int maximum_retry=3)
 Construct an ActionState with a specific action name and goal handler.
 
 ActionState (const std::string &action_name, CreateGoalHandler create_goal_handler, ResultHandler result_handler=nullptr, FeedbackHandler feedback_handler=nullptr, int wait_timeout=-1, int response_timeout=-1, int maximum_retry=3)
 Construct an ActionState with result and feedback handlers.
 
 ActionState (const std::string &action_name, CreateGoalHandler create_goal_handler, const yasmin::Outcomes &outcomes, ResultHandler result_handler=nullptr, FeedbackHandler feedback_handler=nullptr, int wait_timeout=-1, int response_timeout=-1, int maximum_retry=3)
 Construct an ActionState with outcomes and handlers.
 
 ActionState (const rclcpp::Node::SharedPtr &node, const std::string &action_name, CreateGoalHandler create_goal_handler, const yasmin::Outcomes &outcomes, ResultHandler result_handler=nullptr, FeedbackHandler feedback_handler=nullptr, rclcpp::CallbackGroup::SharedPtr callback_group=nullptr, int wait_timeout=-1, int response_timeout=-1, int maximum_retry=3)
 Construct an ActionState with a specified node and action name.
 
void cancel_state () override
 Cancel the current action state.
 
void cancel_done ()
 Notify that the action cancellation has completed.
 
std::string execute (yasmin::Blackboard::SharedPtr blackboard)
 Execute the action and return the outcome.
 
- Public Member Functions inherited from yasmin::State
 State (const Outcomes &outcomes)
 Shared pointer type for State.
 
virtual ~State ()=default
 Virtual destructor for proper polymorphic destruction.
 
bool is_idle () const noexcept
 Checks if the state is idle.
 
bool is_running () const noexcept
 Checks if the state is currently running.
 
bool is_canceled () const noexcept
 Checks if the state has been canceled.
 
bool is_completed () const noexcept
 Checks if the state has completed execution.
 
std::string operator() (Blackboard::SharedPtr blackboard)
 Executes the state and returns the outcome.
 
Outcomes const & get_outcomes () const noexcept
 Gets the set of possible outcomes for this state.
 
virtual std::string to_string () const
 Converts the state to a string representation.
 

Additional Inherited Members

- Protected Attributes inherited from yasmin_ros::ActionState< Fibonacci >
rclcpp::Node::SharedPtr node_
 Shared pointer to the ROS 2 node.
 
- Protected Attributes inherited from yasmin::State
Outcomes outcomes
 The possible outcomes of this state.
 

Detailed Description

Represents the action state for the Fibonacci action.

This class manages goal creation, response handling, and feedback processing for the Fibonacci action.

Constructor & Destructor Documentation

◆ FibonacciState()

FibonacciState::FibonacciState ( )
inline

Constructs a new FibonacciState object and initializes callbacks.

Member Function Documentation

◆ create_goal_handler()

Fibonacci::Goal FibonacciState::create_goal_handler ( yasmin::Blackboard::SharedPtr blackboard)
inline

Callback for creating the Fibonacci action goal.

Reads the order of the Fibonacci sequence from the blackboard.

Parameters
blackboardShared pointer to the blackboard.
Returns
The Fibonacci goal with the specified order.

◆ print_feedback()

void FibonacciState::print_feedback ( yasmin::Blackboard::SharedPtr blackboard,
std::shared_ptr< const Fibonacci::Feedback > feedback )
inline

Callback for printing action feedback.

Displays each new partial Fibonacci sequence number as it is received.

Parameters
blackboardShared pointer to the blackboard (not used in this method).
feedbackShared pointer to the feedback message with partial sequence.

◆ response_handler()

std::string FibonacciState::response_handler ( yasmin::Blackboard::SharedPtr blackboard,
Fibonacci::Result::SharedPtr response )
inline

Callback for handling the action response.

Stores the resulting Fibonacci sequence in the blackboard.

Parameters
blackboardShared pointer to the blackboard.
responseShared pointer to the action result containing the sequence.
Returns
The outcome status indicating success.

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