SMACC2
Loading...
Searching...
No Matches
cl_nav2z::CbNavigateNextWaypointUntilReached Class Reference

#include <cb_navigate_next_waypoint_until_reached.hpp>

Inheritance diagram for cl_nav2z::CbNavigateNextWaypointUntilReached:
Inheritance graph
Collaboration diagram for cl_nav2z::CbNavigateNextWaypointUntilReached:
Collaboration graph

Public Member Functions

 CbNavigateNextWaypointUntilReached (std::string goalWaypointName, const std::optional< NavigateNextWaypointOptions > &options=std::nullopt)
 
 ~CbNavigateNextWaypointUntilReached () override
 
template<typename TOrthogonal , typename TSourceObject >
void onStateOrthogonalAllocation ()
 
void onEntry () override
 
void onExit () override
 
void onNavigationActionSuccess (const components::CpNav2ActionInterface::WrappedResult &r) override
 
- Public Member Functions inherited from cl_nav2z::CbNavigateNextWaypoint
 CbNavigateNextWaypoint (const std::optional< NavigateNextWaypointOptions > &options=std::nullopt)
 
 ~CbNavigateNextWaypoint () override
 
- Public Member Functions inherited from cl_nav2z::CbNav2ZClientBehaviorBase
 ~CbNav2ZClientBehaviorBase () override
 
template<typename TOrthogonal , typename TSourceObject >
void onStateOrthogonalAllocation ()
 
- Public Member Functions inherited from smacc2::client_behavior_bases::CbActionClientBehaviorBase< nav2_msgs::action::NavigateToPose >
void onStateOrthogonalAllocation ()
 
virtual ~CbActionClientBehaviorBase ()
 
- Public Member Functions inherited from smacc2::SmaccAsyncClientBehavior
template<typename TOrthogonal , typename TSourceObject >
void onStateOrthogonalAllocation ()
 
 SmaccAsyncClientBehavior ()=default
 
 ~SmaccAsyncClientBehavior () override
 
 SmaccAsyncClientBehavior (const SmaccAsyncClientBehavior &)=delete
 
SmaccAsyncClientBehavior & operator= (const SmaccAsyncClientBehavior &)=delete
 
 SmaccAsyncClientBehavior (SmaccAsyncClientBehavior &&)=delete
 
SmaccAsyncClientBehavior & operator= (SmaccAsyncClientBehavior &&)=delete
 
template<typename TCallback , typename T >
smacc2::SmaccSignalConnection onSuccess (TCallback callback, T *object)
 
template<typename TCallback , typename T >
smacc2::SmaccSignalConnection onFinished (TCallback callback, T *object)
 
template<typename TCallback , typename T >
smacc2::SmaccSignalConnection onFailure (TCallback callback, T *object)
 
void requestForceFinish ()
 
void executeOnEntry () override
 
void executeOnExit () override
 
void waitOnEntryThread (bool requestFinish)
 
template<typename TCallbackMethod , typename T >
smacc2::SmaccSignalConnection onSuccess (TCallbackMethod callback, T *object)
 
template<typename TCallbackMethod , typename T >
smacc2::SmaccSignalConnection onFinished (TCallbackMethod callback, T *object)
 
template<typename TCallbackMethod , typename T >
smacc2::SmaccSignalConnection onFailure (TCallbackMethod callback, T *object)
 
- Public Member Functions inherited from smacc2::ISmaccClientBehavior
 ISmaccClientBehavior ()
 
virtual ~ISmaccClientBehavior ()
 
 ISmaccClientBehavior (const ISmaccClientBehavior &)=delete
 
ISmaccClientBehavior & operator= (const ISmaccClientBehavior &)=delete
 
 ISmaccClientBehavior (ISmaccClientBehavior &&)=delete
 
ISmaccClientBehavior & operator= (ISmaccClientBehavior &&)=delete
 
ISmaccStateMachine * getStateMachine ()
 
std::string getName () const
 
template<typename SmaccClientType >
void requiresClient (SmaccClientType *&storage)
 
template<typename SmaccComponentType >
void requiresComponent (SmaccComponentType *&storage, ComponentRequirement requirementType=ComponentRequirement::SOFT)
 
template<typename SmaccComponentType >
void requiresComponent (const std::string &name, SmaccComponentType *&storage, ComponentRequirement requirementType=ComponentRequirement::SOFT)
 

Private Attributes

std::string goalWaypointName_
 
std::optional< std::string > sentWaypointName_
 
std::function< void()> postEvGoalWaypointReached_
 

Additional Inherited Members

- Public Types inherited from smacc2::client_behavior_bases::CbActionClientBehaviorBase< nav2_msgs::action::NavigateToPose >
using Goal
 
using GoalHandle
 
using WrappedResult
 
using Feedback
 
using ActionClientComponent
 
- Protected Member Functions inherited from cl_nav2z::CbNav2ZClientBehaviorBase
virtual void onNavigationActionAbort (const components::CpNav2ActionInterface::WrappedResult &)
 
void onActionSuccess (const WrappedResult &result) override
 
void onActionAbort (const WrappedResult &result) override
 
- Protected Member Functions inherited from smacc2::client_behavior_bases::CbActionClientBehaviorBase< nav2_msgs::action::NavigateToPose >
bool sendGoal (Goal &goal)
 
bool trackGoal (std::shared_future< typename GoalHandle::SharedPtr > goalHandleFuture)
 
void cancelGoal ()
 
virtual void onActionSuccess (const WrappedResult &result)
 
virtual void onActionAbort (const WrappedResult &result)
 
virtual void onActionFeedback (const Feedback &)
 
void setActionClientName (std::string name)
 
- Protected Member Functions inherited from smacc2::SmaccAsyncClientBehavior
void postSuccessEvent ()
 
void postFailureEvent ()
 
void dispose () override
 
bool isShutdownRequested ()
 onEntry is executed in a new thread. However the current state cannot be left until the onEntry thread finishes. This flag can be checked from the onEntry thread to force finishing the thread.
 
- Protected Member Functions inherited from smacc2::ISmaccClientBehavior
virtual void runtimeConfigure ()
 
template<typename EventType >
void postEvent (const EventType &ev)
 
template<typename EventType >
void postEvent ()
 
ISmaccState * getCurrentState ()
 
void postInitializationFailureEvent (const std::string &what)
 
virtual rclcpp::Node::SharedPtr getNode () const
 
virtual rclcpp::Logger getLogger () const
 
std::string getTraceStateName () const
 
std::string getTraceOrthogonalName () const
 
- Protected Attributes inherited from cl_nav2z::CbNavigateNextWaypoint
CpWaypointNavigator * waypointsNavigator_ = nullptr
 
NavigateNextWaypointOptions options_
 
- Protected Attributes inherited from cl_nav2z::CbNav2ZClientBehaviorBase
components::CpNav2ActionInterface * nav2ActionInterface_ = nullptr
 
rclcpp_action::ResultCode navigationResult_ = rclcpp_action::ResultCode::UNKNOWN
 
- Protected Attributes inherited from smacc2::client_behavior_bases::CbActionClientBehaviorBase< nav2_msgs::action::NavigateToPose >
ActionClientComponent * actionClient_
 
std::string actionClientName_
 
rclcpp_action::ResultCode actionResult_
 
std::chrono::milliseconds goalResponseTimeout_
 

Detailed Description

Definition at line 32 of file cb_navigate_next_waypoint_until_reached.hpp.

Constructor & Destructor Documentation

◆ CbNavigateNextWaypointUntilReached()

cl_nav2z::CbNavigateNextWaypointUntilReached::CbNavigateNextWaypointUntilReached ( std::string goalWaypointName,
const std::optional< NavigateNextWaypointOptions > & options = std::nullopt )

Definition at line 25 of file cb_navigate_next_waypoint_until_reached.cpp.

27: CbNavigateNextWaypoint(options), goalWaypointName_(goalWaypointName)
28{
29}
CbNavigateNextWaypoint(const std::optional< NavigateNextWaypointOptions > &options=std::nullopt)

◆ ~CbNavigateNextWaypointUntilReached()

cl_nav2z::CbNavigateNextWaypointUntilReached::~CbNavigateNextWaypointUntilReached ( )
override

Definition at line 31 of file cb_navigate_next_waypoint_until_reached.cpp.

31{}

Member Function Documentation

◆ onEntry()

void cl_nav2z::CbNavigateNextWaypointUntilReached::onEntry ( )
overridevirtual

◆ onExit()

void cl_nav2z::CbNavigateNextWaypointUntilReached::onExit ( )
overridevirtual

Reimplemented from cl_nav2z::CbNavigateNextWaypoint.

Definition at line 40 of file cb_navigate_next_waypoint_until_reached.cpp.

References cl_nav2z::CbNavigateNextWaypoint::onExit().

Here is the call graph for this function:

◆ onNavigationActionSuccess()

void cl_nav2z::CbNavigateNextWaypointUntilReached::onNavigationActionSuccess ( const components::CpNav2ActionInterface::WrappedResult & r)
inlineoverridevirtual

Reimplemented from cl_nav2z::CbNav2ZClientBehaviorBase.

Definition at line 54 of file cb_navigate_next_waypoint_until_reached.hpp.

56 {
57 navigationResult_ = r.code;
58
59 RCLCPP_INFO(
60 getLogger(), "[%s] Propagating success event from action server", getName().c_str());
61
62 // The waypoint this entry navigated to: the navigator has already moved its index to the next one.
63 const auto & current_waypoint_name = sentWaypointName_;
64 const char * current = current_waypoint_name ? current_waypoint_name->c_str() : "(none)";
65
66 if (current_waypoint_name && *current_waypoint_name == this->goalWaypointName_)
67 {
68 RCLCPP_INFO(
69 getLogger(), "[CbNavigateNextWaypointUntilReached] GoalReached, waypoint with name '%s'",
70 current);
71
73 }
74 else
75 {
76 RCLCPP_INFO(
77 getLogger(),
78 "[CbNavigateNextWaypointUntilReached] goal:'%s' current:'%s'. keep navigating.",
79 goalWaypointName_.c_str(), current);
80 }
81
82 this->postSuccessEvent();
83 }
virtual rclcpp::Logger getLogger() const

References smacc2::ISmaccClientBehavior::getLogger(), smacc2::ISmaccClientBehavior::getName(), goalWaypointName_, cl_nav2z::CbNav2ZClientBehaviorBase::navigationResult_, postEvGoalWaypointReached_, smacc2::SmaccAsyncClientBehavior::postSuccessEvent(), and sentWaypointName_.

Here is the call graph for this function:

◆ onStateOrthogonalAllocation()

template<typename TOrthogonal , typename TSourceObject >
void cl_nav2z::CbNavigateNextWaypointUntilReached::onStateOrthogonalAllocation ( )
inline

Member Data Documentation

◆ goalWaypointName_

std::string cl_nav2z::CbNavigateNextWaypointUntilReached::goalWaypointName_
private

◆ postEvGoalWaypointReached_

std::function<void()> cl_nav2z::CbNavigateNextWaypointUntilReached::postEvGoalWaypointReached_
private

◆ sentWaypointName_

std::optional<std::string> cl_nav2z::CbNavigateNextWaypointUntilReached::sentWaypointName_
private

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