Sheep training flock of 10
This commit is contained in:
@@ -30,7 +30,7 @@ class HerdingEnv(gym.Env):
|
||||
# -----------------------------------------------------------------------
|
||||
# World constants — must match Webots world file
|
||||
# -----------------------------------------------------------------------
|
||||
MAX_SHEEP = 5
|
||||
MAX_SHEEP = 10
|
||||
FIELD = 15.0 # half-size; positions ∈ [-FIELD, FIELD]
|
||||
PEN_X = (10.0, 13.0)
|
||||
PEN_Y = (-15.0, -8.0)
|
||||
@@ -344,6 +344,14 @@ class HerdingEnv(gym.Env):
|
||||
if pos[1] < -F + m: fy += ((-F + m - pos[1]) / m) * 6.0
|
||||
if pos[1] > F - m: fy -= ((pos[1] - (F - m)) / m) * 6.0
|
||||
|
||||
# Hard-stop clamp: mirrors sheep.py — zero any force driving further
|
||||
# into the wall within 0.5 m so the flee force cannot pin the sheep.
|
||||
HS = 0.5
|
||||
if pos[0] < -F + HS and fx < 0: fx = 0.0
|
||||
if pos[0] > F - HS and fx > 0: fx = 0.0
|
||||
if pos[1] < -F + HS and fy < 0: fy = 0.0
|
||||
if pos[1] > F - HS and fy > 0: fy = 0.0
|
||||
|
||||
# Wander — suppressed while fleeing
|
||||
if not fleeing:
|
||||
if self.np_random.random() < 0.02:
|
||||
|
||||
Reference in New Issue
Block a user