Skip to main content

GetPointsFromUser Class

Requests a set of named points from the user by switching the view and displaying a sequence of prompts in the UI. More...

Declaration

class moveit_pro::behaviors::GetPointsFromUser { ... }

Included Headers

#include <get_points_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

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

Construct a new GetPointsFromUser object. More...

Private Member Functions Index

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

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

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

Evaluate the service response message to determine if the service 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

Requests a set of named points from the user by switching the view and displaying a sequence of prompts in the UI.

The list of point prompts can either contain a single element, meaning the same prompt is displayed for each requested point, or it can be the same size as the list of point names, meaning a different prompt is displayed for each point. The output is a list of stamped points, whose X and Y coordinates are normalized pixel coordinates in the range [0..1]. The requested name of each point is contained in the frame ID of its header.

Data Port NamePort TypeObject Type
view_nameInputstd::string
point_namesInputstd::vector<std::string>
point_promptsInputstd::vector<std::string>
pixel_coordsOutputstd::vector<geometry_msgs::msg::PointStamped>

Definition at line 35 of file get_points_from_user.hpp.

Public Constructors

GetPointsFromUser()

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

Construct a new GetPointsFromUser object.

Parameters
name

See SharedResourcesNode

config

See SharedResourcesNode

shared_resources

See SharedResourcesNode

Declaration at line 44 of file get_points_from_user.hpp, definition at line 68 of file get_points_from_user.cpp.

Private Member Functions

createRequest()

tl::expected< RequestPointsFromUser::Request, std::string > moveit_pro::behaviors::GetPointsFromUser::createRequest ()

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

Returns

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

Declaration at line 64 of file get_points_from_user.hpp, definition at line 95 of file get_points_from_user.cpp.

doHalt()

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

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

Returns

An empty success result.

Declaration at line 82 of file get_points_from_user.hpp, definition at line 154 of file get_points_from_user.cpp.

doWork()

tl::expected< bool, std::string > moveit_pro::behaviors::GetPointsFromUser::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 76 of file get_points_from_user.hpp, definition at line 133 of file get_points_from_user.cpp.

getFuture()

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

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

Definition at line 85 of file get_points_from_user.hpp.

processResponse()

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

Evaluate the service response message to determine if the service succeeded or failed.

Returns

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

Declaration at line 70 of file get_points_from_user.hpp, definition at line 122 of file get_points_from_user.cpp.

Private Member Attributes

future_

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

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

Definition at line 91 of file get_points_from_user.hpp.

request_client_

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

Definition at line 92 of file get_points_from_user.hpp.

Public Static Functions

metadata()

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

Returns metadata for this Behavior.

Returns

BT::KeyValueVector The Behavior metadata.

Declaration at line 57 of file get_points_from_user.hpp, definition at line 90 of file get_points_from_user.cpp.

providedPorts()

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

Returns list of ports for this Behavior.

Returns

BT::PortsList The list of I/O Ports

Declaration at line 51 of file get_points_from_user.hpp, definition at line 76 of file get_points_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.