Skip to main content

ResetPlanningSceneObjects Class

Uses the service provided by the ApplyPlanningScene MoveGroup capability plugin to remove all objects which were added to the planning scene, including objects that are attached to the robot. More...

Declaration

class moveit_pro::behaviors::ResetPlanningSceneObjects { ... }

Included Headers

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

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

Private Member Functions Index

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

Returns the name of the ApplyPlanningScene service to call. More...

tl::expected< std::chrono::duration< double >, std::string >getResponseTimeout () override

Returns the maximum duration to wait for a response from the ApplyPlanningScene service. More...

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

Creates an ApplyPlanningScene service request that clears all objects from the planning scene. More...

tl::expected< bool, std::string >processResponse (const ApplyPlanningScene::Response &response) override

Processes the ApplyPlanningScene service response and returns whether the scene was successfully reset. 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

Uses the service provided by the ApplyPlanningScene MoveGroup capability plugin to remove all objects which were added to the planning scene, including objects that are attached to the robot.

Data Port NamePort TypeObject Type
apply_planning_scene_serviceInputstd::string
service_response_timeoutInputdouble

Definition at line 26 of file reset_planning_scene_objects.hpp.

Public Constructors

ResetPlanningSceneObjects()

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

Declaration at line 29 of file reset_planning_scene_objects.hpp, definition at line 27 of file reset_planning_scene_objects.cpp.

ResetPlanningSceneObjects()

moveit_pro::behaviors::ResetPlanningSceneObjects::ResetPlanningSceneObjects (const std::string & name, const BT::NodeConfiguration & config, const std::shared_ptr< BehaviorContext > & shared_resources, std::unique_ptr< ClientInterfaceBase< ApplyPlanningScene > > client_interface)
explicit

Declaration at line 32 of file reset_planning_scene_objects.hpp, definition at line 33 of file reset_planning_scene_objects.cpp.

Private Member Functions

createRequest()

tl::expected< ApplyPlanningScene::Request, std::string > moveit_pro::behaviors::ResetPlanningSceneObjects::createRequest ()
virtual

Creates an ApplyPlanningScene service request that clears all objects from the planning scene.

Declaration at line 48 of file reset_planning_scene_objects.hpp, definition at line 79 of file reset_planning_scene_objects.cpp.

getFuture()

std::shared_future< tl::expected< bool, std::string > > & moveit_pro::behaviors::ResetPlanningSceneObjects::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 53 of file reset_planning_scene_objects.hpp.

getResponseTimeout()

tl::expected< std::chrono::duration< double >, std::string > moveit_pro::behaviors::ResetPlanningSceneObjects::getResponseTimeout ()
virtual

Returns the maximum duration to wait for a response from the ApplyPlanningScene service.

Declaration at line 45 of file reset_planning_scene_objects.hpp, definition at line 69 of file reset_planning_scene_objects.cpp.

getServiceName()

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

Returns the name of the ApplyPlanningScene service to call.

Declaration at line 42 of file reset_planning_scene_objects.hpp, definition at line 56 of file reset_planning_scene_objects.cpp.

processResponse()

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

Processes the ApplyPlanningScene service response and returns whether the scene was successfully reset.

Declaration at line 51 of file reset_planning_scene_objects.hpp, definition at line 105 of file reset_planning_scene_objects.cpp.

Private Member Attributes

future_

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

Definition at line 58 of file reset_planning_scene_objects.hpp.

Public Static Functions

metadata()

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

Declaration at line 38 of file reset_planning_scene_objects.hpp, definition at line 50 of file reset_planning_scene_objects.cpp.

providedPorts()

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

Declaration at line 36 of file reset_planning_scene_objects.hpp, definition at line 41 of file reset_planning_scene_objects.cpp.


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


Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.