C++ YASMIN (Yet Another State MachINe)
Loading...
Searching...
No Matches
service_client_demo.cpp File Reference
#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"
Include dependency graph for service_client_demo.cpp:

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.
 

Function Documentation

◆ main()

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.

Parameters
argcArgument count.
argvArgument vector.
Returns
int Exit code indicating success or failure.

◆ print_sum()

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.

Parameters
blackboardShared pointer to the blackboard for getting values.
Returns
std::string Outcome indicating success.

◆ set_ints()

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.

Parameters
blackboardShared pointer to the blackboard for setting values.
Returns
std::string Outcome indicating success or failure.