C++ YASMIN (Yet Another State MachINe)
Loading...
Searching...
No Matches
yasmin_ros Namespace Reference

Namespaces

namespace  basic_outcomes
 Provides common outcome constants for ROS 2.

Classes

class  ActionState
 A state class for handling ROS 2 action client operations. More...
class  GetParametersState
 State that retrieves parameters from the ROS 2 parameter server. More...
class  MonitorState
 Template class to monitor a ROS 2 topic and process incoming messages. More...
class  PublisherState
 Template class to publish ROS 2 messages. More...
class  ROSClientsCache
 Centralized cache for managing ROS 2 client objects. More...
class  RosDeserializeCppState
 A state for deserializing ROS 2 messages into C++ objects. More...
class  RosSerializeCppState
 A state for serializing C++ objects into ROS 2 messages. More...
class  ServiceState
 A state class that interacts with a ROS 2 service. More...
struct  InterfaceSerializationHandler
 A structure to hold the serialization handlers for a specific interface type. More...
class  TfBufferState
 State that creates a tf2 buffer and transform listener. More...
class  YasminNode
 A ROS 2 node for managing and handling YASMIN-based applications. More...

Functions

template<typename InterfaceT>
std::vector< uint8_t > serialize_interface (const InterfaceT &interface_value)
 Serialize a ROS 2 interface instance to a byte array.
template<typename InterfaceT>
InterfaceT deserialize_interface (const std::vector< uint8_t > &serialized_data)
 Deserialize a ROS 2 interface instance from a byte array.
void set_ros_loggers (rclcpp::Node::SharedPtr node=nullptr)
 Sets the logging functions for ROS, linking ROS 2 log levels to YASMIN loggers.
const std::unordered_map< std::string, InterfaceSerializationHandler > & get_supported_interface_serialization_handlers ()
 Get the map of supported interface serialization handlers.
bool is_supported_interface_type (const std::string &interface_type)
 Check if a given interface type is supported for serialization.
const InterfaceSerializationHandler & get_interface_serialization_handler (const std::string &interface_type)
 Get the serialization handler for a specific interface type.
std::vector< std::string > get_supported_interface_types ()
 Get a list of supported interface types for serialization.
void ros_log_message (yasmin::LogLevel level, const char *file, const char *function, int line, const char *text)
 Generalized logging function.

Variables

rclcpp::Node * logger_node = nullptr
 Node used in the YASMIN ROS 2 logs.

Function Documentation

◆ deserialize_interface()

template<typename InterfaceT>
InterfaceT yasmin_ros::deserialize_interface ( const std::vector< uint8_t > & serialized_data)

Deserialize a ROS 2 interface instance from a byte array.

Template Parameters
InterfaceTROS 2 message, service request/response, or action goal/result/feedback type.
Parameters
serialized_dataSerialized byte array.
Returns
Deserialized interface instance.

◆ get_interface_serialization_handler()

const InterfaceSerializationHandler & yasmin_ros::get_interface_serialization_handler ( const std::string & interface_type)

Get the serialization handler for a specific interface type.

Parameters
interface_typeThe type of the interface to get the handler for.
Returns
A reference to the InterfaceSerializationHandler for the specified interface type.
Exceptions
std::invalid_argumentif the interface type is not supported.

◆ get_supported_interface_serialization_handlers()

const std::unordered_map< std::string, InterfaceSerializationHandler > & yasmin_ros::get_supported_interface_serialization_handlers ( )

Get the map of supported interface serialization handlers.

Returns
A reference to the unordered map containing interface types and their corresponding serialization handlers.

◆ get_supported_interface_types()

std::vector< std::string > yasmin_ros::get_supported_interface_types ( )

Get a list of supported interface types for serialization.

Returns
A vector of strings containing the supported interface types.

◆ is_supported_interface_type()

bool yasmin_ros::is_supported_interface_type ( const std::string & interface_type)

Check if a given interface type is supported for serialization.

Parameters
interface_typeThe type of the interface to check.
Returns
true if the interface type is supported, false otherwise.

◆ ros_log_message()

void yasmin_ros::ros_log_message ( yasmin::LogLevel level,
const char * file,
const char * function,
int line,
const char * text )

Generalized logging function.

Parameters
levelThe log level as a yasmin::LogLevel (e.g., "ERROR", "WARN", "INFO", "DEBUG").
fileThe source file where the log function is called.
functionThe function where the log function is called.
lineThe line number in the source file.
textThe format string for the log message.
argsAdditional arguments for the format string.

◆ serialize_interface()

template<typename InterfaceT>
std::vector< uint8_t > yasmin_ros::serialize_interface ( const InterfaceT & interface_value)

Serialize a ROS 2 interface instance to a byte array.

Template Parameters
InterfaceTROS 2 message, service request/response, or action goal/result/feedback type.
Parameters
interface_valueThe interface instance to serialize.
Returns
Serialized byte array.

◆ set_ros_loggers()

void yasmin_ros::set_ros_loggers ( rclcpp::Node::SharedPtr node = nullptr)

Sets the logging functions for ROS, linking ROS 2 log levels to YASMIN loggers.

This function configures YASMIN to use ROS 2 logging mechanisms for error, warning, info, and debug levels, ensuring messages from YASMIN are routed through ROS 2 loggers.

Parameters
nodeROS 2 node to use as logger node. If null, use YasminNode.
Note
This function should be called once to set up the loggers before any logging occurs within YASMIN components.

Variable Documentation

◆ logger_node

rclcpp::Node * yasmin_ros::logger_node = nullptr

Node used in the YASMIN ROS 2 logs.