Skip to content

Commit 64dad4a

Browse files
committed
Improve cache ram usage
1 parent 5c3e6a0 commit 64dad4a

7 files changed

Lines changed: 1154 additions & 87 deletions

File tree

include/frontier_exploration_ros2/debug/debug_analyzer.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ struct FrontierDebugSnapshot
117117
std::size_t decision_map_total_chunks{0};
118118
std::size_t decision_map_dirty_chunks{0};
119119
bool decision_map_geometry_changed{false};
120+
DecisionMapGeometryTransition decision_map_geometry_transition{
121+
DecisionMapGeometryTransition::FullRebuildFallback};
120122
bool decision_map_config_changed{false};
121123
bool decision_map_output_reused{false};
122124
bool decision_map_output_changed{false};

include/frontier_exploration_ros2/debug/debug_markers.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ visualization_msgs::msg::MarkerArray make_dp_pruning_markers(
7272
const DebugMarkerConfig & config);
7373

7474
// Decision-map chunk-cache overlay. Green borders mean raw chunk cache hit,
75-
// red borders mean that chunk was rebuilt, and yellow borders mark geometry
76-
// reset/full rebuild events such as map growth or origin changes.
75+
// red borders mean that chunk was rebuilt, and yellow borders mark true
76+
// full-rebuild fallbacks when geometry reuse was not possible.
7777
visualization_msgs::msg::MarkerArray make_decision_map_chunk_cache_markers(
7878
const FrontierDebugSnapshot & snapshot,
7979
const DebugMarkerConfig & config);

include/frontier_exploration_ros2/decision_map.hpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ struct DecisionMapResult
104104
enum class DecisionMapGeometryTransition : uint8_t
105105
{
106106
SameGeometry = 0,
107-
GrowthReuse = 1,
107+
OverlapReuse = 1,
108+
GrowthReuse = OverlapReuse,
108109
FullRebuildFallback = 2,
109110
};
110111

@@ -136,12 +137,9 @@ struct DecisionMapWorkspace
136137
double last_build_sigma_r{30.0};
137138
int last_build_dilation_radius_cells{1};
138139

139-
// Images for the current raw input, staging copy, and optimization outputs.
140+
// Images for the current raw input and optimization outputs.
140141
PaperImage raw_image;
141-
PaperImage raw_scratch_image;
142-
std::vector<float> filtered_image;
143142
PaperImage threshold_image;
144-
PaperImage optimized_image;
145143
PaperImage dilation_scratch;
146144

147145
// Cached raw occupancy values and chunk metadata for chunk-aware dirty detection.

src/debug/debug_analyzer.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ void annotate_decision_map_cache(
204204
snapshot.decision_map_total_chunks = decision_map_status.total_chunks;
205205
snapshot.decision_map_dirty_chunks = decision_map_status.dirty_chunks;
206206
snapshot.decision_map_geometry_changed = decision_map_status.geometry_changed;
207+
snapshot.decision_map_geometry_transition = decision_map_status.geometry_transition;
207208
snapshot.decision_map_config_changed = decision_map_status.config_changed;
208209
snapshot.decision_map_output_reused = decision_map_status.reused_existing_output;
209210
snapshot.decision_map_output_changed = decision_map_status.output_changed;
@@ -219,7 +220,10 @@ void annotate_decision_map_cache(
219220
DecisionMapChunkDebugCell cell;
220221
cell.chunk_x = chunk_x;
221222
cell.chunk_y = chunk_y;
222-
if (decision_map_status.geometry_changed) {
223+
if (
224+
decision_map_status.geometry_changed &&
225+
decision_map_status.geometry_transition == DecisionMapGeometryTransition::FullRebuildFallback)
226+
{
223227
cell.state = DecisionMapChunkDebugState::GeometryReset;
224228
} else if (
225229
chunk_index < decision_map_workspace.dirty_chunk_flags.size() &&

src/debug/debug_markers.cpp

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,20 @@ std_msgs::msg::ColorRGBA mrtsp_rank_color(std::size_t rank, std::size_t total)
265265
return rgba(0.15F + (0.85F * t), 0.9F - (0.55F * t), 0.25F, 0.9F);
266266
}
267267

268+
std::string geometry_transition_label(DecisionMapGeometryTransition transition)
269+
{
270+
switch (transition) {
271+
case DecisionMapGeometryTransition::SameGeometry:
272+
return "same";
273+
case DecisionMapGeometryTransition::OverlapReuse:
274+
return "overlap_reuse";
275+
case DecisionMapGeometryTransition::FullRebuildFallback:
276+
return "full_rebuild";
277+
}
278+
279+
return "unknown";
280+
}
281+
268282
} // namespace
269283

270284
visualization_msgs::msg::MarkerArray make_raw_frontier_markers(
@@ -649,9 +663,13 @@ visualization_msgs::msg::MarkerArray make_decision_map_chunk_cache_markers(
649663
<< "\nhit=" << hit_count
650664
<< " dirty=" << dirty_count
651665
<< " reset=" << reset_count
666+
<< "\ngeometry=" << geometry_transition_label(snapshot.decision_map_geometry_transition)
652667
<< "\noutput=" << (snapshot.decision_map_output_reused ? "hit" : "miss")
653668
<< " changed=" << (snapshot.decision_map_output_changed ? "yes" : "no");
654-
if (snapshot.decision_map_geometry_changed) {
669+
if (
670+
snapshot.decision_map_geometry_changed &&
671+
snapshot.decision_map_geometry_transition == DecisionMapGeometryTransition::FullRebuildFallback)
672+
{
655673
summary << "\ngeometry_reset=yes";
656674
} else if (snapshot.decision_map_config_changed) {
657675
summary << "\nconfig_rebuild=yes";

0 commit comments

Comments
 (0)