|
MoveIt Pro API
Core Behaviors for MoveIt Pro
|
Executes a policy as continuous, self-collision-checked motion on the arm and optional gripper. More...
#include <execute_policy.hpp>


Classes | |
| struct | Deps |
| struct | SceneAndState |
| Planning scene snapshot plus the current positions of the commanded joints. More... | |
Public Types | |
| using | JTACClientInterface = jtac_client::JTACClientInterface |
| using | GripperClientInterface = gripper_client::GripperClientInterface |
| using | TrajectoryChunkValidator = chunked_trajectory_executor::TrajectoryChunkValidator |
Public Member Functions | |
| ExecutePolicy (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources, Deps deps={}) | |
| Constructor for the ExecutePolicy Behavior. | |
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 () |
| Input ports that configure the chunk execution. | |
| static BT::KeyValueVector | metadata () |
| Metadata for the MoveIt Pro Developer Tool. | |
Protected Member Functions | |
| virtual tl::expected< SceneAndState, std::string > | acquireSceneAndInitialState (const std::vector< std::string > &joint_names) |
| Snapshot the planning scene and read the commanded joints' current positions. | |
Protected Member Functions inherited from moveit_pro::behaviors::AsyncBehaviorBase | |
| void | notifyCanHalt () |
| Called when runAsync() finishes to notify onHalted() that the async process has finished. | |
Additional Inherited Members | |
Protected Attributes inherited from moveit_pro::behaviors::SharedResourcesNode< BT::StatefulActionNode > | |
| std::shared_ptr< BehaviorContext > | shared_resources_ |
Executes a policy as continuous, self-collision-checked motion on the arm and optional gripper.
The Behavior gathers the current observation (joint positions and camera images), asks a policy for the next chunk over the GetActionChunk service, and feeds it to a ChunkedTrajectoryExecutor that blends it onto the running motion at the seam, checks it against the commanded joints' position, velocity, and acceleration limits and for self-collision, and stitches it onto the controller. It requests the next chunk before the committed motion drains so the robot does not pause at chunk boundaries, and stops cleanly once total_action_steps points have run, when the policy reports no more actions, or when the Behavior is halted.
The policy is any node that serves the GetActionChunk ROS 2 service (moveit_pro_ml_msgs/srv/GetActionChunk); the serving node can wrap an in-process model adapter, a local GPU server, or a remote one. Every chunk is blended onto the running motion at the seam regardless of the policy; the seam blend is never delegated to the producer. When the policy runs real-time chunking (policy_uses_real_time_chunking), the Behavior additionally sends it the previous chunk's unexecuted tail and the state that chunk was anchored to, so it continues the committed motion and the blend has less to correct.
The arm and the gripper are driven on separate paths from the same chunk. The arm joints are streamed to the trajectory controller; the gripper, when gripper_command_action_name is set, is the one joint in the chunk beyond the arm group (only single-DOF grippers are supported) and is commanded through a GripperCommand action server, streamed step by step across each committed chunk so it tracks the policy's gripper motion rather than holding one value per chunk. Leaving the port empty runs the arm only and leaves the gripper to a separate Behavior. Each gripper target is checked for finiteness and clamped to the gripper joint's position limits. The gripper's links are part of the self-collision check at their current (snapshot) pose, so the gripper geometry is considered, but the commanded gripper opening itself is not re-validated per step the way the arm chunk is. A halt cancels both the arm controller goals and any in-flight gripper goal; a position controller may still hold its last gripper setpoint after a cancel, so a halt is not guaranteed to reopen the gripper.
| Data Port Name | Port Type | Object Type |
|---|---|---|
| policy_service_name | input | std::string |
| joint_group_name | input | std::string |
| total_action_steps | input | int |
| prompt | input | std::string |
| committed_action_steps | input | int |
| dt | input | double |
| num_interpolation_points | input | int |
| goal_path_tolerance | input | double |
| policy_tracking_weight | input | double |
| policy_uses_real_time_chunking | input | bool |
| controller_action_name | input | std::string |
| absolute_force_torque_threshold | input | std::vector<double> |
| policy_call_timeout | input | double |
| image_names | input | std::vector<std::string> |
| image_topics | input | std::vector<std::string> |
| joint_states_topic | input | std::string |
| gripper_command_action_name | input | std::string |
| using moveit_pro::behaviors::ExecutePolicy::GripperClientInterface = gripper_client::GripperClientInterface |
| using moveit_pro::behaviors::ExecutePolicy::JTACClientInterface = jtac_client::JTACClientInterface |
| using moveit_pro::behaviors::ExecutePolicy::TrajectoryChunkValidator = chunked_trajectory_executor::TrajectoryChunkValidator |
| moveit_pro::behaviors::ExecutePolicy::ExecutePolicy | ( | const std::string & | name, |
| const BT::NodeConfiguration & | config, | ||
| const std::shared_ptr< BehaviorContext > & | shared_resources, | ||
| Deps | deps = {} |
||
| ) |
Constructor for the ExecutePolicy Behavior.
| name | Behavior instance name, set by the behavior tree factory. |
| config | Behavior tree configuration, set by the behavior tree factory. |
| shared_resources | Resources shared between Behaviors, such as the node and the robot model. |
| deps | Injected collaborators for testing. Each null entry is built from the ports at run start: the producer as a GetActionChunk service client, the jtac_client as a default JTACClient, the validator as a self-collision validator from a planning scene snapshot, the observation_source as a topic subscriber, and the gripper_client as a GripperClient created only when gripper_command_action_name is set. |
|
protectedvirtual |
Snapshot the planning scene and read the commanded joints' current positions.
Production behavior monitors the planning scene through a PlanningSceneMonitor. Tests override this to supply a canned snapshot so they need no live scene.
| joint_names | Commanded joints, defining the order of initial_joint_positions. |
|
static |
Metadata for the MoveIt Pro Developer Tool.
|
static |
Input ports that configure the chunk execution.