Skip to content

Commit

Permalink
Also include self-collisions to make RRT look nicer
Browse files Browse the repository at this point in the history
  • Loading branch information
sea-bass committed Apr 5, 2024
1 parent 9b3d996 commit 361a2d1
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
34 changes: 33 additions & 1 deletion examples/example_rrt.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,38 @@
def prepare_scene(visual_model, collision_model):
"""Helper function to create a collision scene for this example."""

# Add self collisions
self_collision_pair_names = [
("panda_link0_0", "panda_link2_0"),
("panda_link0_0", "panda_link3_0"),
("panda_link0_0", "panda_link4_0"),
("panda_link0_0", "panda_link5_0"),
("panda_link0_0", "panda_link6_0"),
("panda_link0_0", "panda_link7_0"),
("panda_link1_0", "panda_link3_0"),
("panda_link1_0", "panda_link4_0"),
("panda_link1_0", "panda_link5_0"),
("panda_link1_0", "panda_link6_0"),
("panda_link1_0", "panda_link7_0"),
("panda_link2_0", "panda_link4_0"),
("panda_link2_0", "panda_link5_0"),
("panda_link2_0", "panda_link6_0"),
("panda_link2_0", "panda_link7_0"),
("panda_link3_0", "panda_link5_0"),
("panda_link3_0", "panda_link6_0"),
("panda_link3_0", "panda_link7_0"),
("panda_link4_0", "panda_link6_0"),
("panda_link4_0", "panda_link7_0"),
("panda_link5_0", "panda_link7_0"),
]
for pair in self_collision_pair_names:
collision_model.addCollisionPair(
pinocchio.CollisionPair(
collision_model.getGeometryId(pair[0]),
collision_model.getGeometryId(pair[1]),
)
)

# Add collision objects
ground_plane = pinocchio.GeometryObject(
"ground_plane",
Expand Down Expand Up @@ -115,7 +147,7 @@ def prepare_scene(visual_model, collision_model):
options.max_angle_step = 0.05
options.max_connection_dist = 0.1
options.goal_biasing_probability = 0.15
options.max_planning_time = 5.0
options.max_planning_time = 10.0
options.rrt_connect = True
options.bidirectional_rrt = True

Expand Down
2 changes: 1 addition & 1 deletion src/pyroboplan/planning/rrt.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def plan(self, q_start, q_goal, options=RRTPlannerOptions()):
):
goal_found = True

# Switch to the other tree
# Switch to the other tree next iteration, if bidirectional mode is enabled.
if options.bidirectional_rrt:
start_tree_phase = not start_tree_phase

Expand Down

0 comments on commit 361a2d1

Please sign in to comment.