CropPosesToPointCloudFootprint Class
Keeps only the poses that lie over the area a point cloud covers. More...
Declaration
Included Headers
Base class
| class | AsyncBehaviorBase |
|
A base class for behaviors which need to asynchronously run a function that might take a long time to complete. More... | |
Public Constructors Index
| CropPosesToPointCloudFootprint (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::PortsList | providedPorts () |
| static BT::KeyValueVector | metadata () |
Description
Keeps only the poses that lie over the area a point cloud covers.
Fits a plane to the cloud, projects both the cloud and each pose onto it, and keeps a pose when its projection falls inside the cloud's convex footprint. Intended to hold a coverage path to the region an operator selected: a raster is generated over the region's bounding box, and the corners of that box reach past the selection whenever perspective skewed it into a non-rectangular patch.
The projection plane is a least-squares fit through every point, so the cloud is expected to lie on one surface already; run ExtractDominantPlaneFromPointCloud first when it may not, or the footprint is measured in a plane tilted away from the surface.
The footprint is convex, so it meets any raster line in a single interval: cropping shortens a line but never splits one, which is what keeps a boustrophedon path continuous. It does mean the connector between two surviving lines is no longer one line spacing but a diagonal traverse of up to the footprint width, which a Cartesian planner interpolates far longer than the raster's point spacing — validate the planned trajectory rather than assuming the raster's density survives. Being convex, the footprint also spans holes in the cloud, so poses over a sensor dropout are kept.
Poses and cloud must share a frame; no TF lookup is performed. The Behavior fails when the cropped result is empty, since an empty path is not plannable.
| Data Port Name | Port Type | Object Type |
|---|---|---|
| poses | input | std::vector<geometry_msgs::msg::PoseStamped> |
| point_cloud | input | sensor_msgs::msg::PointCloud2 |
| margin | input | double |
| poses_cropped | output | std::vector<geometry_msgs::msg::PoseStamped> |
- Parameters
-
name The name of this Behavior.
config The configuration options for this Behavior.
shared_resources The shared resources common to all Behaviors.
Definition at line 91 of file crop_poses_to_pointcloud_footprint.hpp.
Public Constructors
CropPosesToPointCloudFootprint()
|
Declaration at line 94 of file crop_poses_to_pointcloud_footprint.hpp, definition at line 141 of file crop_poses_to_pointcloud_footprint.cpp.
Private Member Functions
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 102 of file crop_poses_to_pointcloud_footprint.hpp, definition at line 170 of file crop_poses_to_pointcloud_footprint.cpp.
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 103 of file crop_poses_to_pointcloud_footprint.hpp.
Private Member Attributes
future_
|
Definition at line 107 of file crop_poses_to_pointcloud_footprint.hpp.
Public Static Functions
metadata()
| static |
Declaration at line 99 of file crop_poses_to_pointcloud_footprint.hpp, definition at line 164 of file crop_poses_to_pointcloud_footprint.cpp.
providedPorts()
| static |
Declaration at line 97 of file crop_poses_to_pointcloud_footprint.hpp, definition at line 148 of file crop_poses_to_pointcloud_footprint.cpp.
The documentation for this class was generated from the following files:
Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.