Skip to main content
Version: 10

Objectives Values

Objectives and Behaviors Configuration

example_robot_ws Checkpoint

If you are following this guide with example_robot_ws, your workspace should look like branch step6. We are now editing example_robot_mock config.yaml.

Objectives

Type: object (required)

Description: Configuration for MoveIt Pro Behaviors, Objectives, and waypoints.


Objectives.behavior_loader_plugins

Type: object (required)

Description: Dictionary mapping plugin names to lists of Behavior loader classes.

Common "core" Behavior loaders include:

  • CoreBehaviorsLoader: Basic motion and control Behaviors
  • MTCCoreBehaviorsLoader: MoveIt Task Constructor Behaviors
  • VisionBehaviorsLoader: Computer vision and perception Behaviors
  • MPCBehaviorsLoader: MuJoCo Model Predictive Control (MPC) Behaviors
  • ConverterBehaviorsLoader: Packing, unpacking, and transforming messages via Behaviors
  • MujocoBehaviorsLoader: Interacting with the MuJoCo simulation via Behaviors
Add out-of-box Behaviors to your example_robot_mock/config/config.yaml behavior_loader_plugins
# Configuration for loading behaviors and objectives.
# [Required]
objectives:
# List of plugins for loading custom behaviors.
# [Required]
behavior_loader_plugins:
# This plugin will load the core MoveIt Pro Behaviors.
# Add additional plugin loaders as needed.
core:
- "moveit_pro::behaviors::CoreBehaviorsLoader"
- "moveit_pro::behaviors::MTCCoreBehaviorsLoader"
- "moveit_pro::behaviors::VisionBehaviorsLoader"
- "moveit_pro::behaviors::MPCBehaviorsLoader"
- "moveit_pro::behaviors::ConverterBehaviorsLoader"
- "moveit_pro::behaviors::MujocoBehaviorsLoader"

When you use the MoveIt Pro UI to generate custom Behavior boilerplate, it will also add "BehaviorsLoader" boilerplate that should be linked here.


Objectives.objective_library_paths

Type: object (required)

Description: Dictionary mapping library names to package locations containing Objective XML files.

Add out-of-box Objectives to your example_robot_mock/config/config.yaml objective_library_paths
objectives:
...
# Specify source folder for objectives
# [Required]
objective_library_paths:
core_objectives:
package_name: "moveit_pro_objectives"
relative_path: "objectives/core"
motion_objectives:
package_name: "moveit_pro_objectives"
relative_path: "objectives/motion"
perception_objectives:
package_name: "moveit_pro_objectives"
relative_path: "objectives/perception"
mujoco_objectives:
package_name: "moveit_pro_objectives"
relative_path: "objectives/mujoco"
visualization_objectives:
package_name: "moveit_pro_objectives"
relative_path: "objectives/visualization"

Each Objective library entry requires:

  • package_name (string): ROS package containing Objectives
  • relative_path (string): Path within the package to Objectives directory

Custom Objectives

As motivated in our Robot Config Inheritance and Objective Package best practices, you should include objective_library_paths entries for

  1. Objectives that will be shared across robot configs, e.g. your applications.
  2. "Core" Objective overriding specific to a particular robot config, e.g. the specifics of how the simulator/driver handles gripper commands.
Add custom entries to your example_robot_mock/config/config.yaml objective_library_paths

In the interest of time, we will not be creating a separate repository and package for my_applications_package, so leave that entry commented out for now.

objectives:
...
objective_library_paths:
...
# my_applications:
# package_name: "my_applications_package"
# relative_path: "objectives"
sim_overrides:
package_name: "example_robot_mock"
relative_path: "objectives"
note

By default, newly created Objectives in the MoveIt Pro UI are saved to the last (leaf) entry in the objective_library_paths list. When more than one writable entry is available, the New Objective dialog also lets you pick a different entry as the save target.

Overriding "Core" Objectives

You can override an Objective by placing an Objective with the same name in a library lower in the objectives.objective_library_paths list.

Teleoperation Requirements

The moveit_pro_objectives "core" definitions for Open Gripper and Close Gripper simply return "Success".

You should implement these Objectives according to the expected behavior for your gripper type.

Create src/example_robot_mock/objectives/open_gripper.xml Objective
<?xml version="1.0" ?>
<root BTCPP_format="4" main_tree_to_execute="Open Gripper">
<!--//////////-->
<BehaviorTree
ID="Open Gripper"
_description="Open the gripper"
_favorite="false"
>
<Control ID="Sequence" name="root">
<Action
ID="MoveGripperAction"
gripper_command_action_name="/robotiq_gripper_controller/gripper_cmd"
position="0.05"
timeout="15.000000"
/>
</Control>
</BehaviorTree>
<TreeNodesModel>
<SubTree ID="Open Gripper">
<MetadataFields>
<Metadata subcategory="Grasping" />
</MetadataFields>
</SubTree>
</TreeNodesModel>
</root>
Create src/example_robot_mock/objectives/close_gripper.xml Objective
<?xml version="1.0" encoding="UTF-8" ?>
<root BTCPP_format="4" main_tree_to_execute="Close Gripper">
<BehaviorTree
ID="Close Gripper"
_description="Close the gripper"
_favorite="false"
>
<Control ID="Sequence" name="root">
<Action
ID="MoveGripperAction"
gripper_command_action_name="/robotiq_gripper_controller/gripper_cmd"
position="0.7929"
timeout="15.000000"
/>
</Control>
</BehaviorTree>
<TreeNodesModel>
<SubTree ID="Close Gripper">
<MetadataFields>
<Metadata subcategory="Grasping" />
</MetadataFields>
</SubTree>
</TreeNodesModel>
</root>

Objectives.waypoints_file

Type: object (required)

Description: Location of the waypoints YAML file for named robot poses.

objectives:
waypoints_file:
package_name: "example_robot_mock"
relative_path: "waypoints/waypoints.yaml"
  • package_name (string): ROS package containing waypoints file
  • relative_path (string): Path within package to waypoints file

step7 Checkpoint

Your example_robot_ws workspace should now look like branch step7.