MoveIt Pro API
Core Behaviors for MoveIt Pro
Loading...
Searching...
No Matches
moveit_pro::behaviors::DetachObject Class Referencefinal

Detaches a collision object from a robot link by id and returns it to the planning scene as a free collision object at its current pose. More...

#include <detach_object.hpp>

Inheritance diagram for moveit_pro::behaviors::DetachObject:
Collaboration diagram for moveit_pro::behaviors::DetachObject:

Public Member Functions

 DetachObject (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources)
 
 DetachObject (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources, std::unique_ptr< PlanningSceneBridge > bridge)
 
 ~DetachObject () override=default
 
- Public Member Functions inherited from moveit_pro::behaviors::AsyncBehaviorBase
 AsyncBehaviorBase (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources)
 
 ~AsyncBehaviorBase () override=default
 
BT::NodeStatus onStart () override
 Required implementation of BT::StatefulActionNode::onStart().
 
BT::NodeStatus onRunning () override
 Required implementation of BT::StatefulActionNode::onRunning().
 
void onHalted () override
 Required implementation of BT::StatefulActionNode::onHalted().
 
void resetStatus ()
 Resets the internal status of this node.
 
- Public Member Functions inherited from moveit_pro::behaviors::SharedResourcesNode< BT::StatefulActionNode >
 SharedResourcesNode (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources)
 Constructor for SharedResourcesNode. Called by BT::BehaviorTreeFactory when creating a new behavior tree containing this node.
 

Static Public Member Functions

static BT::PortsList providedPorts ()
 
static BT::KeyValueVector metadata ()
 

Static Public Attributes

static constexpr auto kPortIDObjectId = "object_id"
 
static constexpr auto kPortIDPlanningScene = "planning_scene"
 

Additional Inherited Members

- Protected Member Functions inherited from moveit_pro::behaviors::AsyncBehaviorBase
virtual tl::expected< void, std::string > doHalt ()
 Optionally implement additional work needed to cleanly interrupt the async process.
 
void notifyCanHalt ()
 Called when runAsync() finishes to notify onHalted() that the async process has finished.
 
- Protected Attributes inherited from moveit_pro::behaviors::SharedResourcesNode< BT::StatefulActionNode >
std::shared_ptr< BehaviorContextshared_resources_
 

Detailed Description

Detaches a collision object from a robot link by id and returns it to the planning scene as a free collision object at its current pose.

The Behavior has two operating modes selected by the planning_scene input port:

  • Live scene mode (port unwired, default): the Behavior fetches the current planning scene from the /get_planning_scene service, then commits a detach diff via the /apply_planning_scene service. The server discovers the parent link, removes the object from the attached objects, and re-adds it to the world at its current pose. Service names are hard-coded; they are not exposed as ports.
  • Supplied scene mode (port wired): the Behavior reads the moveit_msgs::PlanningScene message supplied on the port, moves the matching entry from robot_state.attached_collision_objects into world.collision_objects, and writes the modified scene back to the same port. No service calls are made.

Succeeds without changes (no-op) when the id is not attached to the robot, whether it is already a free world object or absent from the scene entirely: the detachment intent is already satisfied. Fails only when object_id is empty.

This Behavior detaches objects that were attached via the standard ApplyPlanningScene service. For URDF objects attached via AttachURDF, use DetachURDF instead.

Data Port Name Port Type Object Type
object_id input std::string
planning_scene bidirectional moveit_msgs::msg::PlanningScene

Constructor & Destructor Documentation

◆ DetachObject() [1/2]

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

◆ DetachObject() [2/2]

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

◆ ~DetachObject()

moveit_pro::behaviors::DetachObject::~DetachObject ( )
overridedefault

Member Function Documentation

◆ metadata()

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

◆ providedPorts()

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

Member Data Documentation

◆ kPortIDObjectId

constexpr auto moveit_pro::behaviors::DetachObject::kPortIDObjectId = "object_id"
staticconstexpr

◆ kPortIDPlanningScene

constexpr auto moveit_pro::behaviors::DetachObject::kPortIDPlanningScene = "planning_scene"
staticconstexpr

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