SMACC2
Loading...
Searching...
No Matches
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 TOrthogonal , typename TClient >
void onComponentInitialization ()
 
template<typename EventType >
void postEvent (const EventType &ev)
 
template<typename EventType >
void postEvent ()
 
template<typename TOrthogonal , typename TSourceObject >
void onOrthogonalAllocation ()
 
template<typename TOrthogonal , typename TSourceObject >
void onStateOrthogonalAllocation ()
 
template<typename TComponent >
void requiresComponent (TComponent *&requiredComponentStorage, bool throwExceptionIfNotExist)
 
template<typename TComponent >
void requiresComponent (std::string name, TComponent *&requiredComponentStorage, bool throwExceptionIfNotExist)
 
template<typename TComponent >
void requiresComponent (TComponent *&requiredComponentStorage, ComponentRequirement requirementType=ComponentRequirement::SOFT)
 
template<typename TComponent >
void requiresComponent (std::string name, TComponent *&requiredComponentStorage, ComponentRequirement requirementType=ComponentRequirement::SOFT)
 
template<typename TClient >
void requiresClient (TClient *&requiredClientStorage)
 
template<typename SmaccComponentType , typename TOrthogonal , typename TClient , typename... TArgs>
SmaccComponentType * createSiblingComponent (TArgs... targs)
 
template<typename SmaccComponentType , typename TOrthogonal , typename TClient , typename... TArgs>
SmaccComponentType * createSiblingNamedComponent (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_

◆ ~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 121 of file smacc_component_impl.hpp.

122{
123 return this->owner_->createComponent<SmaccComponentType, TOrthogonal, TClient>(targs...);
124}
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 127 of file smacc_component_impl.hpp.

128{
129 return this->owner_->createNamedComponent<SmaccComponentType, TOrthogonal, TClient>(
130 name, targs...);
131}
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 smacc2::client_core_components::CpActionClient< ActionType >::cancelGoal(), cl_nav2z::components::CpNav2ActionInterface::cancelNavigation(), smacc2::client_core_components::CpRos2Timer::cancelTimer(), cl_nav2z::odom_tracker::CpOdomTracker::clearPath(), cl_moveit2z::CpGraspingComponent::createGraspableBox(), cl_nav2z::CpCostmapSwitch::disable(), cl_nav2z::CpCostmapSwitch::enable(), cl_moveit2z::CpTrajectoryHistory::getLastTrajectory(), cl_nav2z::CpWaypointNavigatorBase::loadWayPointsFromFile(), cl_nav2z::CpWaypointNavigatorBase::loadWayPointsFromFile2(), cl_nav2z::CpWaypointNavigatorBase::loadWaypointsFromYamlParameter(), cl_nav2z::odom_tracker::CpOdomTracker::logStateString(), cl_nav2z::CpWaypointNavigatorBase::notifyGoalReached(), cl_keyboard::components::CpKeyboardListener1::onComponentInitialization(), cl_nav2z::components::CpNav2ActionInterface::onComponentInitialization(), smacc2::client_core_components::CpActionClient< ActionType >::onComponentInitialization(), cl_nav2z::CpWaypointNavigator::onGoalReached(), cl_nav2z::components::CpNav2ActionInterface::onInitialize(), cl_nav2z::CpCostmapSwitch::onInitialize(), cl_nav2z::CpPose::onInitialize(), cl_nav2z::odom_tracker::CpOdomTracker::onInitialize(), cl_nav2z::Pose::onInitialize(), cl_ros2_timer::components::CpTimerListener1::onInitialize(), smacc2::client_core_components::CpActionClient< ActionType >::onInitialize(), smacc2::client_core_components::CpRos2Timer::onInitialize(), smacc2::client_core_components::CpTopicSubscriber< MessageType >::onInitialize(), cl_nav2z::components::CpNav2ActionInterface::onNavigationAbortedCallback(), cl_nav2z::components::CpNav2ActionInterface::onNavigationCancelledCallback(), cl_nav2z::components::CpNav2ActionInterface::onNavigationFeedbackCallback(), cl_nav2z::components::CpNav2ActionInterface::onNavigationSuccessCallback(), smacc2::client_core_components::CpActionClient< ActionType >::onResult(), cl_ros2_timer::components::CpTimerListener1::onStateOrthogonalAllocation(), cl_ros2_timer::components::CpTimerListener1::onTimerTickCallback(), cl_nav2z::odom_tracker::CpOdomTracker::parametersCallback(), cl_nav2z::odom_tracker::CpOdomTracker::popPath(), cl_keyboard::components::CpKeyboardListener1::postKeyEvent(), smacc2::client_core_components::CpActionClient< ActionType >::postResultEvent(), cl_nav2z::odom_tracker::CpOdomTracker::processNewPose(), cl_nav2z::odom_tracker::CpOdomTracker::pushPath(), cl_moveit2z::CpTrajectoryHistory::pushTrajectory(), cl_nav2z::CpCostmapSwitch::registerProxyFromDynamicReconfigureServer(), requiresComponent(), requiresComponent(), cl_nav2z::CpWaypointNavigatorBase::seekName(), cl_nav2z::components::CpNav2ActionInterface::sendGoal(), smacc2::client_core_components::CpActionClient< ActionType >::sendGoal(), cl_nav2z::components::CpNav2ActionInterface::sendNavigationGoal(), cl_nav2z::CpWaypointNavigator::sendNextGoal(), cl_nav2z::CpPlannerSwitcher::setBackwardPlanner(), cl_nav2z::odom_tracker::CpOdomTracker::setCurrentPathName(), cl_nav2z::CpPlannerSwitcher::setForwardPlanner(), cl_nav2z::CpGoalCheckerSwitcher::setGoalCheckerId(), cl_nav2z::CpPlannerSwitcher::setPureSpinningPlanner(), cl_nav2z::odom_tracker::CpOdomTracker::setStartPoint(), cl_nav2z::odom_tracker::CpOdomTracker::setStartPoint(), cl_nav2z::CpPlannerSwitcher::setUndoPathBackwardPlanner(), cl_nav2z::odom_tracker::CpOdomTracker::setWorkingMode(), smacc2::client_core_components::CpRos2Timer::startTimer(), smacc2::client_core_components::CpRos2Timer::stopTimer(), smacc2::client_core_components::CpRos2Timer::timerCallback(), cl_nav2z::CpPose::toPoseStampedMsg(), cl_nav2z::Pose::toPoseStampedMsg(), cl_nav2z::CpPose::update(), cl_nav2z::odom_tracker::CpOdomTracker::update(), cl_nav2z::Pose::update(), cl_nav2z::odom_tracker::CpOdomTracker::updateClearPath(), cl_nav2z::odom_tracker::CpOdomTracker::updateRecordPath(), smacc2::client_core_components::CpActionClient< ActionType >::waitForServer(), cl_nav2z::CpPose::waitTransformUpdate(), and cl_nav2z::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

Reimplemented in cl_nav2z::CpAmcl, and cl_nav2z::CpAmcl.

Definition at line 46 of file smacc_component.cpp.

47{
48 std::string keyname = demangleSymbol(typeid(*this).name());
49 return keyname;
50}
std::string demangleSymbol()

References smacc2::introspection::demangleSymbol().

Referenced by smacc2::client_core_components::CpActionClient< ActionType >::cancelGoal(), smacc2::client_core_components::CpRos2Timer::cancelTimer(), cl_moveit2z::CpGraspingComponent::createGraspableBox(), cl_moveit2z::CpTrajectoryHistory::getLastTrajectory(), smacc2::client_core_components::CpActionClient< ActionType >::onComponentInitialization(), smacc2::client_core_components::CpActionClient< ActionType >::onInitialize(), smacc2::client_core_components::CpRos2Timer::onInitialize(), smacc2::client_core_components::CpTopicSubscriber< MessageType >::onInitialize(), smacc2::client_core_components::CpActionClient< ActionType >::onResult(), smacc2::client_core_components::CpActionClient< ActionType >::postResultEvent(), cl_moveit2z::CpTrajectoryHistory::pushTrajectory(), smacc2::client_core_components::CpActionClient< ActionType >::sendGoal(), cl_nav2z::CpWaypointNavigator::sendNextGoal(), smacc2::client_core_components::CpRos2Timer::startTimer(), smacc2::client_core_components::CpRos2Timer::stopTimer(), smacc2::client_core_components::CpRos2Timer::timerCallback(), and smacc2::client_core_components::CpActionClient< ActionType >::waitForServer().

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

◆ 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_nav2z::CpWaypointsVisualizer::createMarker(), cl_nav2z::CpWaypointsVisualizer::createMarkerLabel(), cl_nav2z::CpPose::freezeReferenceFrame(), cl_nav2z::Pose::freezeReferenceFrame(), cl_nav2z::CpWaypointNavigatorBase::loadWaypointsFromYamlParameter(), cl_nav2z::CpAmcl::onInitialize(), cl_nav2z::CpGoalCheckerSwitcher::onInitialize(), cl_nav2z::CpPlannerSwitcher::onInitialize(), cl_nav2z::CpPose::onInitialize(), cl_nav2z::CpWaypointsVisualizer::onInitialize(), cl_nav2z::odom_tracker::CpOdomTracker::onInitialize(), cl_nav2z::Pose::onInitialize(), smacc2::client_core_components::CpActionClient< ActionType >::onInitialize(), smacc2::client_core_components::CpRos2Timer::onInitialize(), smacc2::client_core_components::CpTopicSubscriber< MessageType >::onInitialize(), cl_nav2z::odom_tracker::CpOdomTracker::processNewPose(), cl_nav2z::CpCostmapSwitch::registerProxyFromDynamicReconfigureServer(), cl_nav2z::odom_tracker::CpOdomTracker::setOdomFrame(), cl_nav2z::odom_tracker::CpOdomTracker::setStartPoint(), cl_nav2z::CpPose::update(), cl_nav2z::CpWaypointsVisualizer::update(), cl_nav2z::Pose::update(), cl_nav2z::odom_tracker::CpOdomTracker::updateConfiguration(), cl_nav2z::odom_tracker::CpOdomTracker::updateRecordPath(), cl_nav2z::CpPose::waitTransformUpdate(), and cl_nav2z::Pose::waitTransformUpdate().

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

◆ getStateMachine()

◆ 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:

◆ onComponentInitialization()

template<typename TOrthogonal , typename TClient >
void smacc2::ISmaccComponent::onComponentInitialization ( )
protected

Definition at line 134 of file smacc_component_impl.hpp.

135{
136}

◆ onInitialize()

◆ onOrthogonalAllocation()

template<typename TOrthogonal , typename TSourceObject >
void smacc2::ISmaccComponent::onOrthogonalAllocation ( )
inlineprotected

Definition at line 58 of file component.hpp.

59 {
60 }

◆ onStateOrthogonalAllocation()

template<typename TOrthogonal , typename TSourceObject >
void smacc2::ISmaccComponent::onStateOrthogonalAllocation ( )
inlineprotected

Definition at line 64 of file component.hpp.

65 {
66 }

◆ postEvent() [1/2]

◆ 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 115 of file smacc_component_impl.hpp.

116{
117 this->owner_->requiresClient(requiredClientStorage);
118}
void requiresClient(SmaccClientType *&storage)

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

Here is the call graph for this function:

◆ requiresComponent() [1/4]

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

Definition at line 53 of file smacc_component_impl.hpp.

55{
57 name, requiredComponentStorage,
58 throwExceptionIfNotExist ? ComponentRequirement::HARD : ComponentRequirement::SOFT);
59}
void requiresComponent(TComponent *&requiredComponentStorage, bool throwExceptionIfNotExist)

References smacc2::HARD, requiresComponent(), and smacc2::SOFT.

Here is the call graph for this function:

◆ requiresComponent() [2/4]

template<typename TComponent >
void smacc2::ISmaccComponent::requiresComponent ( std::string name,
TComponent *& requiredComponentStorage,
ComponentRequirement requirementType = ComponentRequirement::SOFT )
protected

Definition at line 88 of file smacc_component_impl.hpp.

90{
91 requiredComponentStorage = this->owner_->getComponent<TComponent>(name);
92
93 if (requiredComponentStorage == nullptr && requirementType == ComponentRequirement::HARD)
94 {
95 RCLCPP_DEBUG_STREAM(
96 this->getLogger(), std::string("Required component with name: '") + name + "'" +
97 demangleSymbol(typeid(TComponent).name()) +
98 " not found. Available components:");
99
100 std::vector<std::shared_ptr<ISmaccComponent>> components;
101 this->owner_->getComponents(components);
102
103 for (auto c : components)
104 {
105 RCLCPP_DEBUG(this->getLogger(), " - Component %s", c->getName().c_str());
106 }
107
108 throw std::runtime_error(
109 std::string("Component ") + demangleSymbol(typeid(TComponent).name()) +
110 std::string(" not found"));
111 }
112}
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(), smacc2::HARD, and owner_.

Here is the call graph for this function:

◆ requiresComponent() [3/4]

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

◆ requiresComponent() [4/4]

template<typename TComponent >
void smacc2::ISmaccComponent::requiresComponent ( TComponent *& requiredComponentStorage,
ComponentRequirement requirementType = ComponentRequirement::SOFT )
protected

Definition at line 62 of file smacc_component_impl.hpp.

64{
65 requiredComponentStorage = this->owner_->getComponent<TComponent>();
66
67 if (requiredComponentStorage == nullptr && requirementType == ComponentRequirement::HARD)
68 {
69 RCLCPP_DEBUG_STREAM(
70 this->getLogger(), std::string("Required component ") +
71 demangleSymbol(typeid(TComponent).name()) +
72 " not found. Available components:");
73
74 std::vector<std::shared_ptr<ISmaccComponent>> components;
75 this->owner_->getComponents(components);
76
77 for (auto c : components)
78 {
79 RCLCPP_DEBUG(this->getLogger(), "- Component %s", c->getName().c_str());
80 }
81
82 throw std::runtime_error(
83 std::string("Component ") + demangleSymbol(typeid(TComponent).name()) + " not found");
84 }
85}

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

Here is the call 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 123 of file component.hpp.

◆ ISmaccOrthogonal

friend class ISmaccOrthogonal
friend

Definition at line 122 of file component.hpp.

Member Data Documentation

◆ owner_

◆ stateMachine_

ISmaccStateMachine* smacc2::ISmaccComponent::stateMachine_
protected

Definition at line 110 of file component.hpp.

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


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