Checkpoint 3

This commit is contained in:
Johnny Fernandes
2026-05-10 12:46:14 +01:00
parent 1bb9415414
commit 2a6db038df
16 changed files with 305 additions and 662 deletions
+8 -7
View File
@@ -44,7 +44,7 @@ WALL_HARD_GAIN = 50.0
FLEE_DIST = 7.0
SEPARATION_DIST = 2.5
COHESION_DIST = 8.0
COHESION_DIST = 12.0 # was 8.0 — wider engagement so far-flung sheep are pulled in
PEN_MARGIN = 0.8
@@ -125,12 +125,13 @@ def compute_heading_speed(x, y, penned, dog_xy, peers, wander_angle, rng=None):
cy += py
cn += 1
if cn > 0:
# Cohesion needs to be comparable to flee at close range to keep
# the flock together through narrow obstacles like the 3m gate.
# Flee at 2m has magnitude ~10; cohesion at peer-distance 5m
# with w=1.5 contributes ~7.5 — same order, so the flock
# translates as a unit instead of fragmenting under pressure.
w = 1.5 if fleeing else 0.6
# Cohesion needs to dominate flee at close range so the flock
# stays glued together when squeezing through the narrow gate.
# Flee at 2 m has magnitude ~10; cohesion of w=3.0 with the
# peer-CoM 4 m away contributes ~12, so the flock prefers
# bunching to dispersing under pressure. This is what makes
# canonical Strömbom drive work in our 3 m gate.
w = 3.0 if fleeing else 1.0
fx += (cx / cn - x) * w
fy += (cy / cn - y) * w