Skip to main content

GenerateCalibrationViews Class

Generates a joint state for each view in a ring of hand-eye calibration views around the end effector's current pose. More...

Declaration

class moveit_pro::behaviors::GenerateCalibrationViews { ... }

Included Headers

#include <generate_calibration_views.hpp>

Base class

classServiceClientBehaviorBase<ServiceT>

A base class for behaviors which need to send a request to a ROS service client and wait for a result. More...

Public Constructors Index

GenerateCalibrationViews (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources)
GenerateCalibrationViews (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources, std::unique_ptr< ClientInterfaceBase< GetPlanningScene > > client_interface)

Private Member Functions Index

tl::expected< std::string, std::string >getServiceName () override

User-provided function to get the name of the service when initializing the service client. More...

tl::expected< GetPlanningScene::Request, std::string >createRequest () override

User-provided function to create the service request. More...

tl::expected< bool, std::string >processResponse (const GetPlanningScene::Response &response) override
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

Generates a joint state for each view in a ring of hand-eye calibration views around the end effector's current pose.

The current pose comes from the planning scene response, so the arm must already be at the starting view. Each view is the current pose tilted about the pivot and then shifted along its own axes by a fixed pattern of up to max_translation, and is solved with IK against that scene. A solution is kept only when it stays in the arm's current posture. The two outputs have the same length and the same order.

Data Port NamePort TypeObject Type
end_effector_frameinputstd::string
joint_group_nameinputstd::string
link_paddinginputdouble
pivot_distanceinputdouble
tilt_angle_deginputdouble
max_translationinputdouble
view_countinputint
waypoint_prefixinputstd::string
joint_statesoutputstd::vector<BT::Any> of moveit_msgs::msg::RobotState
waypoint_namesoutputstd::vector<BT::Any> of std::string

Definition at line 59 of file generate_calibration_views.hpp.

Public Constructors

GenerateCalibrationViews()

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

See SharedResourcesNode

config

See SharedResourcesNode

shared_resources

See SharedResourcesNode

Declaration at line 67 of file generate_calibration_views.hpp, definition at line 96 of file generate_calibration_views.cpp.

GenerateCalibrationViews()

moveit_pro::behaviors::GenerateCalibrationViews::GenerateCalibrationViews (const std::string & name, const BT::NodeConfiguration & config, const std::shared_ptr< BehaviorContext > & shared_resources, std::unique_ptr< ClientInterfaceBase< GetPlanningScene > > client_interface)
Parameters
name

See SharedResourcesNode

config

See SharedResourcesNode

shared_resources

See SharedResourcesNode

client_interface

The planning scene service client to use instead of a real client. Tests inject a mock.

Declaration at line 75 of file generate_calibration_views.hpp, definition at line 103 of file generate_calibration_views.cpp.

Private Member Functions

createRequest()

tl::expected< GetPlanningScene::Request, std::string > moveit_pro::behaviors::GenerateCalibrationViews::createRequest ()
virtual

User-provided function to create the service request.

Returns

Returns a service request message. If not successful, returns an error message. Note that the criteria for success or failure is defined by the user's implementation of this function.

Declaration at line 84 of file generate_calibration_views.hpp, definition at line 153 of file generate_calibration_views.cpp.

getFuture()

std::shared_future< tl::expected< bool, std::string > > & moveit_pro::behaviors::GenerateCalibrationViews::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 87 of file generate_calibration_views.hpp.

getServiceName()

tl::expected< std::string, std::string > moveit_pro::behaviors::GenerateCalibrationViews::getServiceName ()
virtual

User-provided function to get the name of the service when initializing the service client.

Returns

Returns the name of the service. If not successful, returns an error message. Note that the criteria for success or failure is defined by the user's implementation of this function.

Declaration at line 83 of file generate_calibration_views.hpp, definition at line 148 of file generate_calibration_views.cpp.

processResponse()

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

Declaration at line 85 of file generate_calibration_views.hpp, definition at line 158 of file generate_calibration_views.cpp.

Private Member Attributes

future_

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

Definition at line 92 of file generate_calibration_views.hpp.

Public Static Functions

metadata()

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

Declaration at line 80 of file generate_calibration_views.hpp, definition at line 142 of file generate_calibration_views.cpp.

providedPorts()

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

Declaration at line 79 of file generate_calibration_views.hpp, definition at line 111 of file generate_calibration_views.cpp.


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


Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.