Skip to main content

MoveGripperAction Class

Actuate a gripper through its driver node's GripperCommand action. Given the name of the action topic and a target gripper position, move the gripper to the specified position. More...

Declaration​

class moveit_pro::behaviors::MoveGripperAction { ... }

Included Headers​

#include <move_gripper_action.hpp>

Base class​

classActionClientBehaviorBase<ActionT>

A base class for behaviors which need to send a goal to a ROS action client and wait for a result. If the behavior is halted before the action result is received, the action goal will be canceled. More...

Public Constructors Index​

MoveGripperAction (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources)

Constructor for MoveGripperAction behavior. More...

Public Member Functions Index​

std::stringgetTimeoutMessage () const override

Optional user-provided function to surface error message due to timeout. More...

Private Member Functions Index​

tl::expected< std::string, std::string >getActionName () override

Defines the action name by getting the value from the gripper_command_action_name input data port. More...

tl::expected< std::chrono::duration< double >, std::string >getResultTimeout () override

Sets the maximum duration to wait for the gripper action goal to succeed before failing. More...

tl::expected< GripperCommand::Goal, std::string >createGoal () override

Creates the action goal by getting the target gripper position from the position input data port. More...

std::shared_future< tl::expected< bool, std::string > > &getFuture () override

Classes derived from ActionClientBehaviorBase must implement getFuture() so that it returns a shared_future class member. More...

Private Member Attributes Index​

std::shared_future< tl::expected< bool, std::string > >future_

Classes derived from ActionClientBehaviorBase must have this shared_future as a class member. More...

Public Static Functions Index​

static BT::PortsListprovidedPorts ()

Custom tree nodes that have input and/or output ports must define them in this static function. More...

static BT::KeyValueVectormetadata ()

Description​

Actuate a gripper through its driver node's GripperCommand action. Given the name of the action topic and a target gripper position, move the gripper to the specified position.

Data Port NamePort TypeObject Type
gripper_command_action_nameInputstd::string
positionInputdouble
timeoutInputdouble

Definition at line 28 of file move_gripper_action.hpp.

Public Constructors​

MoveGripperAction()​

moveit_pro::behaviors::MoveGripperAction::MoveGripperAction (const std::string & name, const BT::NodeConfiguration & config, const std::shared_ptr< BehaviorContext > & shared_resources)

Constructor for MoveGripperAction behavior.

Parameters
name

Name of the node. Must match the name used for this node in the behavior tree definition file (the .xml file).

config

Node configuration. Only used here because the BehaviorTree.CPP expects constructor signature with name and config first before custom constructor parameters.

shared_resources

Provides access to common resources such as the node handle and failure logger that are shared between all the behaviors that inherit from moveit_pro::behaviors::SharedResourcesNode.

Declaration at line 40 of file move_gripper_action.hpp, definition at line 28 of file move_gripper_action.cpp.

Public Member Functions​

getTimeoutMessage()​

std::string moveit_pro::behaviors::MoveGripperAction::getTimeoutMessage ()
virtual

Optional user-provided function to surface error message due to timeout.

Declaration at line 53 of file move_gripper_action.hpp, definition at line 90 of file move_gripper_action.cpp.

Private Member Functions​

createGoal()​

tl::expected< GripperCommand::Goal, std::string > moveit_pro::behaviors::MoveGripperAction::createGoal ()
virtual

Creates the action goal by getting the target gripper position from the position input data port.

Returns

Returns the action goal message if successful.

Declaration at line 74 of file move_gripper_action.hpp, definition at line 74 of file move_gripper_action.cpp.

getActionName()​

tl::expected< std::string, std::string > moveit_pro::behaviors::MoveGripperAction::getActionName ()
virtual

Defines the action name by getting the value from the gripper_command_action_name input data port.

Returns

The name of the action for the GripperCommand action client.

Declaration at line 60 of file move_gripper_action.hpp, definition at line 47 of file move_gripper_action.cpp.

getFuture()​

std::shared_future< tl::expected< bool, std::string > > & moveit_pro::behaviors::MoveGripperAction::getFuture ()
inline virtual

Classes derived from ActionClientBehaviorBase must implement getFuture() so that it returns a shared_future class member.

Definition at line 77 of file move_gripper_action.hpp.

getResultTimeout()​

tl::expected< std::chrono::duration< double >, std::string > moveit_pro::behaviors::MoveGripperAction::getResultTimeout ()
virtual

Sets the maximum duration to wait for the gripper action goal to succeed before failing.

This returns a constant duration which isn't configurable by the end user. The main purpose of this timeout is to make sure objective execution does not get stuck forever if the gripper action server becomes unresponsive.

Returns

The timeout duration.

Declaration at line 68 of file move_gripper_action.hpp, definition at line 62 of file move_gripper_action.cpp.

Private Member Attributes​

future_​

std::shared_future<tl::expected<bool, std::string> > moveit_pro::behaviors::MoveGripperAction::future_

Classes derived from ActionClientBehaviorBase must have this shared_future as a class member.

Definition at line 83 of file move_gripper_action.hpp.

Public Static Functions​

metadata()​

BT::KeyValueVector moveit_pro::behaviors::MoveGripperAction::metadata ()
static

Declaration at line 50 of file move_gripper_action.hpp, definition at line 42 of file move_gripper_action.cpp.

providedPorts()​

BT::PortsList moveit_pro::behaviors::MoveGripperAction::providedPorts ()
static

Custom tree nodes that have input and/or output ports must define them in this static function.

This function must be static. It is a requirement set by the BehaviorTree.CPP library.

Returns

List of ports with the names and port info. The return value is for the internal use of the behavior tree.

Declaration at line 48 of file move_gripper_action.hpp, definition at line 34 of file move_gripper_action.cpp.


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


Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.