|
C++ YASMIN (Yet Another State MachINe)
|
#include <iostream>#include <memory>#include <string>#include "example_interfaces/srv/add_two_ints.hpp"#include "rclcpp/rclcpp.hpp"#include "yasmin/cb_state.hpp"#include "yasmin/logs.hpp"#include "yasmin/state_machine.hpp"#include "yasmin_ros/basic_outcomes.hpp"#include "yasmin_ros/ros_logs.hpp"#include "yasmin_ros/service_state.hpp"#include "yasmin_viewer/yasmin_viewer_pub.hpp"
Classes | |
| class | AddTwoIntsState |
| State for calling the AddTwoInts service in ROS 2. More... | |
Functions | |
| std::string | set_ints (std::shared_ptr< yasmin::blackboard::Blackboard > blackboard) |
| Sets two integer values in the blackboard. | |
| std::string | print_sum (std::shared_ptr< yasmin::blackboard::Blackboard > blackboard) |
| Prints the sum stored in the blackboard. | |
| int | main (int argc, char *argv[]) |
| Main function to initialize and run the state machine. | |
| int main | ( | int | argc, |
| char * | argv[] ) |
Main function to initialize and run the state machine.
Sets up logging, initializes ROS 2, and defines a state machine with three states.
| argc | Argument count. |
| argv | Argument vector. |
| std::string print_sum | ( | std::shared_ptr< yasmin::blackboard::Blackboard > | blackboard | ) |
Prints the sum stored in the blackboard.
Retrieves the integer "sum" from the blackboard and prints it.
| blackboard | Shared pointer to the blackboard for getting values. |
| std::string set_ints | ( | std::shared_ptr< yasmin::blackboard::Blackboard > | blackboard | ) |
Sets two integer values in the blackboard.
Sets the integers "a" and "b" in the blackboard with values 10 and 5, respectively.
| blackboard | Shared pointer to the blackboard for setting values. |