SMACC2
Public Member Functions | Public Attributes | List of all members
cl_move_group_interface::CbAttachObject Class Reference

#include <cb_attach_object.hpp>

Inheritance diagram for cl_move_group_interface::CbAttachObject:
Inheritance graph
Collaboration diagram for cl_move_group_interface::CbAttachObject:
Collaboration graph

Public Member Functions

 CbAttachObject (std::string targetObjectName)
 
 CbAttachObject ()
 
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)
 
- 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)
 

Public Attributes

std::string targetObjectName_
 

Additional Inherited Members

- Protected Member Functions inherited from smacc2::SmaccAsyncClientBehavior
void postSuccessEvent ()
 
void postFailureEvent ()
 
virtual void dispose () override
 
bool isShutdownRequested ()
 
- Protected Member Functions inherited from smacc2::ISmaccClientBehavior
virtual void runtimeConfigure ()
 
virtual void onEntry ()
 
virtual void onExit ()
 
template<typename EventType >
void postEvent (const EventType &ev)
 
template<typename EventType >
void postEvent ()
 
ISmaccStategetCurrentState ()
 
virtual void dispose ()
 
virtual rclcpp::Node::SharedPtr getNode ()
 
virtual rclcpp::Logger getLogger ()
 

Detailed Description

Definition at line 28 of file cb_attach_object.hpp.

Constructor & Destructor Documentation

◆ CbAttachObject() [1/2]

cl_move_group_interface::CbAttachObject::CbAttachObject ( std::string  targetObjectName)

Definition at line 26 of file cb_attach_object.cpp.

26 : targetObjectName_(targetObjectName)
27{
28}

◆ CbAttachObject() [2/2]

cl_move_group_interface::CbAttachObject::CbAttachObject ( )

Definition at line 30 of file cb_attach_object.cpp.

30{}

Member Function Documentation

◆ onEntry()

void cl_move_group_interface::CbAttachObject::onEntry ( )
overridevirtual

Reimplemented from smacc2::ISmaccClientBehavior.

Definition at line 32 of file cb_attach_object.cpp.

33{
35 this->requiresClient(moveGroup);
36
38 this->requiresComponent(graspingComponent);
39
40 // auto cubepos = cubeinfo->pose_->toPoseStampedMsg();
41
42 moveit_msgs::msg::CollisionObject targetCollisionObject;
43
44 bool found = graspingComponent->getGraspingObject(targetObjectName_, targetCollisionObject);
45
46 if (found)
47 {
48 targetCollisionObject.operation = moveit_msgs::msg::CollisionObject::ADD;
49 targetCollisionObject.header.stamp = getNode()->now();
50
51 moveGroup->planningSceneInterface->applyCollisionObject(targetCollisionObject);
52 // collisionObjects.push_back(cubeCollision);
53
55 moveGroup->moveGroupClientInterface->attachObject(
56 targetObjectName_, graspingComponent->gripperLink_, graspingComponent->fingerTipNames);
57
58 RCLCPP_INFO_STREAM(getLogger(), "[" << getName() << "] Grasping objectfound. attach request.");
59
60 this->postSuccessEvent();
61 }
62 else
63 {
64 RCLCPP_WARN_STREAM(
65 getLogger(), "[" << getName() << "] Grasping object was not found. Ignoring attach request.");
66
67 this->postFailureEvent();
68 }
69}
std::shared_ptr< moveit::planning_interface::MoveGroupInterface > moveGroupClientInterface
std::shared_ptr< moveit::planning_interface::PlanningSceneInterface > planningSceneInterface
std::optional< std::string > currentAttachedObjectName
bool getGraspingObject(std::string name, moveit_msgs::msg::CollisionObject &object)
virtual rclcpp::Node::SharedPtr getNode()
void requiresClient(SmaccClientType *&storage)
void requiresComponent(SmaccComponentType *&storage)

References cl_move_group_interface::CpGraspingComponent::currentAttachedObjectName, cl_move_group_interface::CpGraspingComponent::fingerTipNames, cl_move_group_interface::CpGraspingComponent::getGraspingObject(), smacc2::ISmaccClientBehavior::getLogger(), smacc2::ISmaccClientBehavior::getName(), smacc2::ISmaccClientBehavior::getNode(), cl_move_group_interface::CpGraspingComponent::gripperLink_, cl_move_group_interface::ClMoveGroup::moveGroupClientInterface, cl_move_group_interface::ClMoveGroup::planningSceneInterface, smacc2::SmaccAsyncClientBehavior::postFailureEvent(), smacc2::SmaccAsyncClientBehavior::postSuccessEvent(), smacc2::ISmaccClientBehavior::requiresClient(), smacc2::ISmaccClientBehavior::requiresComponent(), and targetObjectName_.

Here is the call graph for this function:

◆ onExit()

void cl_move_group_interface::CbAttachObject::onExit ( )
overridevirtual

Reimplemented from smacc2::ISmaccClientBehavior.

Definition at line 71 of file cb_attach_object.cpp.

71{}

Member Data Documentation

◆ targetObjectName_

std::string cl_move_group_interface::CbAttachObject::targetObjectName_

Definition at line 39 of file cb_attach_object.hpp.

Referenced by onEntry().


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