MoveIt Pro API
Core Behaviors for MoveIt Pro
Loading...
Searching...
No Matches
moveit_pro::behaviors::AddCollisionObjectBase Class Referenceabstract

Abstract base for Behaviors that add a CollisionObject to the planning scene. More...

#include <add_collision_object_base.hpp>

Inheritance diagram for moveit_pro::behaviors::AddCollisionObjectBase:
Collaboration diagram for moveit_pro::behaviors::AddCollisionObjectBase:

Public Member Functions

 AddCollisionObjectBase (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources)
 
 AddCollisionObjectBase (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources, std::unique_ptr< PlanningSceneBridge > bridge)
 
 ~AddCollisionObjectBase () override=default
 
virtual tl::expected< moveit_msgs::msg::CollisionObject, std::string > buildCollisionObject ()=0
 Build the CollisionObject to apply to the planning scene.
 
- 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.
 
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.
 
- 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 > &behavior_context)
 Constructor for SharedResourcesNode. Called by BT::BehaviorTreeFactory when creating a new behavior tree containing this node.
 
const std::shared_ptr< BehaviorContext > & getBehaviorContext () const
 

Static Public Member Functions

static BT::PortsList commonPorts ()
 Returns the input ports owned by this base class: overwrite and planning_scene. Subclasses concatenate this list into their own providedPorts() so every shape-specific Add inherits the same wiring.
 

Static Public Attributes

static constexpr auto kPortIDOverwrite = "overwrite"
 
static constexpr auto kPortIDPlanningScene = "planning_scene"
 

Detailed Description

Abstract base for Behaviors that add a CollisionObject to the planning scene.

Subclasses override buildCollisionObject() to produce the CollisionObject. The base class then validates the object (non-empty id, non-empty frame_id, equal-size subframe arrays), enforces operation = ADD, and commits the addition.

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

  • Live scene mode (port unwired): the Behavior fetches the current planning scene from the /get_planning_scene service, then commits by sending a diff to the /apply_planning_scene service. Service names are hard-coded; they are not exposed as ports. This is the default behavior.
  • Supplied scene mode (port wired): the Behavior modifies the moveit_msgs::PlanningScene message supplied on the port and writes the result back to the same port. No service calls are made.

Before adding the object, the Behavior looks for another entry in the planning scene with the same id. The id can already be present in two places: in the world (world.collision_objects), or attached to the robot (robot_state.attached_collision_objects).

  • If a world entry with the same id already exists, the Behavior fails unless overwrite is true, in which case the existing world entry is replaced.
  • If an attached entry with the same id already exists, the Behavior fails regardless of overwrite, and the caller must detach the object first. This Behavior never modifies the attached list.

Constructor & Destructor Documentation

◆ AddCollisionObjectBase() [1/2]

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

◆ AddCollisionObjectBase() [2/2]

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

◆ ~AddCollisionObjectBase()

moveit_pro::behaviors::AddCollisionObjectBase::~AddCollisionObjectBase ( )
overridedefault

Member Function Documentation

◆ buildCollisionObject()

virtual tl::expected< moveit_msgs::msg::CollisionObject, std::string > moveit_pro::behaviors::AddCollisionObjectBase::buildCollisionObject ( )
pure virtual

Build the CollisionObject to apply to the planning scene.

Returns
The CollisionObject on success, or a descriptive error message on failure.

◆ commonPorts()

BT::PortsList moveit_pro::behaviors::AddCollisionObjectBase::commonPorts ( )
static

Returns the input ports owned by this base class: overwrite and planning_scene. Subclasses concatenate this list into their own providedPorts() so every shape-specific Add inherits the same wiring.

Member Data Documentation

◆ kPortIDOverwrite

constexpr auto moveit_pro::behaviors::AddCollisionObjectBase::kPortIDOverwrite = "overwrite"
staticconstexpr

◆ kPortIDPlanningScene

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

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