Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify path planner API and allow planner resets #241

Merged
merged 7 commits into from
Aug 22, 2024

Conversation

sea-bass
Copy link
Owner

@sea-bass sea-bass commented Aug 18, 2024

This PR makes path planners less complex by not using any hierarchy or factory patterns; rather, it is a bunch of flat classes that implement a common contract for grabbing the latest graphs and plans.

As part of this common contract, all planners now have a reset() method which will do different things in different planners. Right now:

  • RRT : Basically a no-op, just clears out the graphs
  • PRM / WorldGraphPlanner : Re-generates the roadmaps from the world polygons
  • A* : Re-generates the occupancy grid from the world

This is also available through a ROS interface, e.g.:

ros2 service call /robot0/reset_path_planner std_srvs/srv/Trigger {}

All the "common" stuff that was formerly in a base class is now available as free functions. Composition over inheritance all the way!

Closes #212

@sea-bass sea-bass requested a review from eholum August 18, 2024 20:48
@sea-bass sea-bass changed the title Simplify path planners and allow resets Simplify path planners and allow planner resets Aug 18, 2024
@sea-bass sea-bass changed the title Simplify path planners and allow planner resets Simplify path planner API and allow planner resets Aug 18, 2024
Copy link

github-actions bot commented Aug 18, 2024

Coverage

Coverage Report
FileStmtsMissCoverMissing
__init__.py00100% 
core
   __init__.py90100% 
   dynamics.py430100% 
   gazebo.py136894%55, 124, 230, 244–248
   hallway.py93891%193, 235–238, 262–264
   locations.py1312183%69, 71, 88, 103–104, 106, 117–118, 120–121, 138, 196, 211, 236, 246, 291, 302–303, 305–306, 335
   objects.py69494%78, 106, 137, 197
   robot.py4516685%259–260, 272, 275, 279–280, 285–286, 328–329, 337, 397–400, 404–407, 447, 449, 491–492, 494–495, 512–514, 530–532, 599–601, 626–628, 679–681, 750–752, 762, 806–808, 818, 833, 839–840, 842, 844, 847–849, 859, 867, 873, 879, 885, 897, 939, 957, 960, 965
   room.py48197%113
   world.py73919074%147–148, 184–185, 189, 242–243, 245–246, 274–275, 298–300, 337–339, 351–353, 382–384, 409–411, 464, 478–479, 481–482, 497–499, 519–523, 525–527, 529–530, 533, 535–538, 542–546, 549–551, 554–565, 581–582, 600–602, 616–618, 654–656, 668–670, 692–694, 719–721, 769–770, 773, 789, 819–820, 831, 834, 842, 858–862, 864–866, 869–870, 873–876, 878, 881, 883–885, 887–889, 891, 906, 913, 924–928, 963–964, 968–969, 987–988, 994–995, 997–998, 1000, 1002–1003, 1005, 1007–1008, 1018–1019, 1022, 1024, 1038, 1040, 1047, 1094, 1125–1126, 1137, 1148–1150, 1152–1155, 1157, 1174–1175, 1179–1180, 1215–1216, 1218, 1235–1236, 1267, 1281–1284, 1296–1299, 1313, 1324–1325, 1327, 1371–1372, 1424, 1504–1505
   yaml_utils.py108694%65, 69, 171–172, 191–192
gui
   __init__.py20100% 
   main.py1983482%22–24, 45, 77–78, 203, 215–221, 228–231, 233, 236–242, 246, 251–252, 256–257, 268, 319–320
   world_canvas.py3016279%45–46, 48–52, 55, 61–62, 169–172, 176–177, 182–183, 190, 192, 249–251, 257, 274–276, 323, 380–381, 408–409, 411, 413–415, 418–421, 423, 427–433, 436, 439–440, 455–457, 460, 479, 522, 543, 547, 570, 587, 601
manipulation
   __init__.py10100% 
   grasping.py2366174%102, 110–112, 114–122, 124, 132, 462, 464–466, 470–472, 566–568, 571–575, 583, 586–588, 593–594, 600–604, 607–614, 617–619, 628, 630, 632–638
navigation
   __init__.py11190%37
   a_star.py771185%83–88, 90–92, 180, 189
   execution.py90792%73–75, 80–82, 119
   occupancy_grid.py1391489%44–47, 49–53, 56, 192, 226, 234, 238
   prm.py56492%60–61, 140, 149
   rrt.py162199%365
   visualization.py32681%88–93
   world_graph.py58493%117, 120, 130, 139
planning
   __init__.py00100% 
   actions.py1120100% 
planning/pddlstream
   __init__.py7185%13
   default_mappings.py90100% 
   planner.py40880%119–126
   primitives.py61493%68, 82, 94, 232
   utils.py99891%66, 93, 105, 115–116, 207–208, 211
utils
   __init__.py00100% 
   general.py33487%23, 45, 51–52
   knowledge.py1542285%86, 117, 156–161, 163–164, 167–168, 170–173, 189, 204, 208, 250, 266, 329
   motion.py70395%93–94, 96
   polygon.py1110100% 
   pose.py890100% 
   search_graph.py93396%240–242
   trajectory.py67297%130, 165
TOTAL413556486% 

Tests Skipped Failures Errors Time
194 0 💤 0 ❌ 0 🔥 3m 14s ⏱️

@sea-bass sea-bass marked this pull request as ready for review August 18, 2024 21:37
Copy link
Collaborator

@eholum eholum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So much cleaner! Did a quick scan through and some testing. The examples need the info function removed but other than that...

image

image

pyrobosim/pyrobosim/navigation/__init__.py Outdated Show resolved Hide resolved
pyrobosim_ros/pyrobosim_ros/ros_interface.py Show resolved Hide resolved
pyrobosim/pyrobosim/navigation/rrt.py Show resolved Hide resolved
@sea-bass sea-bass requested a review from eholum August 21, 2024 18:38
@sea-bass
Copy link
Owner Author

image

This is also considering the addition of the new resetting feature 🤘🏻

Copy link
Collaborator

@eholum eholum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-tested all the examples and looking good!

@sea-bass sea-bass merged commit 394c91d into main Aug 22, 2024
7 checks passed
@sea-bass sea-bass deleted the simplify-and-reset-planners branch August 22, 2024 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add mechanism to reset multi-query and occupancy grid based path planners
2 participants