Skip to main content

RefineCalibrationBundleAdjustment Class

Jointly refines every camera's hand-eye calibration by minimizing corner reprojection error over the collected samples. More...

Declaration

class moveit_pro::behaviors::RefineCalibrationBundleAdjustment { ... }

Included Headers

#include <refine_calibration_bundle_adjustment.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

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

Constructor for the RefineCalibrationBundleAdjustment Behavior. More...

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

Jointly refines every camera's hand-eye calibration by minimizing corner reprojection error over the collected samples.

Runs the calibration library's bundle adjustment: each listed camera is seeded from its own closed-form solve, then all camera poses and board poses are optimized together over the raw corner observations, using each sample's stored intrinsics. The cameras in one list are assumed to observe the same physical board and share one refined board pose.

Asynchronous because the iterative solve takes well over a tick. Halting waits for the running refinement to finish, whose solver phase the library caps in wall time.

The refinement is summarized as an info message, with a warning when the solver stopped before converging or when the fit stays above rms_reprojection_warn_px.

Data Port NamePort TypeObject Type
samplesinputstd::vector<moveit_pro::hand_eye_calibration::CalibrationSample>
eye_in_hand_camerasinputstd::vector<std::string>
eye_to_hand_camerasinputstd::vector<std::string>
max_iterationsinputint
outlier_threshold_pxinputdouble
rms_reprojection_warn_pxinputdouble
refined_calibrationoutputmoveit_pro::hand_eye_calibration::BundleAdjustmentResult
initial_rms_reprojection_erroroutputdouble
final_rms_reprojection_erroroutputdouble
iterationsoutputint
terminationoutputstd::string

Definition at line 66 of file refine_calibration_bundle_adjustment.hpp.

Public Constructors

RefineCalibrationBundleAdjustment()

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

Constructor for the RefineCalibrationBundleAdjustment Behavior.

Parameters
name

See AsyncBehaviorBase

config

See AsyncBehaviorBase

shared_resources

See AsyncBehaviorBase

Declaration at line 75 of file refine_calibration_bundle_adjustment.hpp, definition at line 124 of file refine_calibration_bundle_adjustment.cpp.

Private Member Functions

doWork()

tl::expected< bool, std::string > moveit_pro::behaviors::RefineCalibrationBundleAdjustment::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 83 of file refine_calibration_bundle_adjustment.hpp, definition at line 172 of file refine_calibration_bundle_adjustment.cpp.

getFuture()

std::shared_future< tl::expected< bool, std::string > > & moveit_pro::behaviors::RefineCalibrationBundleAdjustment::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 85 of file refine_calibration_bundle_adjustment.hpp.

Private Member Attributes

future_

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

Definition at line 90 of file refine_calibration_bundle_adjustment.hpp.

Public Static Functions

metadata()

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

Declaration at line 80 of file refine_calibration_bundle_adjustment.hpp, definition at line 166 of file refine_calibration_bundle_adjustment.cpp.

providedPorts()

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

Declaration at line 78 of file refine_calibration_bundle_adjustment.hpp, definition at line 131 of file refine_calibration_bundle_adjustment.cpp.


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


Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.