SMACC2
Loading...
Searching...
No Matches
cl_lifecycle_node::ClLifecycleNode Class Reference

#include <cl_lifecycle_node.hpp>

Inheritance diagram for cl_lifecycle_node::ClLifecycleNode:
Inheritance graph
Collaboration diagram for cl_lifecycle_node::ClLifecycleNode:
Collaboration graph

Public Member Functions

 ClLifecycleNode (std::string nodeName)
 
virtual ~ClLifecycleNode ()
 
void onInitialize () override
 
void changeState (uint8_t state)
 
void configure ()
 
void activate ()
 
void deactivate ()
 
void cleanup ()
 
void shutdown ()
 
void destroy ()
 
template<typename TOrthogonal , typename TSourceObject >
void onStateOrthogonalAllocation ()
 Configure component for event posting during orthogonal allocation.
 
- Public Member Functions inherited from smacc2::ISmaccClient
 ISmaccClient ()
 
virtual ~ISmaccClient ()
 
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 ()
 

Private Attributes

rclcpp::Client< lifecycle_msgs::srv::GetState >::SharedPtr client_get_state_
 
rclcpp::Client< lifecycle_msgs::srv::ChangeState >::SharedPtr client_change_state_
 
std::string nodeName_
 
CpLifecycleEventMonitoreventMonitor_
 
const std::string node_get_state_topic = "/get_state"
 
const std::string node_change_state_topic = "/change_state"
 
lifecycle_msgs::msg::TransitionEvent::SharedPtr lastTransitionEvent_
 

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

Definition at line 194 of file cl_lifecycle_node.hpp.

Constructor & Destructor Documentation

◆ ClLifecycleNode()

cl_lifecycle_node::ClLifecycleNode::ClLifecycleNode ( std::string nodeName)

Definition at line 26 of file cl_lifecycle_node.cpp.

27: nodeName_(node_name), eventMonitor_(nullptr)
28{
29}
CpLifecycleEventMonitor * eventMonitor_

◆ ~ClLifecycleNode()

cl_lifecycle_node::ClLifecycleNode::~ClLifecycleNode ( )
virtual

Definition at line 31 of file cl_lifecycle_node.cpp.

31{}

Member Function Documentation

◆ activate()

void cl_lifecycle_node::ClLifecycleNode::activate ( )

Definition at line 50 of file cl_lifecycle_node.cpp.

51{
52 changeState(lifecycle_msgs::msg::Transition::TRANSITION_ACTIVATE);
53}

References changeState().

Referenced by cl_lifecycle_node::CbActivate::onEntry().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ changeState()

void cl_lifecycle_node::ClLifecycleNode::changeState ( uint8_t state)

Definition at line 42 of file cl_lifecycle_node.cpp.

43{
44 auto request = std::make_shared<lifecycle_msgs::srv::ChangeState::Request>();
45 request->transition.id = state;
46 auto future = client_change_state_->async_send_request(request);
47 future.wait();
48}
rclcpp::Client< lifecycle_msgs::srv::ChangeState >::SharedPtr client_change_state_

References client_change_state_.

Referenced by activate(), cleanup(), configure(), deactivate(), and shutdown().

Here is the caller graph for this function:

◆ cleanup()

void cl_lifecycle_node::ClLifecycleNode::cleanup ( )

Definition at line 65 of file cl_lifecycle_node.cpp.

66{
67 changeState(lifecycle_msgs::msg::Transition::TRANSITION_CLEANUP);
68}

References changeState().

Referenced by cl_lifecycle_node::CbCleanup::onEntry().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ configure()

void cl_lifecycle_node::ClLifecycleNode::configure ( )

Definition at line 60 of file cl_lifecycle_node.cpp.

61{
62 changeState(lifecycle_msgs::msg::Transition::TRANSITION_CONFIGURE);
63}

References changeState().

Referenced by cl_lifecycle_node::CbConfigure::onEntry().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ deactivate()

void cl_lifecycle_node::ClLifecycleNode::deactivate ( )

Definition at line 55 of file cl_lifecycle_node.cpp.

56{
57 changeState(lifecycle_msgs::msg::Transition::TRANSITION_DEACTIVATE);
58}

References changeState().

Referenced by cl_lifecycle_node::CbDeactivate::onEntry(), and cl_lifecycle_node::CbDeactivateOnExit::onExit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ destroy()

void cl_lifecycle_node::ClLifecycleNode::destroy ( )

Referenced by cl_lifecycle_node::CbDestroy::onEntry().

Here is the caller graph for this function:

◆ onInitialize()

void cl_lifecycle_node::ClLifecycleNode::onInitialize ( )
overridevirtual

Reimplemented from smacc2::ISmaccClient.

Definition at line 33 of file cl_lifecycle_node.cpp.

34{
35 // Create service clients
36 client_get_state_ = this->getNode()->create_client<lifecycle_msgs::srv::GetState>(
38 client_change_state_ = this->getNode()->create_client<lifecycle_msgs::srv::ChangeState>(
40}
rclcpp::Client< lifecycle_msgs::srv::GetState >::SharedPtr client_get_state_
rclcpp::Node::SharedPtr getNode()
Definition client.cpp:60

References client_change_state_, client_get_state_, smacc2::ISmaccClient::getNode(), node_change_state_topic, node_get_state_topic, and nodeName_.

Here is the call graph for this function:

◆ onStateOrthogonalAllocation()

template<typename TOrthogonal , typename TSourceObject >
void cl_lifecycle_node::ClLifecycleNode::onStateOrthogonalAllocation ( )
inline

Configure component for event posting during orthogonal allocation.

Definition at line 228 of file cl_lifecycle_node.hpp.

229 {
230 // Create and register component with orthogonal
231 if (!eventMonitor_)
232 {
235 nodeName_);
236 }
237
238 // Configure component for this orthogonal
240 }
void onStateOrthogonalAllocation()
Configure component for event posting during orthogonal allocation.
SmaccComponentType * createComponent(TArgs... targs)

References smacc2::ISmaccClient::createComponent(), eventMonitor_, nodeName_, and onStateOrthogonalAllocation().

Referenced by onStateOrthogonalAllocation().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ shutdown()

void cl_lifecycle_node::ClLifecycleNode::shutdown ( )

Definition at line 70 of file cl_lifecycle_node.cpp.

71{
72 changeState(lifecycle_msgs::msg::Transition::TRANSITION_UNCONFIGURED_SHUTDOWN);
73}

References changeState().

Referenced by cl_lifecycle_node::CbShutdown::onEntry().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ client_change_state_

rclcpp::Client<lifecycle_msgs::srv::ChangeState>::SharedPtr cl_lifecycle_node::ClLifecycleNode::client_change_state_
private

Definition at line 245 of file cl_lifecycle_node.hpp.

Referenced by changeState(), and onInitialize().

◆ client_get_state_

rclcpp::Client<lifecycle_msgs::srv::GetState>::SharedPtr cl_lifecycle_node::ClLifecycleNode::client_get_state_
private

Definition at line 244 of file cl_lifecycle_node.hpp.

Referenced by onInitialize().

◆ eventMonitor_

CpLifecycleEventMonitor* cl_lifecycle_node::ClLifecycleNode::eventMonitor_
private

Definition at line 250 of file cl_lifecycle_node.hpp.

Referenced by onStateOrthogonalAllocation().

◆ lastTransitionEvent_

lifecycle_msgs::msg::TransitionEvent::SharedPtr cl_lifecycle_node::ClLifecycleNode::lastTransitionEvent_
private

Definition at line 254 of file cl_lifecycle_node.hpp.

◆ node_change_state_topic

const std::string cl_lifecycle_node::ClLifecycleNode::node_change_state_topic = "/change_state"
private

Definition at line 252 of file cl_lifecycle_node.hpp.

Referenced by onInitialize().

◆ node_get_state_topic

const std::string cl_lifecycle_node::ClLifecycleNode::node_get_state_topic = "/get_state"
private

Definition at line 251 of file cl_lifecycle_node.hpp.

Referenced by onInitialize().

◆ nodeName_

std::string cl_lifecycle_node::ClLifecycleNode::nodeName_
private

Definition at line 247 of file cl_lifecycle_node.hpp.

Referenced by onInitialize(), and onStateOrthogonalAllocation().


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