Use a Custom Behavior in the Objective Editor UI
This guide will show how to register a custom Behavior with the MoveIt Studio Agent so you can include it in your own objectives.
Note
Complete the Create a Custom Behavior tutorial first before starting this tutorial.
1. Add the HelloWorld Behavior to the TreeNodesModel File
The list of Behaviors which can be added to objectives is configured by a file at ~/.config/moveit_studio/objectives/tree_nodes_model.xml
. Open this file in a text editor.
Note
The MoveIt Studio Agent must have been run at least once to create the initial version of this file.
Insert a new Action
element for the HelloWorld
Behavior into this file in between the existing entries for other Behaviors.
<root>
<TreeNodesModel>
...
<Action ID="HelloWorld"/>
...
</TreeNodesModel>
</root>
This will allow you to use the HelloWorld
Behavior as part of custom objectives in future tutorials.
2. Restart the MoveIt Studio Agent
We need to restart the MoveIt Studio Agent and update its environment so it knows about the existence of the my_behaviors
package and the new Behavior loader plugin within it.
Shut down the Agent using the Ctrl-C
command in the terminal where you ran the agent_robot.app
alias.
Run source $STUDIO_GENERATE_PACKAGE_OUTPUT_PATH/../install/setup.bash
in the same terminal where the agent_robot.app
alias was running to update the necessary environment variables.
Finally, re-launch the Agent within the same terminal using the agent_robot.app
alias.
3. Find the Behavior in the Objective Editor UI
Click the “Show All Objectives” button to the right of the row of Quick Objective buttons, and then click on one of the existing objectives. Click on the Edit
button for this objective to open the Objective Editor window.
The HelloWorld
Behavior will now be included in the list of available Behaviors on the left side of this window.