-
Notifications
You must be signed in to change notification settings - Fork 105
Port/traversability #101
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
Port/traversability #101
Conversation
nathanhhughes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
src/rooms/room_finder_config.cpp
Outdated
| #include <config_utilities/config.h> | ||
| #include <config_utilities/types/conversions.h> | ||
| #include <config_utilities/types/enum.h> | ||
| #include <config_utilities/validation.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(minor) not needed here
tests/CMakeLists.txt
Outdated
| src/place_fixtures.cpp | ||
| src/resources.cpp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(minor) idk if you're using an automatic alphabetical sorter or doing it by hand, but main.cpp and src/* are slightly distinct to the actual test files, so I'd have a slight preference to keeping them at the top
Thank you for cleaning up the order on the files though!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was alphabetical sort, the intention was to keep main at the top though 😅
| bool enable_place_mesh_mapping = false; | ||
| config::VirtualConfig<SurfacePlacesInterface> surface_places; | ||
| config::VirtualConfig<FreespacePlacesInterface> freespace_places; | ||
| bool use_frontiers = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, thanks!
| auto node_ptr = dsg.findNode(node.id); | ||
| if (node_ptr) { | ||
| node_ptr->attributes().position = node.attributes().position; | ||
| } | ||
| // dsg.setNodeAttributes(node.id, node.attributes().clone()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we drop the commented code and add a note that this is copying the newly interpolated positions from the unmerged graph to the merged graph? I probably should have added the note myself when I wrote this (took me a minute to refresh my memory as to what the implementation was supposed to do)
| inline static const auto registration_ = | ||
| config::RegistrationWithConfig<TraversabilityClustering, | ||
| BlockTraversabilityClustering, | ||
| Config>("BlockTraversabilityClustering"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto regarding where the registration is defined
| inline static const auto registration_ = | ||
| config::RegistrationWithConfig<SurfacePlacesInterface, | ||
| TraversabilityPlaceExtractor, | ||
| Config>("traversability"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto for registration definition location
| inline static const auto registration_ = | ||
| config::RegistrationWithConfig<TraversabilityProcessor, ErosionDilation, Config>( | ||
| "ErosionDilation"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto for registration location
| auto& to_attrs = dsg.getNode(to_id).attributes<TraversabilityNodeAttributes>(); | ||
| // Avoid merging nodes with active window (temporal) overlap. | ||
| if (from_attrs.last_observed_ns >= to_attrs.first_observed_ns && | ||
| from_attrs.first_observed_ns <= to_attrs.last_observed_ns) { | ||
| continue; | ||
| } | ||
|
|
||
| // Check boundaries. | ||
| auto to_boundary = Boundary(to_attrs); | ||
| if (!to_boundary.intersects(from_boundary)) { | ||
| continue; | ||
| } | ||
|
|
||
| // Simple case: If places are completely contained. | ||
| if (isContained(to_boundary, from_boundary)) { | ||
| result.push_back({to_id, from_node.id}); | ||
| merged.insert(to_id); | ||
| continue; | ||
| } | ||
| if (isContained(from_boundary, to_boundary)) { | ||
| result.push_back({from_node.id, to_id}); | ||
| merged.insert(from_node.id); | ||
| continue; | ||
| } | ||
|
|
||
| // Large overlap: No need to keep both, as transition is always possible between. | ||
| auto intersection = from_boundary.intersection(to_boundary); | ||
| if (intersection.height() < config.min_place_size || | ||
| intersection.width() < config.min_place_size) { | ||
| // TODO(lschmid): Can consider cropping and dropping in the future. | ||
| // Always update the classification of the boundary sides. | ||
| overlapping_nodes_to_cleanup_.insert({from_node.id, to_id}); | ||
| continue; | ||
| } | ||
|
|
||
| // Aligned in X or Y direction: Merge by fusing boundary. | ||
| if ((std::abs(from_boundary.min.x() - to_boundary.min.x()) < config.tolerance && | ||
| std::abs(from_boundary.max.x() - to_boundary.max.x()) < config.tolerance) || | ||
| (std::abs(from_boundary.min.y() - to_boundary.min.y()) < config.tolerance && | ||
| std::abs(from_boundary.max.y() - to_boundary.max.y()) < config.tolerance)) { | ||
| merged.insert(to_id); | ||
| result.push_back({to_id, from_node.id}); | ||
| continue; | ||
| } | ||
|
|
||
| // If not fuseable easily keep larger. | ||
| if (from_boundary.area() >= to_boundary.area()) { | ||
| result.push_back({to_id, from_node.id}); | ||
| merged.insert(to_id); | ||
| } else { | ||
| result.push_back({from_node.id, to_id}); | ||
| merged.insert(from_node.id); | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(minor) I'd maybe split this up into a helper function or two, but definitely not needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was hoping to make this clearer but I can't think of a great way to break this up, since essentially the 'how to fuse traversability attrs' is a bit of cases/branching problem.
| if ((std::abs(from_boundary.min.x() - to_boundary.min.x()) < config.tolerance && | ||
| std::abs(from_boundary.max.x() - to_boundary.max.x()) < config.tolerance) || | ||
| (std::abs(from_boundary.min.y() - to_boundary.min.y()) < config.tolerance && | ||
| std::abs(from_boundary.max.y() - to_boundary.max.y()) < config.tolerance)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(minor) this feels like something that could be a method in the boundary
424cec2 to
a087977
Compare
Co-authored-by: Nathan Hughes <nathan.h.hughes@gmail.com>
1a26912 to
e3e3474
Compare
* WIP: part 1 * Port traversability: Part 2/2 * updates to new hydra architecture and few missed updates, builds and passes tests * update gitignore * minor fixes and config * run linting * fix missing distance adaptor call * Update src/utils/nearest_neighbor_utilities.cpp Co-authored-by: Nathan Hughes <nathan.h.hughes@gmail.com> * address review comments * run linter --------- Co-authored-by: Nathan Hughes <nathan.h.hughes@gmail.com>
* WIP: part 1 * Port traversability: Part 2/2 * updates to new hydra architecture and few missed updates, builds and passes tests * update gitignore * minor fixes and config * run linting * fix missing distance adaptor call * Update src/utils/nearest_neighbor_utilities.cpp Co-authored-by: Nathan Hughes <nathan.h.hughes@gmail.com> * address review comments * run linter --------- Co-authored-by: Nathan Hughes <nathan.h.hughes@gmail.com>
* WIP: part 1 * Port traversability: Part 2/2 * updates to new hydra architecture and few missed updates, builds and passes tests * update gitignore * minor fixes and config * run linting * fix missing distance adaptor call * Update src/utils/nearest_neighbor_utilities.cpp Co-authored-by: Nathan Hughes <nathan.h.hughes@gmail.com> * address review comments * run linter --------- Co-authored-by: Nathan Hughes <nathan.h.hughes@gmail.com>
* WIP: part 1 * Port traversability: Part 2/2 * updates to new hydra architecture and few missed updates, builds and passes tests * update gitignore * minor fixes and config * run linting * fix missing distance adaptor call * Update src/utils/nearest_neighbor_utilities.cpp Co-authored-by: Nathan Hughes <nathan.h.hughes@gmail.com> * address review comments * run linter --------- Co-authored-by: Nathan Hughes <nathan.h.hughes@gmail.com>
Parts affecting Hydra:
Places2dandFrontiersto avoid segfaultsTests: