Skip to main content

GetTextFromUser Class

Gets text from user by sending a list of prompts with default values for each prompt. More...

Declaration

class moveit_pro::behaviors::GetTextFromUser { ... }

Included Headers

#include <get_text_from_user.hpp>

Base class

classAsyncBehaviorBase

A base class for behaviors which need to asynchronously run a function that might take a long time to complete. More...

Public Constructors Index

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

Construct a new GetTextFromUser object. More...

Private Member Functions Index

tl::expected< RequestTextFromUser::Request, std::string >createRequest () const

Compose a RequestTextFromUser::Request message from the input port values specified. More...

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

Evaluate the UI response message to determine if the prompt succeeded or failed. More...

tl::expected< bool, std::string >doWork () override

Publish the UI prompt request and wait for the correlated response. More...

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

Cancel the in-flight UI prompt request when the Behavior is halted. 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...

Private Member Attributes Index

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

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

std::shared_ptr< utils::UIRequestResponseClient >request_client_

Public Static Functions Index

static BT::PortsListprovidedPorts ()

Returns list of ports for this Behavior. More...

static BT::KeyValueVectormetadata ()

Returns metadata for this Behavior. More...

Description

Gets text from user by sending a list of prompts with default values for each prompt.

The prompts, values, and text_output ports should all be a vector of the same length.

Data Port NamePort TypeObject Type
promptsinputstd::vector<std::string>
default_valuesinputstd::vector<std::string>
text_outputoutputstd::vector<std::string>

Definition at line 30 of file get_text_from_user.hpp.

Public Constructors

GetTextFromUser()

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

Construct a new GetTextFromUser object.

Parameters
name

See SharedResourcesNode

config

See SharedResourcesNode

shared_resources

See SharedResourcesNode

Declaration at line 39 of file get_text_from_user.hpp, definition at line 62 of file get_text_from_user.cpp.

Private Member Functions

createRequest()

tl::expected< RequestTextFromUser::Request, std::string > moveit_pro::behaviors::GetTextFromUser::createRequest ()

Compose a RequestTextFromUser::Request message from the input port values specified.

Returns

Returns the request message if successful. If not successful, returns an error message.

Declaration at line 59 of file get_text_from_user.hpp, definition at line 83 of file get_text_from_user.cpp.

doHalt()

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

Cancel the in-flight UI prompt request when the Behavior is halted.

Returns

An empty success result.

Declaration at line 78 of file get_text_from_user.hpp, definition at line 150 of file get_text_from_user.cpp.

doWork()

tl::expected< bool, std::string > moveit_pro::behaviors::GetTextFromUser::doWork ()
virtual

Publish the UI prompt request and wait for the correlated response.

Returns

If the prompt flow succeeded, returns true. If it failed, returns an error message.

Declaration at line 72 of file get_text_from_user.hpp, definition at line 130 of file get_text_from_user.cpp.

getFuture()

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

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

Definition at line 81 of file get_text_from_user.hpp.

processResponse()

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

Evaluate the UI response message to determine if the prompt succeeded or failed.

Parameters
response

The response returned from the UI prompt flow.

Returns

If the prompt succeeded, returns true. If the prompt did not succeed, returns an error message.

Declaration at line 66 of file get_text_from_user.hpp, definition at line 105 of file get_text_from_user.cpp.

Private Member Attributes

future_

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

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

Definition at line 87 of file get_text_from_user.hpp.

request_client_

std::shared_ptr<utils::UIRequestResponseClient> moveit_pro::behaviors::GetTextFromUser::request_client_

Definition at line 88 of file get_text_from_user.hpp.

Public Static Functions

metadata()

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

Returns metadata for this Behavior.

Returns

BT::KeyValueVector The Behavior metadata.

Declaration at line 52 of file get_text_from_user.hpp, definition at line 78 of file get_text_from_user.cpp.

providedPorts()

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

Returns list of ports for this Behavior.

Returns

BT::PortsList The list of I/O Ports

Declaration at line 46 of file get_text_from_user.hpp, definition at line 70 of file get_text_from_user.cpp.


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


Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.