Skip to content

Commit d65301c

Browse files
committed
Fix ball placement pos on very small fields
When the field is very small, the placement pos may be outside of the field, as placement offsets of the penArea are larger than the field size. Now, the field size is preferred. For better placement positions, the geometry config needs to be adapted.
1 parent 19a1119 commit d65301c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

internal/app/statemachine/placementPos.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
package statemachine
22

33
import (
4+
"log"
5+
"math"
6+
47
"github.com/RoboCup-SSL/ssl-game-controller/internal/app/config"
58
"github.com/RoboCup-SSL/ssl-game-controller/internal/app/geom"
69
"github.com/RoboCup-SSL/ssl-game-controller/internal/app/state"
7-
"log"
8-
"math"
910
)
1011

1112
type BallPlacementPosDeterminer struct {
@@ -228,8 +229,12 @@ func (s *BallPlacementPosDeterminer) validateLocation(location *geom.Vector2) *g
228229
return s.CurrentPlacementPos
229230
}
230231

232+
// first move the location into the field, then out of defense area and again into the field
233+
// movePositionOutOfDefenseArea assumes the ball is inside the field.
234+
// But for very small fields, the ball may be outside the field after applying the placement offsets.
231235
s.movePositionInsideField(location)
232236
s.movePositionOutOfDefenseArea(location)
237+
s.movePositionInsideField(location)
233238

234239
return location
235240
}

0 commit comments

Comments
 (0)