Public Member Functions | Protected Attributes | Private Attributes | List of all members
Daemon Class Reference

#include <daemon.h>

Inheritance diagram for Daemon:
Inheritance graph
[legend]

Public Member Functions

bool CheckPassedTime ()
 
bool CheckRange (double lowerRange, double upperRange, double value, std::string msg_name)
 
bool CheckTopic (std::string str1, std::string str2)
 
bool CompareStrings (std::string str1, std::string str2)
 
std::string CreateTimestamp ()
 
void createTopicStructurePrefix ()
 
 Daemon ()
 
 Daemon (ros::NodeHandle *nh, std::string daemonName)
 
vda5050_msgs::Header GetHeader ()
 
std::vector< std::string > GetMsgList (std::map< std::string, std::string > topicList)
 
std::string GetParameter (std::string param)
 
std::string GetTopic (std::string hierarchical_topic)
 
std::map< std::string, std::string > GetTopicPublisherList ()
 
std::string getTopicStructurePrefix ()
 
std::map< std::string, std::string > GetTopicSubscriberList ()
 
void InitHeaderInfo ()
 
void LinkErrorTopics (ros::NodeHandle *nh)
 
void PublishState ()
 
std::map< std::string, std::string > ReadTopicParams (ros::NodeHandle *nh, std::string paramTopicName)
 
void UpdateHeader ()
 
void UpdateState ()
 

Protected Attributes

ros::Publisher errorPublisher
 
std::map< std::string, ros::PublishermessagePublisher
 
ros::NodeHandle nh
 
std::map< std::string, ros::Subscribersubscribers
 

Private Attributes

vda5050_msgs::Header messageHeader
 
std::string mqttTopicStructurePrefix
 
bool testMode
 
std::map< std::string, std::string > topicPublisherList
 
std::map< std::string, std::string > topicSubscriberList
 

Detailed Description

Model for all daemons. Every daemon provides some functionality to translate messages between the robot's internal communication and the VDA-5050-based client-server communication.

Definition at line 29 of file daemon.h.

Constructor & Destructor Documentation

◆ Daemon() [1/2]

Daemon::Daemon ( )

Default constructor for daemon objects. TODO: Do we need this?

Definition at line 30 of file src/daemon.cpp.

◆ Daemon() [2/2]

Daemon::Daemon ( ros::NodeHandle nh,
std::string  daemonName 
)

Constructor for daemon objects.

Parameters
nhROS node handle object.
daemonNameName of the daemon.

Definition at line 35 of file src/daemon.cpp.

Member Function Documentation

◆ CheckPassedTime()

bool Daemon::CheckPassedTime ( )

Calculates the passed time between last update interval and now.

Returns
Returns true if passed time since last publish is greater than 30 seconds, else returns false.

◆ CheckRange()

bool Daemon::CheckRange ( double  lowerRange,
double  upperRange,
double  value,
std::string  msg_name 
)

Check if a value is in given boundaries. If not, a warning is raised.

Parameters
lowerRangeLower limit of the variable.
upperRangeUpper limit of the variable.
valueValue to be checked.
msg_nameName of the message type.

Definition at line 134 of file src/daemon.cpp.

◆ CheckTopic()

bool Daemon::CheckTopic ( std::string  str1,
std::string  str2 
)

Checks if the second topic is a child topic of the first topic.

Parameters
str1Name of the first topic.
str2Name of the topic that might be a child topic of the other topic.

Definition at line 117 of file src/daemon.cpp.

◆ CompareStrings()

bool Daemon::CompareStrings ( std::string  str1,
std::string  str2 
)

Checks if the second string is contained in the first string.

Parameters
str1Some string.
str2Second string that might be a substring of the other string.

Definition at line 112 of file src/daemon.cpp.

◆ CreateTimestamp()

std::string Daemon::CreateTimestamp ( )

Create a timestamp string of the current instant.

Returns
Formatted timestamp.

Definition at line 204 of file src/daemon.cpp.

◆ createTopicStructurePrefix()

void Daemon::createTopicStructurePrefix ( )

Create the prefix of the topic structure.

Definition at line 87 of file src/daemon.cpp.

◆ GetHeader()

vda5050_msgs::Header Daemon::GetHeader ( )

Get the header of a ROS message. TODO which message is processed?

Returns
Header of the message.

Definition at line 106 of file src/daemon.cpp.

◆ GetMsgList()

std::vector< std::string > Daemon::GetMsgList ( std::map< std::string, std::string >  topicList)

Get all message types. This is achieved by reading in the message keys that are used in the topic config file.

Parameters
topicListAll topic keys and names as a map.
Returns
All message types as a vector of topic keys.

Definition at line 56 of file src/daemon.cpp.

◆ GetParameter()

std::string Daemon::GetParameter ( std::string  param)

Read a parameter from the ROS parameter server.

Parameters
paramKey of the parameter.
Returns
Value of the parameter.

Definition at line 64 of file src/daemon.cpp.

◆ GetTopic()

std::string Daemon::GetTopic ( std::string  hierarchical_topic)

Extract a topic string from a fully-qualified topic name.

Definition at line 128 of file src/daemon.cpp.

◆ GetTopicPublisherList()

std::map< std::string, std::string > Daemon::GetTopicPublisherList ( )

Get names of all published topics.

Returns
Map from topic keys to topic names.

Definition at line 46 of file src/daemon.cpp.

◆ getTopicStructurePrefix()

std::string Daemon::getTopicStructurePrefix ( )

Get the prefix of the topic structure.

Returns
Topic structure prefix.

Definition at line 95 of file src/daemon.cpp.

◆ GetTopicSubscriberList()

std::map< std::string, std::string > Daemon::GetTopicSubscriberList ( )

Get names of all subscribed topics.

Returns
Map from topic keys to topic names.

Definition at line 51 of file src/daemon.cpp.

◆ InitHeaderInfo()

void Daemon::InitHeaderInfo ( )

Initialize the message header. Message objects are used multiple times, so this only needs to be done once at startup.

Definition at line 79 of file src/daemon.cpp.

◆ LinkErrorTopics()

void Daemon::LinkErrorTopics ( ros::NodeHandle nh)

Link the error topics.

Parameters
nhPointer to the ROS node handle.

Definition at line 196 of file src/daemon.cpp.

◆ PublishState()

void Daemon::PublishState ( )

Fetches the header message and publishes the state message. Updates timestamp since last publishing.

◆ ReadTopicParams()

std::map< std::string, std::string > Daemon::ReadTopicParams ( ros::NodeHandle nh,
std::string  paramTopicName 
)

Read in the user-specified topic names. The user can specify names for the topics that contain the needed information. For mapping the contents to the topic names, this method scans the parameter server.

Parameters
nhPointer to the ROS node handle.
paramTopicNameName of the param family to scan through.
Returns
Map from topic descriptor to user-defined topic name.

Definition at line 164 of file src/daemon.cpp.

◆ UpdateHeader()

void Daemon::UpdateHeader ( )

Update the message header for the next publish. This includes updating the timestamp of the message.

Definition at line 100 of file src/daemon.cpp.

◆ UpdateState()

void Daemon::UpdateState ( )

Checks all the logic within the state daemon. For example, it checks if 30 seconds have passed without update.

Member Data Documentation

◆ errorPublisher

ros::Publisher Daemon::errorPublisher
protected

ROS Publisher for error messages.

Definition at line 64 of file daemon.h.

◆ messageHeader

vda5050_msgs::Header Daemon::messageHeader
private

TODO: is this variable even used?

Definition at line 32 of file daemon.h.

◆ messagePublisher

std::map<std::string,ros::Publisher> Daemon::messagePublisher
protected

All publishers the daemon uses. Map from topic keys to ROS Publisher objects.

Definition at line 54 of file daemon.h.

◆ mqttTopicStructurePrefix

std::string Daemon::mqttTopicStructurePrefix
private

Prefix that should be placed at the beginning of the MQTT topics.

Definition at line 45 of file daemon.h.

◆ nh

ros::NodeHandle Daemon::nh
protected

ROS node handle, needed to call ROS functions.

Definition at line 67 of file daemon.h.

◆ subscribers

std::map<std::string,ros::Subscriber> Daemon::subscribers
protected

All subscribers the daemon uses. Map from topic keys to ROS Subscriber objects.

Definition at line 59 of file daemon.h.

◆ testMode

bool Daemon::testMode
private

Toggle for test/debugging mode.

Definition at line 49 of file daemon.h.

◆ topicPublisherList

std::map<std::string,std::string> Daemon::topicPublisherList
private

All topics to publish on. Map from topic keys to user-defined topic names.

Definition at line 35 of file daemon.h.

◆ topicSubscriberList

std::map<std::string,std::string> Daemon::topicSubscriberList
private

All topics to subscribe to. Map from topic keys to user-defined topic names.

Definition at line 40 of file daemon.h.


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


vda5050_connector
Author(s): Florian Rothmeyer , Florian Spiegel
autogenerated on Wed Mar 22 2023 02:38:56