Skip to main content

RetrieveRobotStateParameter Class

Retrieves a joint state from the MoveIt Pro parameter manager node. More...

Declaration

class moveit_pro::behaviors::RetrieveRobotStateParameter { ... }

Included Headers

#include <retrieve_robot_state_parameter.hpp>

Base class

classServiceClientBehaviorBase<ServiceT>

A base class for behaviors which need to send a request to a ROS service client and wait for a result. More...

Public Constructors Index

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

Constructor for RetrieveRobotStateParameter behavior. More...

RetrieveRobotStateParameter (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources, std::unique_ptr< ClientInterfaceBase< RetrieveRobotState > > client_interface)

Constructor for RetrieveRobotStateParameter behavior that allows for mocking of the service client. More...

Private Member Functions Index

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

Get the name of the service. More...

tl::expected< RetrieveRobotState::Request, std::string >createRequest () override

Create the service request message. More...

tl::expected< bool, std::string >processResponse (const RetrieveRobotState::Response &response) override

Handles the service response message once the service finishes. More...

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

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

tl::expected< void, std::string >doHalt () override

Implementation of the doHalt method that calls clear_stored_parameters service when halted. More...

Private Member Attributes Index

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

Holds the result of calling the service asynchronously. More...

Public Static Functions Index

static BT::PortsListprovidedPorts ()

Required implementation of the static providedPorts function. More...

static BT::KeyValueVectormetadata ()

Description

Retrieves a joint state from the MoveIt Pro parameter manager node.

If no parameter is retrieved within the provided "timeout_sec" parameter, this Behavior returns FAILURE. Specifying zero timeout (default) makes this Behavior wait indefinitely to retrieve the parameter.

Data Port NamePort TypeObject Type
timeout_secinputdouble
joint_stateoutputmoveit_msgs::msg::RobotState

Definition at line 30 of file retrieve_robot_state_parameter.hpp.

Public Constructors

RetrieveRobotStateParameter()

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

Constructor for RetrieveRobotStateParameter behavior.

Parameters
name

See SharedResourcesNode

config

See SharedResourcesNode

shared_resources

See SharedResourcesNode

Declaration at line 39 of file retrieve_robot_state_parameter.hpp, definition at line 40 of file retrieve_robot_state_parameter.cpp.

RetrieveRobotStateParameter()

moveit_pro::behaviors::RetrieveRobotStateParameter::RetrieveRobotStateParameter (const std::string & name, const BT::NodeConfiguration & config, const std::shared_ptr< BehaviorContext > & shared_resources, std::unique_ptr< ClientInterfaceBase< RetrieveRobotState > > client_interface)
explicit

Constructor for RetrieveRobotStateParameter behavior that allows for mocking of the service client.

Parameters
name

See SharedResourcesNode

config

See SharedResourcesNode

shared_resources

See SharedResourcesNode

client_interface

Service client interface, allowing a mock to be injected in tests.

Declaration at line 49 of file retrieve_robot_state_parameter.hpp, definition at line 46 of file retrieve_robot_state_parameter.cpp.

Private Member Functions

createRequest()

tl::expected< RetrieveRobotState::Request, std::string > moveit_pro::behaviors::RetrieveRobotStateParameter::createRequest ()
virtual

Create the service request message.

Returns

a RetrieveRobotState request message with the specified timeout.

Declaration at line 73 of file retrieve_robot_state_parameter.hpp, definition at line 73 of file retrieve_robot_state_parameter.cpp.

doHalt()

tl::expected< void, std::string > moveit_pro::behaviors::RetrieveRobotStateParameter::doHalt ()
virtual

Implementation of the doHalt method that calls clear_stored_parameters service when halted.

Declaration at line 94 of file retrieve_robot_state_parameter.hpp, definition at line 102 of file retrieve_robot_state_parameter.cpp.

getFuture()

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

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

Definition at line 83 of file retrieve_robot_state_parameter.hpp.

getServiceName()

tl::expected< std::string, std::string > moveit_pro::behaviors::RetrieveRobotStateParameter::getServiceName ()
virtual

Get the name of the service.

For this behavior the service name is always "/retrieve_joint_state".

Returns

Returns the service name. Since the service name is set to a constant value, this always succeeds.

Declaration at line 67 of file retrieve_robot_state_parameter.hpp, definition at line 68 of file retrieve_robot_state_parameter.cpp.

processResponse()

tl::expected< bool, std::string > moveit_pro::behaviors::RetrieveRobotStateParameter::processResponse (const RetrieveRobotState::Response & response)

Handles the service response message once the service finishes.

Returns

Returns an error result if the service finished but did not succeed, since this is treated as an unexpected error state. Otherwise, returns true.

Declaration at line 80 of file retrieve_robot_state_parameter.hpp, definition at line 88 of file retrieve_robot_state_parameter.cpp.

Private Member Attributes

response_future_

std::shared_future<tl::expected<bool, std::string> > moveit_pro::behaviors::RetrieveRobotStateParameter::response_future_

Holds the result of calling the service asynchronously.

Definition at line 89 of file retrieve_robot_state_parameter.hpp.

Public Static Functions

metadata()

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

Declaration at line 59 of file retrieve_robot_state_parameter.hpp, definition at line 62 of file retrieve_robot_state_parameter.cpp.

providedPorts()

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

Required implementation of the static providedPorts function.

Returns

The list of input and output ports used by this Behavior.

Declaration at line 57 of file retrieve_robot_state_parameter.hpp, definition at line 54 of file retrieve_robot_state_parameter.cpp.


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


Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.