Skip to main content

GetPlanarPoseFromUser Class

Requests an explicitly confirmed planar pose for navigation or localization. More...

Declaration​

class moveit_pro::behaviors::GetPlanarPoseFromUser { ... }

Included Headers​

#include <get_planar_pose_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​

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

Private Member Functions Index​

tl::expected< GetPlanarPoseFromUserSrv::Request, std::string >createRequest () const
tl::expected< moveit_studio_internal_msgs::msg::PlanarWaypointQueue, std::string >createWaypointQueue (std::string_view frame) const
tl::expected< bool, std::string >doWork () override

User-implemented function which handles executing the potentially-long-running process. More...

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

Optionally implement additional work needed to cleanly interrupt the async process. More...

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

Gets the shared future which is used to monitor the progress of the async process. More...

Private Member Attributes Index​

std::shared_future< tl::expected< bool, std::string > >future_
std::shared_ptr< utils::UIRequestResponseClient >request_client_

Public Static Functions Index​

static BT::PortsListprovidedPorts ()
static BT::KeyValueVectormetadata ()

Description​

Requests an explicitly confirmed planar pose for navigation or localization.

Click sets position and drag sets heading; release never confirms. Poses have z=0 and roll/pitch=0 in reference_frame, independent of the display Fixed Frame. An unwired initial_pose starts without heading. A wired seed must be valid in reference_frame; its height and tilt are projected away while preserving forward heading. Invalid seeds fail. Stamps are validated, then cleared for latest TF semantics.

Data Port NamePort TypeObject Type
view_nameinputstd::string
pose_promptinputstd::string
reference_frameinputstd::string
initial_poseinputgeometry_msgs::msg::PoseStamped
confirmed_posesinputstd::vector<BT::Any>
waypoint_countinputint
user_poseoutputgeometry_msgs::msg::PoseStamped

Definition at line 35 of file get_planar_pose_from_user.hpp.

Public Constructors​

GetPlanarPoseFromUser()​

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

See SharedResourcesNode.

config

See SharedResourcesNode.

shared_resources

See SharedResourcesNode.

Declaration at line 43 of file get_planar_pose_from_user.hpp, definition at line 76 of file get_planar_pose_from_user.cpp.

Private Member Functions​

createRequest()​

tl::expected< GetPlanarPoseFromUserSrv::Request, std::string > moveit_pro::behaviors::GetPlanarPoseFromUser::createRequest ()

Declaration at line 49 of file get_planar_pose_from_user.hpp, definition at line 121 of file get_planar_pose_from_user.cpp.

createWaypointQueue()​

tl::expected< moveit_studio_internal_msgs::msg::PlanarWaypointQueue, std::string > moveit_pro::behaviors::GetPlanarPoseFromUser::createWaypointQueue (std::string_view frame)
nodiscard

Declaration at line 51 of file get_planar_pose_from_user.hpp, definition at line 179 of file get_planar_pose_from_user.cpp.

doHalt()​

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

Optionally implement additional work needed to cleanly interrupt the async process.

The default implementation of this function is a no-op which will not interrupt the async process. This will mean that onHalted will wait until the process finishes before returning.

Returns

Return an empty tl::expected<void, std::string> if the additional work to halt was successful. Return an error message if something failed while doing additional work to halt.

Declaration at line 53 of file get_planar_pose_from_user.hpp, definition at line 312 of file get_planar_pose_from_user.cpp.

doWork()​

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

User-implemented function which handles executing the potentially-long-running process.

This function is called within an async process in a separate thread.

Returns

A tl::expected which contains a bool indicating task success if the process completed successfully or was canceled, or an error message if the process failed unexpectedly.

Declaration at line 52 of file get_planar_pose_from_user.hpp, definition at line 255 of file get_planar_pose_from_user.cpp.

getFuture()​

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

Gets the shared future which is used to monitor the progress of the async process.

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

This exists to prevent destruction of the derived class while the async process is still in-progress. If the derived class is destroyed, the definitions of the functions used within doWork() will be destroyed too, which will result in the virtual functions in the base class being called instead and cause a fault.

This function will force derived classes to add an instance of this type and return a reference to it. The base class can then use this virtual function to access the shared future in functions like onStart.

By adding this virtual function we're properly demonstrating how this future depends on things from the derived class and the natural flow of object lifetimes will do the hard work for us. The std::shared_future destructor will get the value of the future before the derived class is destructed assuming it's the last reference to the shared state. Doing it this way means neither the base nor derived class should need to implement a destructor which is a nice property to have.

Returns

Returns the shared_future, which should be owned by the child class.

Definition at line 54 of file get_planar_pose_from_user.hpp.

Private Member Attributes​

future_​

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

Definition at line 58 of file get_planar_pose_from_user.hpp.

request_client_​

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

Definition at line 59 of file get_planar_pose_from_user.hpp.

Public Static Functions​

metadata()​

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

Declaration at line 46 of file get_planar_pose_from_user.hpp, definition at line 109 of file get_planar_pose_from_user.cpp.

providedPorts()​

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

Declaration at line 45 of file get_planar_pose_from_user.hpp, definition at line 84 of file get_planar_pose_from_user.cpp.


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


Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.15.0.