SMACC2
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
cl_nitrosz::CbActiveStop Struct Reference

#include <cb_active_stop.hpp>

Inheritance diagram for cl_nitrosz::CbActiveStop:
Inheritance graph
Collaboration diagram for cl_nitrosz::CbActiveStop:
Collaboration graph

Public Member Functions

 CbActiveStop ()
 
void onEntry () override
 
void onExit () 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)
 

Private Attributes

rclcpp::Publisher< geometry_msgs::msg::Twist >::SharedPtr cmd_vel_pub_
 

Additional Inherited Members

- 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_active_stop.hpp.

Constructor & Destructor Documentation

◆ CbActiveStop()

cl_nitrosz::CbActiveStop::CbActiveStop ( )

Definition at line 29 of file cb_active_stop.cpp.

29{}

Member Function Documentation

◆ onEntry()

void cl_nitrosz::CbActiveStop::onEntry ( )
overridevirtual

Reimplemented from smacc2::ISmaccClientBehavior.

Definition at line 31 of file cb_active_stop.cpp.

32{
33 auto nh = this->getNode();
34 cmd_vel_pub_ = nh->create_publisher<geometry_msgs::msg::Twist>("/cmd_vel", rclcpp::QoS(1));
35
36 rclcpp::Rate loop_rate(5);
37 geometry_msgs::msg::Twist cmd_vel_msg;
38 while (!this->isShutdownRequested())
39 {
40 cmd_vel_msg.linear.x = 0;
41 cmd_vel_msg.angular.z = 0;
42
43 cmd_vel_pub_->publish(cmd_vel_msg);
44 loop_rate.sleep();
45 }
46 RCLCPP_INFO_STREAM(getLogger(), "[" << getName() << "] Finished behavior execution");
47
48 this->postSuccessEvent();
49}
virtual rclcpp::Logger getLogger() const
virtual rclcpp::Node::SharedPtr getNode() const
bool isShutdownRequested()
onEntry is executed in a new thread. However the current state cannot be left until the onEntry threa...
rclcpp::Publisher< geometry_msgs::msg::Twist >::SharedPtr cmd_vel_pub_

References cmd_vel_pub_, smacc2::ISmaccClientBehavior::getLogger(), smacc2::ISmaccClientBehavior::getName(), smacc2::ISmaccClientBehavior::getNode(), smacc2::SmaccAsyncClientBehavior::isShutdownRequested(), and smacc2::SmaccAsyncClientBehavior::postSuccessEvent().

Here is the call graph for this function:

◆ onExit()

void cl_nitrosz::CbActiveStop::onExit ( )
overridevirtual

Reimplemented from smacc2::ISmaccClientBehavior.

Definition at line 51 of file cb_active_stop.cpp.

51{}

Member Data Documentation

◆ cmd_vel_pub_

rclcpp::Publisher<geometry_msgs::msg::Twist>::SharedPtr cl_nitrosz::CbActiveStop::cmd_vel_pub_
private

Definition at line 31 of file cb_active_stop.hpp.

Referenced by onEntry().


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