Skip to content

Commit

Permalink
Merge pull request #49 from PickNikRobotics/improve_lab_sim_examples
Browse files Browse the repository at this point in the history
Improve lab sim example objectives with story telling
  • Loading branch information
jeremydbronson authored Jan 6, 2025
2 parents 9b7a5f9 + 07fd3b3 commit 39fc596
Show file tree
Hide file tree
Showing 17 changed files with 784 additions and 210 deletions.
1 change: 1 addition & 0 deletions src/lab_sim/config/moveit/picknik_ur.srdf
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
<disable_collisions link1="base_link_inertia" link2="shoulder_link" reason="Adjacent"/>
<disable_collisions link1="forearm_link" link2="upper_arm_link" reason="Adjacent"/>
<disable_collisions link1="forearm_link" link2="wrist_1_link" reason="Adjacent"/>
<disable_collisions link1="base_link_inertia" link2="upper_arm_link" reason="Adjacent"/>
<disable_collisions link1="forearm_link" link2="wrist_2_link" reason="Never"/>
<disable_collisions link1="forearm_pinch_link" link2="forearm_link" reason="Adjacent"/>
<disable_collisions link1="forearm_pinch_link" link2="tool_changer_link" reason="Never"/>
Expand Down
1 change: 1 addition & 0 deletions src/lab_sim/description/picknik_ur.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -1202,6 +1202,7 @@
<param name="render_publish_rate">10</param>
<param name="tf_publish_rate">60</param>
<param name="lidar_publish_rate">10</param>
<param name="mujoco_viewer">false</param>
</hardware>
</ros2_control>
</robot>
5 changes: 2 additions & 3 deletions src/lab_sim/objectives/3_waypoint_pick_and_place.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<root BTCPP_format="4" main_tree_to_execute="3 Waypoints Pick and Place">
<!--//////////-->
<BehaviorTree
ID="3 Waypoints Pick and Place"
_description="Basic example of repeatedly grabbing a small (invisible) object, placing it at desired destination, and then moving back to a home position"
_favorite="false"
_favorite="true"
>
<Control ID="Sequence">
<!--Reset the planning scene to ensure no old collision objects are hanging around-->
<Action ID="ClearSnapshot" />
<!--Setup the environment to its "home" configuration - move to center and open gripper-->
<SubTree
ID="Move to Waypoint"
Expand Down
33 changes: 33 additions & 0 deletions src/lab_sim/objectives/_scan_scene.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8" ?>
<root BTCPP_format="4" main_tree_to_execute="_Scan Scene">
<!--//////////-->
<BehaviorTree
ID="_Scan Scene"
_description="Move robot our of scene to enable full snapshot of scene."
_favorite="true"
>
<Control ID="Sequence" name="TopLevelSequence">
<Action ID="ClearSnapshot" />
<SubTree
ID="Move to Waypoint"
_collapsed="true"
joint_group_name="manipulator"
planner_interface="moveit_default"
controller_names="/joint_trajectory_controller"
waypoint_name="Park Far Right"
/>
<SubTree ID="Take scene camera snapshot" _collapsed="true" />
<SubTree
ID="Move to Waypoint"
_collapsed="true"
joint_group_name="manipulator"
planner_interface="moveit_default"
controller_names="/joint_trajectory_controller"
waypoint_name="Look at Table"
/>
</Control>
</BehaviorTree>
<TreeNodesModel>
<SubTree ID="_Scan Scene" />
</TreeNodesModel>
</root>
106 changes: 106 additions & 0 deletions src/lab_sim/objectives/constrained_pick_and_place_subtree.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<?xml version="1.0" encoding="utf-8" ?>
<root
BTCPP_format="4"
main_tree_to_execute="Constrained Pick and Place Subtree"
>
<!--//////////-->
<BehaviorTree
ID="Constrained Pick and Place Subtree"
_subtreeOnly="true"
_description=""
>
<Control ID="Sequence">
<!--Create a special type of motion planning configuration that includes an upwards orientation requirement-->
<Action
ID="InitializeMotionConstraints"
constraints_name="gripper pointing down"
constraints="{constraints}"
/>
<Action
ID="AppendOrientationConstraint"
config_file_name="my_constraints.yaml"
constraints="{constraints}"
/>
<!--Move to pick location-->
<!--Note: Sampling based planners can be non-deterministic. The retry decorator improves the likelihood of success-->
<Decorator ID="RetryUntilSuccessful" num_attempts="3">
<SubTree
ID="Move to Waypoint"
waypoint_name="{pre_pick}"
joint_group_name="manipulator"
controller_names="/joint_trajectory_controller /robotiq_gripper_controller"
planner_interface="moveit_default"
constraints="{constraints}"
/>
</Decorator>
<Decorator ID="RetryUntilSuccessful" num_attempts="3">
<SubTree
ID="Move to Waypoint"
waypoint_name="{pick}"
joint_group_name="manipulator"
controller_names="/joint_trajectory_controller /robotiq_gripper_controller"
planner_interface="moveit_default"
constraints="{constraints}"
/>
</Decorator>
<!--We force success as the gripper closes, since we are commanding a position it will never reach (fingers fully closed)-->
<Decorator ID="ForceSuccess">
<SubTree ID="Close Gripper" />
</Decorator>
<!--Move to place (drop) location-->
<Decorator ID="RetryUntilSuccessful" num_attempts="3">
<SubTree
ID="Move to Waypoint"
controller_names="/joint_trajectory_controller /robotiq_gripper_controller"
joint_group_name="manipulator"
planner_interface="moveit_default"
constraints="{constraints}"
_collapsed="true"
waypoint_name="{pre_pick}"
/>
</Decorator>
<Decorator ID="RetryUntilSuccessful" num_attempts="3">
<SubTree
ID="Move to Waypoint"
controller_names="/joint_trajectory_controller /robotiq_gripper_controller"
joint_group_name="manipulator"
planner_interface="moveit_default"
constraints="{constraints}"
_collapsed="true"
waypoint_name="{pre_place}"
/>
</Decorator>
<Decorator ID="RetryUntilSuccessful" num_attempts="3">
<SubTree
ID="Move to Waypoint"
controller_names="/joint_trajectory_controller /robotiq_gripper_controller"
joint_group_name="manipulator"
planner_interface="moveit_default"
constraints="{constraints}"
_collapsed="true"
waypoint_name="{place}"
/>
</Decorator>
<SubTree ID="Open Gripper" />
<Decorator ID="RetryUntilSuccessful" num_attempts="3">
<SubTree
ID="Move to Waypoint"
controller_names="/joint_trajectory_controller /robotiq_gripper_controller"
joint_group_name="manipulator"
planner_interface="moveit_default"
constraints="{constraints}"
_collapsed="true"
waypoint_name="{pre_place}"
/>
</Decorator>
</Control>
</BehaviorTree>
<TreeNodesModel>
<SubTree ID="Constrained Pick and Place Subtree">
<inout_port name="pre_pick" default="" />
<inout_port name="pick" default="" />
<inout_port name="pre_place" default="" />
<inout_port name="place" default="" />
</SubTree>
</TreeNodesModel>
</root>
168 changes: 32 additions & 136 deletions src/lab_sim/objectives/constrained_pick_place.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
<?xml version="1.0" encoding="utf-8" ?>
<root BTCPP_format="4" main_tree_to_execute="Constrained Pick and Place">
<root BTCPP_format="4" main_tree_to_execute="Move Beakers to Burners">
<!--//////////-->
<BehaviorTree
ID="Constrained Pick and Place"
_description="More advanced example of picking and placing an (invisible) object with orientation constraints enforced on the gripper's motion"
_favorite="false"
ID="Move Beakers to Burners"
_description="Example of picking and placing objects with orientation constraints enforced on the arm's motion"
_favorite="true"
_subtreeOnly="false"
>
<Control ID="Sequence">
<SubTree
ID="Move to Waypoint"
_collapsed="true"
waypoint_name="Look at Table"
constraints="{constraints}"
waypoint_name="Beaker 1a - Pre Pick"
joint_group_name="manipulator"
controller_names="/joint_trajectory_controller"
velocity_scale_factor="1.0"
Expand All @@ -20,139 +22,33 @@
keep_orientation="false"
/>
<SubTree ID="Open Gripper" />
<Decorator ID="KeepRunningUntilFailure">
<Control ID="Sequence">
<!--Move to pick location-->
<SubTree
ID="Move to Waypoint"
waypoint_name="Above Pick Cube"
joint_group_name="manipulator"
controller_names="/joint_trajectory_controller"
velocity_scale_factor="1.0"
acceleration_scale_factor="1.0"
link_padding="0.01"
keep_orientation_tolerance="0.05"
keep_orientation="true"
/>
<SubTree
ID="Move to Waypoint"
waypoint_name="Pick Cube"
joint_group_name="manipulator"
controller_names="/joint_trajectory_controller"
velocity_scale_factor="1.0"
acceleration_scale_factor="1.0"
link_padding="0.01"
keep_orientation_tolerance="0.05"
keep_orientation="true"
/>
<!--We force success as the gripper closes, since we are commanding a position it will never reach (fingers fully closed)-->
<Decorator ID="ForceSuccess">
<SubTree ID="Close Gripper" />
</Decorator>
<!--Move to place (drop) location-->
<SubTree
ID="Move to Waypoint"
controller_names="/joint_trajectory_controller"
joint_group_name="manipulator"
_collapsed="true"
waypoint_name="Above Pick Cube"
velocity_scale_factor="1.0"
acceleration_scale_factor="1.0"
link_padding="0.01"
keep_orientation_tolerance="0.05"
keep_orientation="true"
/>
<SubTree
ID="Move to Waypoint"
controller_names="/joint_trajectory_controller"
joint_group_name="manipulator"
_collapsed="true"
waypoint_name="Above Place Cube"
velocity_scale_factor="1.0"
acceleration_scale_factor="1.0"
link_padding="0.01"
keep_orientation_tolerance="0.05"
keep_orientation="true"
/>
<SubTree
ID="Move to Waypoint"
controller_names="/joint_trajectory_controller"
joint_group_name="manipulator"
_collapsed="true"
waypoint_name="Place Cube"
velocity_scale_factor="1.0"
acceleration_scale_factor="1.0"
link_padding="0.01"
keep_orientation_tolerance="0.05"
keep_orientation="true"
/>
<SubTree ID="Open Gripper" />
<SubTree
ID="Move to Waypoint"
controller_names="/joint_trajectory_controller"
joint_group_name="manipulator"
_collapsed="true"
waypoint_name="Above Place Cube"
velocity_scale_factor="1.0"
acceleration_scale_factor="1.0"
link_padding="0.01"
keep_orientation_tolerance="0.05"
keep_orientation="true"
/>
<SubTree
ID="Move to Waypoint"
controller_names="/joint_trajectory_controller"
joint_group_name="manipulator"
_collapsed="true"
waypoint_name="Place Cube"
velocity_scale_factor="1.0"
acceleration_scale_factor="1.0"
link_padding="0.01"
keep_orientation_tolerance="0.05"
keep_orientation="true"
/>
<SubTree ID="Close Gripper" />
<SubTree
ID="Move to Waypoint"
controller_names="/joint_trajectory_controller"
joint_group_name="manipulator"
_collapsed="true"
waypoint_name="Above Place Cube"
velocity_scale_factor="1.0"
acceleration_scale_factor="1.0"
link_padding="0.01"
keep_orientation_tolerance="0.05"
keep_orientation="true"
/>
<SubTree
ID="Move to Waypoint"
controller_names="/joint_trajectory_controller"
joint_group_name="manipulator"
_collapsed="true"
waypoint_name="Above Pick Cube"
velocity_scale_factor="1.0"
acceleration_scale_factor="1.0"
link_padding="0.01"
keep_orientation_tolerance="0.05"
keep_orientation="true"
/>
<SubTree
ID="Move to Waypoint"
waypoint_name="Pick Cube"
joint_group_name="manipulator"
controller_names="/joint_trajectory_controller"
velocity_scale_factor="1.0"
acceleration_scale_factor="1.0"
link_padding="0.01"
keep_orientation_tolerance="0.05"
keep_orientation="true"
/>
<SubTree ID="Open Gripper" />
</Control>
</Decorator>
<SubTree
ID="Constrained Pick and Place Subtree"
pre_pick="Beaker 1a - Pre Pick"
pick="Beaker 1b - Pick"
pre_place="Beaker 1c - Pre Place"
place="Beaker 1d - Place"
name="Beaker 1"
/>
<SubTree
ID="Constrained Pick and Place Subtree"
pre_pick="Beaker 2a - Pre Pick"
pick="Beaker 2b - Pick"
pre_place="Beaker 2c - Pre Place"
place="Beaker 2d - Place"
name="Beaker 2"
/>
<SubTree
ID="Constrained Pick and Place Subtree"
pre_pick="Beaker 3a - Pre Pick"
pick="Beaker 3b - Pick"
pre_place="Beaker 3c - Pre Place"
place="Beaker 3d - Place"
name="Beaker 3"
/>
</Control>
</BehaviorTree>
<TreeNodesModel>
<SubTree ID="Constrained Pick and Place" />
<SubTree ID="Move Beakers to Burners" />
</TreeNodesModel>
</root>
2 changes: 1 addition & 1 deletion src/lab_sim/objectives/joint_diagnostic.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<BehaviorTree
ID="Joint Diagnostic"
_description="Example of cycling through the min and max limits of a single joint, for hardware testing"
_favorite="false"
_favorite="true"
>
<Control ID="Sequence" name="TopLevelSequence">
<!--Setup by moving home-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<BehaviorTree
ID="Load and Execute Joint Trajectory"
_description="Load a trajectory that was saved as a YAML file"
_favorite="false"
_favorite="true"
_subtreeOnly="false"
>
<Control ID="Sequence" name="TopLevelSequence">
Expand Down
2 changes: 1 addition & 1 deletion src/lab_sim/objectives/look_at_table.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<BehaviorTree
ID="Look at table"
_description="Move the arm to a position that faces the table surface"
_favorite="true"
_favorite="false"
_subtreeOnly="false"
>
<Control ID="Sequence" name="TopLevelSequence">
Expand Down
Loading

0 comments on commit 39fc596

Please sign in to comment.