ROS2Sonic  0.2.0
A ROS2 driver for R2Sonic MBES
Loading...
Searching...
No Matches
r2sonic::R2SonicNode Class Reference

The rclcpp::Node representing the connection between ROS and the R2Sonic Unit. More...

#include <r2sonic_node.hpp>

Inheritance diagram for r2sonic::R2SonicNode:
Collaboration diagram for r2sonic::R2SonicNode:

Classes

struct  MsgBuffer
 a container for the messages we want to buffer More...
 
struct  msgMtx_
 a colleciton of rosmessageg publisher and a mutex grouped for convienence. More...
 
struct  Parameters
 a Structure that corresponds to the parameters advertised by the R2SonicNode class. All params assoicated with this struct will have the same structure struct. Example: topics.detections member mapps to param "topics/detections" More...
 

Public Member Functions

 R2SonicNode ()
 
void publish (packets::BTH0 &r2_packet)
 Publishes all ros2 messages corresponding to a received BTH0 Packet.
 
void publish (packets::AID0 &aid0_packet)
 Publishes all ros2 messages corresponding to a received AID0 Packet.
 
const ParametersgetParams ()
 gets a referenence to the r2sonic::R2SonicNode::Parameters
 
template<typename T >
void cleanMsgMap (msgMap< T > *msg_map, u32 ping_no)
 

Protected Types

template<typename T >
using msgMtx = msgMtx_<T, T>
 Typedef for a single message, useful if you don't need to assemble multiple packets.
 
template<typename T >
using msgMap = std::map<u32, T>
 This typedef is useful for messages that need to be assmebled from multiple packets.
 
template<typename T >
using msgMtxMap = msgMtx_< T, msgMap<T> >
 Creates a msgMtx with a map of messages for assembling multiple packets into one ros message.
 

Protected Member Functions

template<typename T >
void cleanMsgMap (msgMap< T > *msg_map, u32 ping_no)
 removes incomplete messages from the map if they are too old based on the ping_number
 
bool shouldAdvertise (std::string topic)
 Holds the conditions that determine if the a tiopic should be advertised.
 
bool shouldPublish (rclcpp::PublisherBase::SharedPtr pub)
 Checks to see if there are any subscribers to a topic before computing and publishing it.
 

Protected Attributes

Parameters parameters_
 potected storage for parametrs
 
struct r2sonic::R2SonicNode::MsgBuffer msg_buffer_
 

Detailed Description

The rclcpp::Node representing the connection between ROS and the R2Sonic Unit.

Member Typedef Documentation

◆ msgMap

template<typename T >
using r2sonic::R2SonicNode::msgMap = std::map<u32, T>
protected

This typedef is useful for messages that need to be assmebled from multiple packets.

◆ msgMtx

template<typename T >
using r2sonic::R2SonicNode::msgMtx = msgMtx_<T, T>
protected

Typedef for a single message, useful if you don't need to assemble multiple packets.

◆ msgMtxMap

template<typename T >
using r2sonic::R2SonicNode::msgMtxMap = msgMtx_< T, msgMap<T> >
protected

Creates a msgMtx with a map of messages for assembling multiple packets into one ros message.

Constructor & Destructor Documentation

◆ R2SonicNode()

R2SonicNode::R2SonicNode ( )

Member Function Documentation

◆ cleanMsgMap() [1/2]

template<typename T >
void r2sonic::R2SonicNode::cleanMsgMap ( msgMap< T > * msg_map,
u32 ping_no )
protected

removes incomplete messages from the map if they are too old based on the ping_number

Parameters
msg_map
ping_no

◆ cleanMsgMap() [2/2]

template<typename T >
void r2sonic::R2SonicNode::cleanMsgMap ( msgMap< T > * msg_map,
u32 ping_no )

◆ getParams()

const Parameters & r2sonic::R2SonicNode::getParams ( )
inline

gets a referenence to the r2sonic::R2SonicNode::Parameters

Returns
the parameters associated with the node

◆ publish() [1/2]

void R2SonicNode::publish ( packets::AID0 & aid0_packet)

Publishes all ros2 messages corresponding to a received AID0 Packet.

Parameters
Publishesall ros2 messages corresponding to a received AID0 Packet.

◆ publish() [2/2]

void R2SonicNode::publish ( packets::BTH0 & r2_packet)

Publishes all ros2 messages corresponding to a received BTH0 Packet.

Parameters
Publishesall ros2 messages corresponding to a received BTH0 Packet.

◆ shouldAdvertise()

bool R2SonicNode::shouldAdvertise ( std::string topic)
protected

Holds the conditions that determine if the a tiopic should be advertised.

Parameters
topicthe topic you want to test
Returns
true if you should advertise it

◆ shouldPublish()

bool R2SonicNode::shouldPublish ( rclcpp::PublisherBase::SharedPtr pub)
protected

Checks to see if there are any subscribers to a topic before computing and publishing it.

Parameters
pubthe publisher you want to check
Returns
true if you should publish on that publisher (e.g. has subscribers)

Member Data Documentation

◆ msg_buffer_

struct r2sonic::R2SonicNode::MsgBuffer r2sonic::R2SonicNode::msg_buffer_
protected

◆ parameters_

Parameters r2sonic::R2SonicNode::parameters_
protected

potected storage for parametrs


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