Skip to main content

GetOrientedBoundingBoxFromPointCloud Class

Given an input point cloud, finds the oriented bounding box (OBB) using pcl::MomentOfInertiaEstimation and outputs that as a center pose and box dimensions. The OBB orientation is disambiguated by choosing the orientation closest to the reference_pose. More...

Declaration​

class moveit_pro::behaviors::GetOrientedBoundingBoxFromPointCloud { ... }

Included Headers​

#include <get_oriented_bounding_box_from_pointcloud.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​

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

Private Member Functions Index​

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

User-implemented function which handles executing the potentially-long-running 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_

Public Static Functions Index​

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

Description​

Given an input point cloud, finds the oriented bounding box (OBB) using pcl::MomentOfInertiaEstimation and outputs that as a center pose and box dimensions. The OBB orientation is disambiguated by choosing the orientation closest to the reference_pose.

With align_xy_to_reference set, the box keeps the Z axis fitted to the cloud (the surface normal of a flat patch) but takes its X and Y axes from the reference pose, and the dimensions are re-measured along those axes. Use it for a flat patch with no meaningful elongation of its own, such as a region a user drew on a camera image: the principal axes of such a patch follow how perspective skewed it rather than the selection, which tilts the box and inflates it.

Data Port NamePort TypeObject Type
point_cloudinputsensor_msgs::msg::PointCloud2
reference_poseinputgeometry_msgs::msg::PoseStamped
align_xy_to_referenceinputbool
box_center_poseoutputgeometry_msgs::msg::PoseStamped
box_dimensionsoutputstd::vector<double>

Definition at line 36 of file get_oriented_bounding_box_from_pointcloud.hpp.

Public Constructors​

GetOrientedBoundingBoxFromPointCloud()​

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

Declaration at line 39 of file get_oriented_bounding_box_from_pointcloud.hpp, definition at line 114 of file get_oriented_bounding_box_from_pointcloud.cpp.

Private Member Functions​

doWork()​

tl::expected< bool, std::string > moveit_pro::behaviors::GetOrientedBoundingBoxFromPointCloud::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 47 of file get_oriented_bounding_box_from_pointcloud.hpp, definition at line 151 of file get_oriented_bounding_box_from_pointcloud.cpp.

getFuture()​

std::shared_future< tl::expected< bool, std::string > > & moveit_pro::behaviors::GetOrientedBoundingBoxFromPointCloud::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 48 of file get_oriented_bounding_box_from_pointcloud.hpp.

Private Member Attributes​

future_​

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

Definition at line 52 of file get_oriented_bounding_box_from_pointcloud.hpp.

Public Static Functions​

metadata()​

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

Declaration at line 44 of file get_oriented_bounding_box_from_pointcloud.hpp, definition at line 145 of file get_oriented_bounding_box_from_pointcloud.cpp.

providedPorts()​

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

Declaration at line 42 of file get_oriented_bounding_box_from_pointcloud.hpp, definition at line 121 of file get_oriented_bounding_box_from_pointcloud.cpp.


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


Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.