SMACC2
Loading...
Searching...
No Matches
cl_generic_sensor::ClGenericSensor< MessageType > Class Template Reference

#include <cl_generic_sensor.hpp>

Inheritance diagram for cl_generic_sensor::ClGenericSensor< MessageType >:
Inheritance graph
Collaboration diagram for cl_generic_sensor::ClGenericSensor< MessageType >:
Collaboration graph

Public Types

typedef MessageType TMessageType
 

Public Member Functions

 ClGenericSensor ()
 
 ClGenericSensor (std::string topicName)
 
 ClGenericSensor (std::string topicName, rclcpp::Duration timeout)
 
virtual ~ClGenericSensor ()
 
template<typename TOrthogonal , typename TClient >
void onComponentInitialization ()
 
void setTopicName (const std::string &topicName)
 
void setTimeout (const rclcpp::Duration &timeout)
 
- Public Member Functions inherited from smacc2::ISmaccClient
 ISmaccClient ()
 
virtual ~ISmaccClient ()
 
virtual void onInitialize ()
 
virtual std::string getName () const
 
template<typename TComponent >
TComponent * getComponent ()
 
template<typename TComponent >
TComponent * getComponent (std::string name)
 
template<typename TComponent >
TComponent * getComponent (int index)
 
virtual smacc2::introspection::TypeInfo::Ptr getType ()
 
ISmaccStateMachinegetStateMachine ()
 
template<typename TSmaccSignal , typename T >
void connectSignal (TSmaccSignal &signal, void(T::*callback)(), T *object)
 
template<typename SmaccClientType >
void requiresClient (SmaccClientType *&storage)
 
void getComponents (std::vector< std::shared_ptr< ISmaccComponent > > &components)
 
const std::vector< std::shared_ptr< ISmaccComponent > > & iterateComponents () const
 
template<typename EventType >
void postEvent (const EventType &ev)
 
template<typename EventType >
void postEvent ()
 

Public Attributes

std::optional< std::string > topicName_
 
std::optional< rclcpp::Duration > timeout_
 

Additional Inherited Members

- Protected Member Functions inherited from smacc2::ISmaccClient
template<typename TOrthogonal , typename TClient >
void onComponentInitialization ()
 
template<typename TOrthogonal , typename TSourceObject >
void onStateOrthogonalAllocation ()
 
template<typename SmaccComponentType , typename TOrthogonal , typename TClient , typename... TArgs>
SmaccComponentType * createComponent (TArgs... targs)
 
template<typename SmaccComponentType , typename TOrthogonal , typename TClient , typename... TArgs>
SmaccComponentType * createNamedComponent (std::string name, TArgs... targs)
 
rclcpp::Node::SharedPtr getNode ()
 
rclcpp::Logger getLogger ()
 
- Protected Attributes inherited from smacc2::ISmaccClient
std::map< ComponentKey, std::shared_ptr< smacc2::ISmaccComponent > > components_
 

Detailed Description

template<typename MessageType>
class cl_generic_sensor::ClGenericSensor< MessageType >

Definition at line 31 of file cl_generic_sensor.hpp.

Member Typedef Documentation

◆ TMessageType

template<typename MessageType >
MessageType cl_generic_sensor::ClGenericSensor< MessageType >::TMessageType

Definition at line 34 of file cl_generic_sensor.hpp.

Constructor & Destructor Documentation

◆ ClGenericSensor() [1/3]

template<typename MessageType >
cl_generic_sensor::ClGenericSensor< MessageType >::ClGenericSensor ( )
inline

Definition at line 42 of file cl_generic_sensor.hpp.

42{}

◆ ClGenericSensor() [2/3]

template<typename MessageType >
cl_generic_sensor::ClGenericSensor< MessageType >::ClGenericSensor ( std::string topicName)
inline

Definition at line 45 of file cl_generic_sensor.hpp.

45: topicName_(topicName) {}
std::optional< std::string > topicName_

◆ ClGenericSensor() [3/3]

template<typename MessageType >
cl_generic_sensor::ClGenericSensor< MessageType >::ClGenericSensor ( std::string topicName,
rclcpp::Duration timeout )
inline

Definition at line 48 of file cl_generic_sensor.hpp.

49 : topicName_(topicName), timeout_(timeout)
50 {
51 }
std::optional< rclcpp::Duration > timeout_

◆ ~ClGenericSensor()

template<typename MessageType >
virtual cl_generic_sensor::ClGenericSensor< MessageType >::~ClGenericSensor ( )
inlinevirtual

Definition at line 53 of file cl_generic_sensor.hpp.

53{}

Member Function Documentation

◆ onComponentInitialization()

template<typename MessageType >
template<typename TOrthogonal , typename TClient >
void cl_generic_sensor::ClGenericSensor< MessageType >::onComponentInitialization ( )
inline

Definition at line 59 of file cl_generic_sensor.hpp.

60 {
61 RCLCPP_INFO(getLogger(), "[ClGenericSensor] Initializing component-based sensor client");
62
63 // Create the topic subscriber component
64 // This component handles ROS topic subscription and posts SMACC events
65 if (!topicName_)
66 {
67 RCLCPP_ERROR(
68 getLogger(),
69 "[ClGenericSensor] Topic name not set. Please configure topicName_ before "
70 "initialization.");
71 return;
72 }
73
74 this->createComponent<
76 *topicName_);
77
78 RCLCPP_INFO(
79 getLogger(), "[ClGenericSensor] Created CpTopicSubscriber for topic: %s",
80 topicName_->c_str());
81
82 // Create the message timeout component (optional - only if timeout is configured)
83 // This component monitors message reception and posts timeout events
84 if (timeout_)
85 {
86 auto timeoutComponent = this->createComponent<
89
90 // Configure the timeout duration
91 timeoutComponent->timeout_ = timeout_;
92
93 RCLCPP_INFO(
94 getLogger(), "[ClGenericSensor] Created CpMessageTimeout with duration: %f seconds",
95 timeout_->seconds());
96 }
97 else
98 {
99 RCLCPP_INFO(
100 getLogger(), "[ClGenericSensor] Timeout not configured - watchdog functionality disabled");
101 }
102 }
rclcpp::Logger getLogger()
SmaccComponentType * createComponent(TArgs... targs)

References smacc2::ISmaccClient::createComponent(), smacc2::ISmaccClient::getLogger(), cl_generic_sensor::ClGenericSensor< MessageType >::timeout_, and cl_generic_sensor::ClGenericSensor< MessageType >::topicName_.

Here is the call graph for this function:

◆ setTimeout()

template<typename MessageType >
void cl_generic_sensor::ClGenericSensor< MessageType >::setTimeout ( const rclcpp::Duration & timeout)
inline

Definition at line 108 of file cl_generic_sensor.hpp.

108{ timeout_ = timeout; }

References cl_generic_sensor::ClGenericSensor< MessageType >::timeout_.

◆ setTopicName()

template<typename MessageType >
void cl_generic_sensor::ClGenericSensor< MessageType >::setTopicName ( const std::string & topicName)
inline

Definition at line 105 of file cl_generic_sensor.hpp.

105{ topicName_ = topicName; }

References cl_generic_sensor::ClGenericSensor< MessageType >::topicName_.

Member Data Documentation

◆ timeout_

template<typename MessageType >
std::optional<rclcpp::Duration> cl_generic_sensor::ClGenericSensor< MessageType >::timeout_

◆ topicName_

template<typename MessageType >
std::optional<std::string> cl_generic_sensor::ClGenericSensor< MessageType >::topicName_

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