SMACC2
Loading...
Searching...
No Matches
Public Member Functions | List of all members
cl_moveit2z::CbDetachObject Class Reference

#include <cb_detach_object.hpp>

Inheritance diagram for cl_moveit2z::CbDetachObject:
Inheritance graph
Collaboration diagram for cl_moveit2z::CbDetachObject:
Collaboration graph

Public Member Functions

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

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 30 of file cb_detach_object.hpp.

Member Function Documentation

◆ onEntry()

void cl_moveit2z::CbDetachObject::onEntry ( )
overridevirtual

Reimplemented from smacc2::ISmaccClientBehavior.

Definition at line 26 of file cb_detach_object.cpp.

27{
28 RCLCPP_INFO_STREAM(getLogger(), "[" << getName() << "] requesting components");
29
30 cl_moveit2z::CpGraspingComponent * graspingComponent;
31 this->requiresComponent(graspingComponent);
32
33 cl_moveit2z::ClMoveit2z * moveGroupClient;
34 this->requiresClient(moveGroupClient);
35
36 auto & planningSceneInterface = moveGroupClient->planningSceneInterface;
37
38 RCLCPP_INFO_STREAM(getLogger(), "[" << getName() << "] requesting detach object");
39
40 auto res = moveGroupClient->moveGroupClientInterface->detachObject(
41 *(graspingComponent->currentAttachedObjectName));
42 planningSceneInterface->removeCollisionObjects({*(graspingComponent->currentAttachedObjectName)});
43
44 RCLCPP_INFO_STREAM(getLogger(), "[" << getName() << "] detach result: " << res);
45
46 if (res)
47 this->postSuccessEvent();
48 else
49 this->postFailureEvent();
50}
std::shared_ptr< moveit::planning_interface::MoveGroupInterface > moveGroupClientInterface
std::shared_ptr< moveit::planning_interface::PlanningSceneInterface > planningSceneInterface
std::optional< std::string > currentAttachedObjectName
virtual rclcpp::Logger getLogger() const
void requiresClient(SmaccClientType *&storage)
void requiresComponent(SmaccComponentType *&storage, bool throwExceptionIfNotExist=false)

References cl_moveit2z::CpGraspingComponent::currentAttachedObjectName, smacc2::ISmaccClientBehavior::getLogger(), smacc2::ISmaccClientBehavior::getName(), cl_moveit2z::ClMoveit2z::moveGroupClientInterface, cl_moveit2z::ClMoveit2z::planningSceneInterface, smacc2::SmaccAsyncClientBehavior::postFailureEvent(), smacc2::SmaccAsyncClientBehavior::postSuccessEvent(), smacc2::ISmaccClientBehavior::requiresClient(), and smacc2::ISmaccClientBehavior::requiresComponent().

Here is the call graph for this function:

◆ onExit()

void cl_moveit2z::CbDetachObject::onExit ( )
overridevirtual

Reimplemented from smacc2::ISmaccClientBehavior.

Definition at line 52 of file cb_detach_object.cpp.

52{}

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