Skip to content

Commit c359a81

Browse files
committed
fix rebase messup add distance parameter
1 parent c050350 commit c359a81

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

crates/control/src/search_suggestor.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::{
22
f32::consts,
3-
ops::{Index, IndexMut},
3+
ops::{ControlFlow, Index, IndexMut, Range},
44
time::SystemTime,
55
};
66

@@ -176,6 +176,10 @@ impl SearchSuggestor {
176176
left_edge,
177177
right_edge,
178178
context.search_suggestor_configuration.decay_distance_factor,
179+
context
180+
.search_suggestor_configuration
181+
.heatmap_decay_range
182+
.clone(),
179183
);
180184
}
181185
}
@@ -263,6 +267,7 @@ impl Heatmap {
263267
left_edge: Vector2<Field>,
264268
right_edge: Vector2<Field>,
265269
decay_distance_factor: f32,
270+
heatmap_decay_range: Range<f32>,
266271
) {
267272
self.map.indexed_iter_mut().for_each(|((x, y), value)| {
268273
let tile_center_in_field: Vector2<Field> = vector![
@@ -276,8 +281,8 @@ impl Heatmap {
276281
&& get_direction(right_edge, robot_to_tile) == Direction::Clockwise;
277282
let distancse_to_tile = robot_to_tile.norm();
278283
let relative_distance_to_tile =
279-
clamp(distancse_to_tile / self.field_dimensions.length, 0.0, 1.0);
280-
if is_inside_sight && distancse_to_tile > 0.25 {
284+
clamp(distancse_to_tile / heatmap_decay_range.end, 0.0, 1.0);
285+
if is_inside_sight && heatmap_decay_range.contains(&distancse_to_tile) {
281286
*value *= 1.0 - decay_distance_factor * relative_distance_to_tile;
282287
}
283288
});

crates/types/src/parameters.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,7 @@ pub struct SearchSuggestorParameters {
430430
pub team_ball_weight: f32,
431431
pub rule_ball_weight: f32,
432432
pub decay_distance_factor: f32,
433+
pub heatmap_decay_range: Range<f32>,
433434
pub tile_target_heat_threshold_factor: f32,
434435
}
435436

etc/parameters/default.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1562,7 +1562,8 @@
15621562
"own_ball_weight": 1.0,
15631563
"team_ball_weight": 1.0,
15641564
"rule_ball_weight": 1.0,
1565-
"decay_distance_factor": 0.05,
1565+
"decay_distance_factor": 0.3,
1566+
"heatmap_decay_range": [0.25, 2.0],
15661567
"tile_target_heat_threshold_factor": 0.5
15671568
},
15681569
"physical_constants": {

0 commit comments

Comments
 (0)