SMACC2
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
cl_nav2z::CbResumeSlam Class Reference

#include <cb_resume_slam.hpp>

Inheritance diagram for cl_nav2z::CbResumeSlam:
Inheritance graph
Collaboration diagram for cl_nav2z::CbResumeSlam:
Collaboration graph

Public Member Functions

 CbResumeSlam (std::string serviceName="/slam_toolbox/pause_new_measurements")
 
void onEntry () override
 
- Public Member Functions inherited from smacc2::client_behaviors::CbServiceCall< slam_toolbox::srv::Pause >
 CbServiceCall (const char *serviceName)
 
 CbServiceCall (const char *serviceName, std::shared_ptr< typename ServiceType::Request > request, std::chrono::milliseconds pollRate=100ms)
 
void onEntry () override
 
- Public Member Functions inherited from smacc2::SmaccAsyncClientBehavior
template<typename TOrthogonal , typename TSourceObject >
void onOrthogonalAllocation ()
 
virtual ~SmaccAsyncClientBehavior ()
 
template<typename TCallback , typename T >
boost::signals2::connection onSuccess (TCallback callback, T *object)
 
template<typename TCallback , typename T >
boost::signals2::connection onFinished (TCallback callback, T *object)
 
template<typename TCallback , typename T >
boost::signals2::connection onFailure (TCallback callback, T *object)
 
void requestForceFinish ()
 
void executeOnEntry () override
 
void executeOnExit () override
 
void waitOnEntryThread (bool requestFinish)
 
template<typename TCallbackMethod , typename T >
boost::signals2::connection onSuccess (TCallbackMethod callback, T *object)
 
template<typename TCallbackMethod , typename T >
boost::signals2::connection onFinished (TCallbackMethod callback, T *object)
 
template<typename TCallbackMethod , typename T >
boost::signals2::connection onFailure (TCallbackMethod callback, T *object)
 
- Public Member Functions inherited from smacc2::ISmaccClientBehavior
 ISmaccClientBehavior ()
 
virtual ~ISmaccClientBehavior ()
 
ISmaccStateMachinegetStateMachine ()
 
std::string getName () const
 
template<typename SmaccClientType >
void requiresClient (SmaccClientType *&storage)
 
template<typename SmaccComponentType >
void requiresComponent (SmaccComponentType *&storage, bool throwExceptionIfNotExist=false)
 
virtual void onExit ()
 

Protected Attributes

CpSlamToolboxslam_
 
- Protected Attributes inherited from smacc2::client_behaviors::CbServiceCall< slam_toolbox::srv::Pause >
std::shared_ptr< rclcpp::Client< slam_toolbox::srv::Pause > > client_
 
std::string serviceName_
 
std::shared_ptr< typename ServiceType::Request > request_
 

Additional Inherited Members

- Public Attributes inherited from smacc2::client_behaviors::CbServiceCall< slam_toolbox::srv::Pause >
std::shared_future< std::shared_ptr< typename ServiceType::Response > > resultFuture_
 
std::shared_ptr< typename ServiceType::Response > result_
 
std::chrono::milliseconds pollRate_
 
- Protected Member Functions inherited from smacc2::client_behaviors::CbServiceCall< slam_toolbox::srv::Pause >
virtual void onServiceResponse (std::shared_ptr< typename ServiceType::Response >)
 
- Protected Member Functions inherited from smacc2::SmaccAsyncClientBehavior
void postSuccessEvent ()
 
void postFailureEvent ()
 
virtual 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 ()
 
ISmaccStategetCurrentState ()
 
virtual rclcpp::Node::SharedPtr getNode () const
 
virtual rclcpp::Logger getLogger () const
 

Detailed Description

Definition at line 28 of file cb_resume_slam.hpp.

Constructor & Destructor Documentation

◆ CbResumeSlam()

cl_nav2z::CbResumeSlam::CbResumeSlam ( std::string  serviceName = "/slam_toolbox/pause_new_measurements")

Member Function Documentation

◆ onEntry()

void cl_nav2z::CbResumeSlam::onEntry ( )
overridevirtual

Reimplemented from smacc2::ISmaccClientBehavior.

Definition at line 29 of file cb_resume_slam.cpp.

30{
31 this->requiresComponent(this->slam_);
32
33 auto currentState = slam_->getState();
34
36 {
37 RCLCPP_INFO(
38 getLogger(), "[CbResumeSlam] calling pause service to toggle from paused to resumed");
39 this->request_ = std::make_shared<slam_toolbox::srv::Pause::Request>();
41 this->slam_->toogleState();
42 }
43 else
44 {
45 this->request_ = nullptr;
46 RCLCPP_INFO(
47 getLogger(), "[CbResumeSlam] calling skipped. The current slam state is already resumed.");
48 }
49}
SlamToolboxState getState()
virtual rclcpp::Logger getLogger() const
void requiresComponent(SmaccComponentType *&storage, bool throwExceptionIfNotExist=false)
std::shared_ptr< typename ServiceType::Request > request_

References smacc2::ISmaccClientBehavior::currentState, smacc2::ISmaccClientBehavior::getLogger(), cl_nav2z::CpSlamToolbox::getState(), smacc2::client_behaviors::CbServiceCall< ServiceType >::onEntry(), cl_nav2z::CpSlamToolbox::Paused, smacc2::client_behaviors::CbServiceCall< slam_toolbox::srv::Pause >::request_, smacc2::ISmaccClientBehavior::requiresComponent(), slam_, and cl_nav2z::CpSlamToolbox::toogleState().

Here is the call graph for this function:

Member Data Documentation

◆ slam_

CpSlamToolbox* cl_nav2z::CbResumeSlam::slam_
protected

Definition at line 35 of file cb_resume_slam.hpp.

Referenced by onEntry().


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