-
Notifications
You must be signed in to change notification settings - Fork 104
Graph-Based Layer System for Dynamic Cost Updates #83
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
Merged
amock
merged 33 commits into
naturerobots:feature/dynamic-cost-updates
from
JustusBraun:feature/dynamic-cost-updates
Aug 15, 2025
Merged
Changes from 31 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
7505486
Use multithreaded executor so layers can use different callback groups
JustusBraun 38c2bd2
Create LayerManager to load, initialize and handle layers
JustusBraun 96f8552
WIP: Layer updates
JustusBraun d2f041e
Ensure layer updates are not published before initialization finished
JustusBraun de7f7ff
Add notifyChanged call in combination layers
JustusBraun de87afd
Add readLock() and writeLock() functions to layer interface for
JustusBraun 6440206
Switch map_ptr_ to std::weak_ptr to prevent cyclic dependencies.
JustusBraun d37d9b6
Add LayerTimer to allow layers to log locking, update and notifyChange
JustusBraun fae057a
Unique logger for each layer provided by AbstractLayer
JustusBraun 46156b1
Add dynamic_obstacle_layer to implement optimizations
JustusBraun c978366
Remove weak_ptr overhead and in loop vector allocations
JustusBraun a1bec6c
Downcast Mesh and remove vector field publish
JustusBraun 3d19157
Reduce the number of faces checkd for each neighbour vertex
JustusBraun f747a34
Remove unused vertex maps, set log levels to debug
JustusBraun 8aef90d
Add check if downcast was successful
JustusBraun 0ea8330
Improve default layer update performance by updating only changed
JustusBraun f3acf8f
Changed writeLock to a protected function. The only logic that should…
JustusBraun 660c10d
The layer update can now be done without needing the writeLock for the
JustusBraun 13a2be2
Added check to detect if a Non-Manifold Mesh was used as input
JustusBraun 0ea1471
Switch log msg to debug
JustusBraun 0c9cfb9
Set cost of lethal vertices to 1.0 and enable OpenMP for faster
JustusBraun a7c05f7
Fix vertex color loading and publishing
JustusBraun e97557f
Add check if the edge_weights map contains the keys
JustusBraun 09b4b87
Handle non-manifold meshes during Map load
JustusBraun 6b7ab87
Fix combination layer lethal vertex handling
JustusBraun e093a9e
Remove explicit initialization for all map values
JustusBraun ea5776a
Propagate timestamps through notifyChanged and updateInput calls
JustusBraun c1442bf
Post merge clean up and fixes
JustusBraun 230e8bf
Apply runtime improvements from dynamic_inflation_layer to inflation_…
JustusBraun aad1e2e
Remove DynamicInflationLayer
JustusBraun a496eb6
Add note why we do not normalize the combined costs
JustusBraun 17d48d0
Add note on why we use a multithreaded executor
JustusBraun cb2ccc3
Change AbstractLayer::costs() and AbstractLayer::lethals() to return
JustusBraun File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,128 @@ | ||
| /* | ||
| * Copyright 2025, Justus Braun | ||
| * | ||
| * Redistribution and use in source and binary forms, with or without | ||
| * modification, are permitted provided that the following conditions | ||
| * are met: | ||
| * | ||
| * 1. Redistributions of source code must retain the above copyright | ||
| * notice, this list of conditions and the following disclaimer. | ||
| * | ||
| * 2. Redistributions in binary form must reproduce the above | ||
| * copyright notice, this list of conditions and the following | ||
| * disclaimer in the documentation and/or other materials provided | ||
| * with the distribution. | ||
| * | ||
| * 3. Neither the name of the copyright holder nor the names of its | ||
| * contributors may be used to endorse or promote products derived | ||
| * from this software without specific prior written permission. | ||
| * | ||
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
| * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
| * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
| * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
| * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | ||
| * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
| * POSSIBILITY OF SUCH DAMAGE. | ||
| * | ||
| * authors: | ||
| * Justus Braun <jubraun@uni-osnabrueck.de> | ||
| * | ||
| */ | ||
| #pragma once | ||
|
|
||
| #include <mesh_map/abstract_layer.h> | ||
| #include <rclcpp/rclcpp.hpp> | ||
|
|
||
| namespace mesh_layers | ||
| { | ||
|
|
||
| class MaxCombinationLayer | ||
| : public mesh_map::AbstractLayer | ||
| { | ||
| public: | ||
|
|
||
| bool readLayer() override {return false;} | ||
| bool writeLayer() override {return true;} | ||
| float defaultValue() override {return 0.0;} | ||
| float threshold() override {return 1.0;} | ||
| lvr2::VertexMap<float>& costs() override {return costs_;} | ||
| std::set<lvr2::VertexHandle>& lethals() override {return lethals_;} | ||
|
|
||
| /** | ||
| * @brief Combines the configured layers | ||
| */ | ||
| bool computeLayer() override; | ||
|
|
||
| /** | ||
| * @brief Process a change in a lower layer | ||
| */ | ||
| virtual void onInputChanged( | ||
| const rclcpp::Time& timestamp, | ||
| const std::set<lvr2::VertexHandle>& changed | ||
| ) override; | ||
|
|
||
| /** | ||
| * @brief Initialize the layer | ||
| */ | ||
| bool initialize() override; | ||
|
|
||
| private: | ||
| // Combined costs | ||
| lvr2::DenseVertexMap<float> costs_; | ||
|
|
||
| // Combined lethal vertices | ||
| std::set<lvr2::VertexHandle> lethals_; | ||
|
|
||
| // Configured layers; use weak_ptr to prevent shared_ptr cycles | ||
| std::vector<std::weak_ptr<mesh_map::AbstractLayer>> inputs_; | ||
| }; | ||
|
|
||
|
|
||
| class CombinationLayer | ||
| : public mesh_map::AbstractLayer | ||
| { | ||
| public: | ||
|
|
||
| bool readLayer() override {return false;} | ||
| bool writeLayer() override {return true;} | ||
| float defaultValue() override {return 0.0;} | ||
| float threshold() override {return 1.0;} | ||
| lvr2::VertexMap<float>& costs() override {return costs_;} | ||
| std::set<lvr2::VertexHandle>& lethals() override {return lethals_;} | ||
|
|
||
| /** | ||
| * @brief Combines the configured layers | ||
| */ | ||
| bool computeLayer() override; | ||
|
|
||
| /** | ||
| * @brief Process a change in a lower layer | ||
| */ | ||
| virtual void onInputChanged( | ||
| const rclcpp::Time& timestamp, | ||
| const std::set<lvr2::VertexHandle>& changed | ||
| ) override; | ||
|
|
||
| /** | ||
| * @brief Initialize the layer | ||
| */ | ||
| bool initialize() override; | ||
|
|
||
| private: | ||
| // Combined costs | ||
| lvr2::DenseVertexMap<float> costs_; | ||
|
|
||
| // Combined lethal vertices | ||
| std::set<lvr2::VertexHandle> lethals_; | ||
|
|
||
| // Configured layers; use weak_ptr to prevent shared_ptr cycles | ||
| std::vector<std::weak_ptr<mesh_map::AbstractLayer>> inputs_; | ||
| }; | ||
|
|
||
| } // namespace mesh_map |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.