SMACC2
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Friends | List of all members
smacc2::ISmaccComponent Class Reference

#include <component.hpp>

Inheritance diagram for smacc2::ISmaccComponent:
Inheritance graph
Collaboration diagram for smacc2::ISmaccComponent:
Collaboration graph

Public Member Functions

 ISmaccComponent ()
 
virtual ~ISmaccComponent ()
 
virtual std::string getName () const
 

Protected Member Functions

virtual void onInitialize ()
 
template<typename EventType >
void postEvent (const EventType &ev)
 
template<typename EventType >
void postEvent ()
 
template<typename TOrthogonal , typename TSourceObject >
void onOrthogonalAllocation ()
 
template<typename TComponent >
void requiresComponent (TComponent *&requiredComponentStorage, bool throwExceptionIfNotExist=false)
 
template<typename TComponent >
void requiresComponent (std::string name, TComponent *&requiredComponentStorage, bool throwExceptionIfNotExist=false)
 
template<typename TClient >
void requiresClient (TClient *&requiredClientStorage)
 
template<typename SmaccComponentType , typename TOrthogonal , typename TClient , typename... TArgs>
SmaccComponentTypecreateSiblingComponent (TArgs... targs)
 
template<typename SmaccComponentType , typename TOrthogonal , typename TClient , typename... TArgs>
SmaccComponentTypecreateSiblingNamedComponent (std::string name, TArgs... targs)
 
rclcpp::Node::SharedPtr getNode ()
 
rclcpp::Logger getLogger () const
 
ISmaccStateMachinegetStateMachine ()
 

Protected Attributes

ISmaccStateMachinestateMachine_
 
ISmaccClientowner_
 

Private Member Functions

void initialize (ISmaccClient *owner)
 
void setStateMachine (ISmaccStateMachine *stateMachine)
 

Friends

class ISmaccOrthogonal
 
class ISmaccClient
 

Detailed Description

Definition at line 29 of file component.hpp.

Constructor & Destructor Documentation

◆ ISmaccComponent()

smacc2::ISmaccComponent::ISmaccComponent ( )

Definition at line 27 of file smacc_component.cpp.

27: owner_(nullptr) {}
ISmaccClient * owner_
Definition component.hpp:83

◆ ~ISmaccComponent()

smacc2::ISmaccComponent::~ISmaccComponent ( )
virtual

Definition at line 25 of file smacc_component.cpp.

25{}

Member Function Documentation

◆ createSiblingComponent()

template<typename SmaccComponentType , typename TOrthogonal , typename TClient , typename... TArgs>
SmaccComponentType * smacc2::ISmaccComponent::createSiblingComponent ( TArgs...  targs)
protected

Definition at line 103 of file smacc_component_impl.hpp.

104{
105 return this->owner_->createComponent<SmaccComponentType, TOrthogonal, TClient>(targs...);
106}
SmaccComponentType * createComponent(TArgs... targs)

References smacc2::ISmaccClient::createComponent(), and owner_.

Here is the call graph for this function:

◆ createSiblingNamedComponent()

template<typename SmaccComponentType , typename TOrthogonal , typename TClient , typename... TArgs>
SmaccComponentType * smacc2::ISmaccComponent::createSiblingNamedComponent ( std::string  name,
TArgs...  targs 
)
protected

Definition at line 109 of file smacc_component_impl.hpp.

110{
111 return this->owner_->createNamedComponent<SmaccComponentType, TOrthogonal, TClient>(
112 name, targs...);
113}
SmaccComponentType * createNamedComponent(std::string name, TArgs... targs)

References smacc2::ISmaccClient::createNamedComponent(), and owner_.

Here is the call graph for this function:

◆ getLogger()

rclcpp::Logger smacc2::ISmaccComponent::getLogger ( ) const
protected

Definition at line 44 of file smacc_component.cpp.

44{ return owner_->getLogger(); }
rclcpp::Logger getLogger()

References smacc2::ISmaccClient::getLogger(), and owner_.

Referenced by cl_moveit2z::CpGraspingComponent::createGraspableBox(), cl_nav2z::CpCostmapSwitch::disable(), cl_nitrosz::CpCostmapSwitch::disable(), cl_nav2z::CpCostmapSwitch::enable(), cl_nitrosz::CpCostmapSwitch::enable(), cl_moveit2z::CpTrajectoryHistory::getLastTrajectory(), cl_nav2z::CpWaypointNavigatorBase::loadWayPointsFromFile(), cl_nitrosz::CpWaypointNavigatorBase::loadWayPointsFromFile(), cl_nav2z::CpWaypointNavigatorBase::loadWayPointsFromFile2(), cl_nitrosz::CpWaypointNavigatorBase::loadWayPointsFromFile2(), cl_nav2z::CpWaypointNavigatorBase::loadWaypointsFromYamlParameter(), cl_nitrosz::CpWaypointNavigatorBase::loadWaypointsFromYamlParameter(), cl_nav2z::odom_tracker::CpOdomTracker::logStateString(), cl_nitrosz::odom_tracker::CpOdomTracker::logStateString(), cl_nav2z::CpWaypointNavigatorBase::notifyGoalReached(), cl_nitrosz::CpWaypointNavigatorBase::notifyGoalReached(), cl_nav2z::CpWaypointNavigator::onGoalReached(), cl_nitrosz::CpWaypointNavigator::onGoalReached(), smacc2::components::CpTopicSubscriber< MessageType >::onInitialize(), cl_nav2z::CpCostmapSwitch::onInitialize(), cl_nav2z::odom_tracker::CpOdomTracker::onInitialize(), cl_nav2z::Pose::onInitialize(), cl_nitrosz::CpCostmapSwitch::onInitialize(), cl_nitrosz::odom_tracker::CpOdomTracker::onInitialize(), cl_nitrosz::Pose::onInitialize(), cl_nav2z::odom_tracker::CpOdomTracker::popPath(), cl_nitrosz::odom_tracker::CpOdomTracker::popPath(), cl_nav2z::odom_tracker::CpOdomTracker::processOdometryMessage(), cl_nitrosz::odom_tracker::CpOdomTracker::processOdometryMessage(), cl_nav2z::odom_tracker::CpOdomTracker::pushPath(), cl_nitrosz::odom_tracker::CpOdomTracker::pushPath(), cl_moveit2z::CpTrajectoryHistory::pushTrajectory(), cl_nav2z::CpCostmapSwitch::registerProxyFromDynamicReconfigureServer(), cl_nitrosz::CpCostmapSwitch::registerProxyFromDynamicReconfigureServer(), requiresComponent(), requiresComponent(), cl_nav2z::CpWaypointNavigatorBase::seekName(), cl_nitrosz::CpWaypointNavigatorBase::seekName(), cl_nav2z::CpWaypointNavigator::sendNextGoal(), cl_nitrosz::CpWaypointNavigator::sendNextGoal(), cl_nav2z::CpPlannerSwitcher::setBackwardPlanner(), cl_nitrosz::CpPlannerSwitcher::setBackwardPlanner(), cl_nav2z::CpPlannerSwitcher::setForwardPlanner(), cl_nitrosz::CpPlannerSwitcher::setForwardPlanner(), cl_nav2z::CpGoalCheckerSwitcher::setGoalCheckerId(), cl_nitrosz::CpGoalCheckerSwitcher::setGoalCheckerId(), cl_nav2z::CpPlannerSwitcher::setPureSpinningPlanner(), cl_nitrosz::CpPlannerSwitcher::setPureSpinningPlanner(), cl_nav2z::odom_tracker::CpOdomTracker::setStartPoint(), cl_nitrosz::odom_tracker::CpOdomTracker::setStartPoint(), cl_nav2z::odom_tracker::CpOdomTracker::setStartPoint(), cl_nitrosz::odom_tracker::CpOdomTracker::setStartPoint(), cl_nav2z::CpPlannerSwitcher::setUndoPathBackwardPlanner(), cl_nitrosz::CpPlannerSwitcher::setUndoPathBackwardPlanner(), cl_nav2z::odom_tracker::CpOdomTracker::setWorkingMode(), cl_nitrosz::odom_tracker::CpOdomTracker::setWorkingMode(), cl_nav2z::Pose::update(), cl_nitrosz::Pose::update(), cl_nav2z::odom_tracker::CpOdomTracker::updateClearPath(), cl_nitrosz::odom_tracker::CpOdomTracker::updateClearPath(), cl_nav2z::odom_tracker::CpOdomTracker::updateRecordPath(), cl_nitrosz::odom_tracker::CpOdomTracker::updateRecordPath(), cl_nav2z::Pose::waitTransformUpdate(), and cl_nitrosz::Pose::waitTransformUpdate().

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

◆ getName()

std::string smacc2::ISmaccComponent::getName ( ) const
virtual

◆ getNode()

rclcpp::Node::SharedPtr smacc2::ISmaccComponent::getNode ( )
protected

Definition at line 42 of file smacc_component.cpp.

42{ return owner_->getNode(); }
rclcpp::Node::SharedPtr getNode()
Definition client.cpp:60

References smacc2::ISmaccClient::getNode(), and owner_.

Referenced by cl_nav2z::odom_tracker::CpOdomTracker::clearPath(), cl_nitrosz::odom_tracker::CpOdomTracker::clearPath(), cl_nav2z::CpWaypointsVisualizer::createMarker(), cl_nitrosz::CpWaypointsVisualizer::createMarker(), cl_nav2z::CpWaypointsVisualizer::createMarkerLabel(), cl_nitrosz::CpWaypointsVisualizer::createMarkerLabel(), cl_nav2z::CpWaypointNavigatorBase::loadWaypointsFromYamlParameter(), cl_nitrosz::CpWaypointNavigatorBase::loadWaypointsFromYamlParameter(), smacc2::components::CpTopicSubscriber< MessageType >::onInitialize(), cl_nav2z::CpAmcl::onInitialize(), cl_nav2z::CpGoalCheckerSwitcher::onInitialize(), cl_nav2z::odom_tracker::CpOdomTracker::onInitialize(), cl_nav2z::CpPlannerSwitcher::onInitialize(), cl_nav2z::Pose::onInitialize(), cl_nav2z::CpWaypointsVisualizer::onInitialize(), cl_nitrosz::CpAmcl::onInitialize(), cl_nitrosz::CpGoalCheckerSwitcher::onInitialize(), cl_nitrosz::odom_tracker::CpOdomTracker::onInitialize(), cl_nitrosz::CpPlannerSwitcher::onInitialize(), cl_nitrosz::Pose::onInitialize(), cl_nitrosz::CpWaypointsVisualizer::onInitialize(), cl_nav2z::odom_tracker::CpOdomTracker::processOdometryMessage(), cl_nitrosz::odom_tracker::CpOdomTracker::processOdometryMessage(), cl_nav2z::CpCostmapSwitch::registerProxyFromDynamicReconfigureServer(), cl_nitrosz::CpCostmapSwitch::registerProxyFromDynamicReconfigureServer(), cl_nav2z::odom_tracker::CpOdomTracker::setStartPoint(), cl_nitrosz::odom_tracker::CpOdomTracker::setStartPoint(), cl_nav2z::Pose::update(), cl_nav2z::CpWaypointsVisualizer::update(), cl_nitrosz::Pose::update(), cl_nitrosz::CpWaypointsVisualizer::update(), cl_nav2z::odom_tracker::CpOdomTracker::updateConfiguration(), cl_nitrosz::odom_tracker::CpOdomTracker::updateConfiguration(), cl_nav2z::odom_tracker::CpOdomTracker::updateRecordPath(), cl_nitrosz::odom_tracker::CpOdomTracker::updateRecordPath(), cl_nav2z::Pose::waitTransformUpdate(), and cl_nitrosz::Pose::waitTransformUpdate().

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

◆ getStateMachine()

ISmaccStateMachine * smacc2::ISmaccComponent::getStateMachine ( )
protected

◆ initialize()

void smacc2::ISmaccComponent::initialize ( ISmaccClient owner)
private

Definition at line 29 of file smacc_component.cpp.

30{
31 owner_ = owner;
32 this->onInitialize();
33}

References onInitialize(), and owner_.

Here is the call graph for this function:

◆ onInitialize()

void smacc2::ISmaccComponent::onInitialize ( )
protectedvirtual

◆ onOrthogonalAllocation()

void smacc2::ISmaccComponent::onOrthogonalAllocation ( )
inlineprotected

Definition at line 51 of file component.hpp.

52 {
53 }

◆ postEvent() [1/2]

template<typename EventType >
void smacc2::ISmaccComponent::postEvent ( )
protected

Definition at line 37 of file smacc_component_impl.hpp.

38{
39 auto ev = new EventType();
41}
void postEvent(EventType *ev, EventLifeTime evlifetime=EventLifeTime::ABSOLUTE)

References smacc2::ISmaccStateMachine::postEvent(), and stateMachine_.

Referenced by smacc2::components::CpTopicSubscriber< MessageType >::onOrthogonalAllocation().

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

◆ postEvent() [2/2]

template<typename EventType >
void smacc2::ISmaccComponent::postEvent ( const EventType ev)
protected

Definition at line 31 of file smacc_component_impl.hpp.

32{
34}

References smacc2::ISmaccStateMachine::postEvent(), and stateMachine_.

Here is the call graph for this function:

◆ requiresClient()

template<typename TClient >
void smacc2::ISmaccComponent::requiresClient ( TClient *&  requiredClientStorage)
protected

Definition at line 97 of file smacc_component_impl.hpp.

98{
99 this->owner_->requiresClient(requiredClientStorage);
100}
void requiresClient(SmaccClientType *&storage)

References owner_, and smacc2::ISmaccClient::requiresClient().

Here is the call graph for this function:

◆ requiresComponent() [1/2]

template<typename TComponent >
void smacc2::ISmaccComponent::requiresComponent ( std::string  name,
TComponent *&  requiredComponentStorage,
bool  throwExceptionIfNotExist = false 
)
protected

Definition at line 70 of file smacc_component_impl.hpp.

72{
73 requiredComponentStorage = this->owner_->getComponent<TComponent>(name);
74
75 if (requiredComponentStorage == nullptr && throwExceptionIfNotExist)
76 {
77 RCLCPP_DEBUG_STREAM(
78 this->getLogger(), std::string("Required component with name: '") + name + "'" +
79 demangleSymbol(typeid(TComponent).name()) +
80 " not found. Available components:");
81
82 std::vector<std::shared_ptr<ISmaccComponent>> components;
83 this->owner_->getComponents(components);
84
85 for (auto c : components)
86 {
87 RCLCPP_DEBUG(this->getLogger(), " - Component %s", c->getName().c_str());
88 }
89
90 throw std::runtime_error(
91 std::string("Component ") + demangleSymbol(typeid(TComponent).name()) +
92 std::string(" not found"));
93 }
94}
void getComponents(std::vector< std::shared_ptr< ISmaccComponent > > &components)
Definition client.cpp:34
rclcpp::Logger getLogger() const

References smacc2::introspection::demangleSymbol(), smacc2::ISmaccClient::getComponent(), smacc2::ISmaccClient::getComponents(), getLogger(), and owner_.

Here is the call graph for this function:

◆ requiresComponent() [2/2]

template<typename TComponent >
void smacc2::ISmaccComponent::requiresComponent ( TComponent *&  requiredComponentStorage,
bool  throwExceptionIfNotExist = false 
)
protected

Definition at line 44 of file smacc_component_impl.hpp.

46{
47 requiredComponentStorage = this->owner_->getComponent<TComponent>();
48
49 if (requiredComponentStorage == nullptr && throwExceptionIfNotExist)
50 {
51 RCLCPP_DEBUG_STREAM(
52 this->getLogger(), std::string("Required component ") +
53 demangleSymbol(typeid(TComponent).name()) +
54 " not found. Available components:");
55
56 std::vector<std::shared_ptr<ISmaccComponent>> components;
57 this->owner_->getComponents(components);
58
59 for (auto c : components)
60 {
61 RCLCPP_DEBUG(this->getLogger(), "- Component %s", c->getName().c_str());
62 }
63
64 throw std::runtime_error(
65 std::string("Component ") + demangleSymbol(typeid(TComponent).name()) + " not found");
66 }
67}

References smacc2::introspection::demangleSymbol(), smacc2::ISmaccClient::getComponent(), smacc2::ISmaccClient::getComponents(), getLogger(), and owner_.

Referenced by cl_nav2z::CpWaypointsVisualizer::onInitialize(), and cl_nitrosz::CpWaypointsVisualizer::onInitialize().

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

◆ setStateMachine()

void smacc2::ISmaccComponent::setStateMachine ( ISmaccStateMachine stateMachine)
private

Definition at line 37 of file smacc_component.cpp.

38{
39 stateMachine_ = stateMachine;
40}

References stateMachine_.

Friends And Related Symbol Documentation

◆ ISmaccClient

friend class ISmaccClient
friend

Definition at line 94 of file component.hpp.

◆ ISmaccOrthogonal

friend class ISmaccOrthogonal
friend

Definition at line 93 of file component.hpp.

Member Data Documentation

◆ owner_

ISmaccClient* smacc2::ISmaccComponent::owner_
protected

◆ stateMachine_

ISmaccStateMachine* smacc2::ISmaccComponent::stateMachine_
protected

Definition at line 81 of file component.hpp.

Referenced by getStateMachine(), postEvent(), postEvent(), and setStateMachine().


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