template_pkg  1.0.0
A template ROS2 Package
Loading...
Searching...
No Matches
template_pkg::MinimalPublisherNode Class Reference

a minimal publisher class that extends the rclcpp::Node class to demonstrate how to create ROS2 Node More...

#include <minimal_publisher_node.hpp>

Inheritance diagram for template_pkg::MinimalPublisherNode:
Collaboration diagram for template_pkg::MinimalPublisherNode:

Public Member Functions

 MinimalPublisherNode ()
 Construct a new Minimal Publisher object.
 

Protected Member Functions

void timer_callback ()
 Callback function for the timer.
 

Protected Attributes

std::string message_
 
rclcpp::TimerBase::SharedPtr timer_
 Shared pointer to the timer.
 
rclcpp::Publisher< std_msgs::msg::String >::SharedPtr publisher_
 Shared pointer to the publisher.
 
size_t count_
 Counter for the number of messages published.
 

Detailed Description

a minimal publisher class that extends the rclcpp::Node class to demonstrate how to create ROS2 Node

This class is used to create a ROS2 publisher that regularly publishes messages to a topic.

Constructor & Destructor Documentation

◆ MinimalPublisherNode()

NS_HEAD MinimalPublisherNode::MinimalPublisherNode ( )

Construct a new Minimal Publisher object.

The constructor initializes the publisher and timer.

Member Function Documentation

◆ timer_callback()

void MinimalPublisherNode::timer_callback ( )
protected

Callback function for the timer.

This function is called periodically by the timer. It publishes a message containing a string with a counter.

Member Data Documentation

◆ count_

size_t template_pkg::MinimalPublisherNode::count_
protected

Counter for the number of messages published.

◆ message_

std::string template_pkg::MinimalPublisherNode::message_
protected

◆ publisher_

rclcpp::Publisher<std_msgs::msg::String>::SharedPtr template_pkg::MinimalPublisherNode::publisher_
protected

Shared pointer to the publisher.

◆ timer_

rclcpp::TimerBase::SharedPtr template_pkg::MinimalPublisherNode::timer_
protected

Shared pointer to the timer.


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