![]() |
template_pkg
1.0.0
A template ROS2 Package
|
A class for serial communication in a ROS2 context. More...
#include <serial_connection.hpp>
Classes | |
struct | Params |
Configuration parameters for the SerialConnection. More... | |
Public Member Functions | |
SerialConnection (rclcpp::Node::SharedPtr node) | |
Constructor for SerialConnection. | |
void | serialCallback (const std::vector< byte > &datagram) |
Callback function for handling received serial data. | |
void | sendToDevice (const io_interfaces::msg::RawPacket msg) |
Sends data to the connected serial device. | |
void | spin_once () |
Performs a single iteration of the ROS 2 spin loop. | |
![]() | |
IoConnection (rclcpp::Node::SharedPtr node) | |
Protected Attributes | |
rclcpp::TimerBase::SharedPtr | timer_ |
std::shared_ptr< transport::LspSerial > | serial_ptr_ |
rclcpp::Publisher< io_interfaces::msg::RawPacket >::SharedPtr | raw_pub_ |
rclcpp::Subscription< io_interfaces::msg::RawPacket >::SharedPtr | raw_sub_ |
Params | params_ |
![]() | |
rclcpp::Node::SharedPtr | node_ptr_ |
std::shared_ptr< transport::LspSerial > | trasnport_ptr_ |
Additional Inherited Members | |
![]() | |
typedef std::shared_ptr< IoConnection > | SharedPtr |
A class for serial communication in a ROS2 context.
This class handles serial communication within a ROS2 node, using the LspSerial class for the actual serial communication. It subscribes to messages to be sent to the device and publishes messages received from the device.
SerialConnection::SerialConnection | ( | rclcpp::Node::SharedPtr | node | ) |
Constructor for SerialConnection.
node | Shared pointer to the ROS2 node. |
void SerialConnection::sendToDevice | ( | const io_interfaces::msg::RawPacket | msg | ) |
Sends data to the connected serial device.
msg | The message containing the data to be sent. |
void SerialConnection::serialCallback | ( | const std::vector< byte > & | datagram | ) |
Callback function for handling received serial data.
datagram | The received data as a vector of bytes. |
void SerialConnection::spin_once | ( | ) |
Performs a single iteration of the ROS 2 spin loop.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |