template_pkg  1.0.0
A template ROS2 Package
Loading...
Searching...
No Matches
roship_io::connection::SerialConnection Class Reference

A class for serial communication in a ROS2 context. More...

#include <serial_connection.hpp>

Inheritance diagram for roship_io::connection::SerialConnection:
Collaboration diagram for roship_io::connection::SerialConnection:

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.
 
- Public Member Functions inherited from roship_io::connection::IoConnection< transport::LspSerial >
 IoConnection (rclcpp::Node::SharedPtr node)
 

Protected Attributes

rclcpp::TimerBase::SharedPtr timer_
 
std::shared_ptr< transport::LspSerialserial_ptr_
 
rclcpp::Publisher< io_interfaces::msg::RawPacket >::SharedPtr raw_pub_
 
rclcpp::Subscription< io_interfaces::msg::RawPacket >::SharedPtr raw_sub_
 
Params params_
 
- Protected Attributes inherited from roship_io::connection::IoConnection< transport::LspSerial >
rclcpp::Node::SharedPtr node_ptr_
 
std::shared_ptr< transport::LspSerialtrasnport_ptr_
 

Additional Inherited Members

- Public Types inherited from roship_io::connection::IoConnection< transport::LspSerial >
typedef std::shared_ptr< IoConnectionSharedPtr
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ SerialConnection()

SerialConnection::SerialConnection ( rclcpp::Node::SharedPtr node)

Constructor for SerialConnection.

Parameters
nodeShared pointer to the ROS2 node.

Member Function Documentation

◆ sendToDevice()

void SerialConnection::sendToDevice ( const io_interfaces::msg::RawPacket msg)

Sends data to the connected serial device.

Parameters
msgThe message containing the data to be sent.

◆ serialCallback()

void SerialConnection::serialCallback ( const std::vector< byte > & datagram)

Callback function for handling received serial data.

Parameters
datagramThe received data as a vector of bytes.

◆ spin_once()

void SerialConnection::spin_once ( )

Performs a single iteration of the ROS 2 spin loop.

Member Data Documentation

◆ params_

Params roship_io::connection::SerialConnection::params_
protected

◆ raw_pub_

rclcpp::Publisher<io_interfaces::msg::RawPacket>::SharedPtr roship_io::connection::SerialConnection::raw_pub_
protected

◆ raw_sub_

rclcpp::Subscription<io_interfaces::msg::RawPacket>::SharedPtr roship_io::connection::SerialConnection::raw_sub_
protected

◆ serial_ptr_

std::shared_ptr<transport::LspSerial> roship_io::connection::SerialConnection::serial_ptr_
protected

◆ timer_

rclcpp::TimerBase::SharedPtr roship_io::connection::SerialConnection::timer_
protected

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