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

Update Graph class and add basic search algorithms #35

Merged
merged 15 commits into from
May 11, 2024

Conversation

eholum
Copy link
Collaborator

@eholum eholum commented May 10, 2024

For #34.

A* and DFS both work,I tried to not completely obliterate the Graph class's interface so as to avoid having to make significant changes to RRT. The weirdest thing is having to have a dictionary of nodes to themselves to support finding actual node objects in the Graph. I guess this is why Rust has a borrow checker.

In summary,

  • Adds hash and eq functions to the Node and Edge classes so that you can find them in the Graph given a robot configuration
  • Enables writing and loading a graph from a human-readable file format
  • Nodes are now a dictionary to enable lookups of the actual objects managed by a Graph object
  • Neighbors are now a dictionary of nodes and their costs (aka distances)
  • Ensures neighbors are removed when edges are deleted
  • Adds a DFS and A* implementation for graphs, and basic unit tests

Might need to think about how to make this cleaner...

Copy link
Owner

@sea-bass sea-bass left a comment

Choose a reason for hiding this comment

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

Mostly nitpicky comments about docstrings and names.

Implementation looks solid so far, and I can't think of anything that would impact downstream planning approaches that would build such a graph.

Looking forward to these graph visualizations in the PRM implementation! Do take a look at how the RRT one puts stuff into Meshcat.

src/pyroboplan/planning/graph.py Outdated Show resolved Hide resolved
src/pyroboplan/planning/graph.py Show resolved Hide resolved
src/pyroboplan/planning/graph.py Outdated Show resolved Hide resolved
src/pyroboplan/planning/graph.py Show resolved Hide resolved
src/pyroboplan/planning/graph.py Outdated Show resolved Hide resolved
src/pyroboplan/planning/graph_search.py Show resolved Hide resolved
test/planning/test_graph_search.py Outdated Show resolved Hide resolved
test/planning/test_graph_search.py Outdated Show resolved Hide resolved
test/planning/test_graph_search.py Outdated Show resolved Hide resolved
test/planning/test_graph_search.py Show resolved Hide resolved
Copy link
Collaborator Author

@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.

Adjusted some things, and I think I got all of your very valid nits.

src/pyroboplan/planning/graph.py Outdated Show resolved Hide resolved
src/pyroboplan/planning/graph_search.py Outdated Show resolved Hide resolved
src/pyroboplan/planning/graph_search.py Outdated Show resolved Hide resolved
test/planning/test_graph_search.py Show resolved Hide resolved
src/pyroboplan/planning/rrt.py Show resolved Hide resolved
test/planning/test_graph_search.py Show resolved Hide resolved
test/planning/test_graph_search.py Outdated Show resolved Hide resolved
@sea-bass sea-bass merged commit 10d059e into sea-bass:main May 11, 2024
3 checks passed
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.

2 participants