Skip to content

Commit 5223b30

Browse files
committed
Add continuation issue for ball outside field
1 parent dd937d3 commit 5223b30

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

internal/app/engine/process_continue_next_command.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"github.com/RoboCup-SSL/ssl-game-controller/internal/app/state"
77
"github.com/RoboCup-SSL/ssl-game-controller/pkg/timer"
88
"google.golang.org/protobuf/types/known/timestamppb"
9+
"math"
910
"strings"
1011
"time"
1112
)
@@ -221,6 +222,13 @@ func (e *Engine) readyToContinueFromStop() (issues []string) {
221222
ballToPlacementPosDist, e.gameConfig.BallPlacementRequiredDistance))
222223
}
223224
}
225+
226+
ballPos := e.trackerStateGc.Ball.Pos.ToVector2()
227+
if math.Abs(float64(*ballPos.X)) > e.getGeometry().FieldLength/2 ||
228+
math.Abs(float64(*ballPos.Y)) > e.getGeometry().FieldWidth/2 {
229+
issues = append(issues, fmt.Sprintf("Ball is outside of field: %v", ballPos))
230+
}
231+
224232
if !e.trackerStateGc.Ball.IsSteady() {
225233
issues = append(issues, "Ball position is not steady")
226234
}

0 commit comments

Comments
 (0)