Skip to content

Commit 1d483ec

Browse files
committed
Let the ball move towards touch line to simulate ball_left_field
1 parent d638553 commit 1d483ec

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

cmd/ssl-auto-ref-ci-client/main.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ var addressGcCi = flag.String("addressGc", "localhost:10009", "The address of th
1919

2020
var detectionFrame = createSSlDetectionFrame()
2121
var refereeMsg *state.Referee
22-
var robotSpeed = float32(1)
22+
var ballSpeed = float32(0)
23+
var ballAcc = float32(-0.26)
2324

2425
func main() {
2526
flag.Parse()
@@ -41,10 +42,13 @@ func main() {
4142
}
4243

4344
func simulate() {
44-
robotX := detectionFrame.RobotsBlue[0].X
45-
*robotX += robotSpeed / 100 * 1000
46-
if *robotX > 2000 || *robotX < -2000 {
47-
robotSpeed *= -1
45+
*detectionFrame.RobotsBlue[0].X = 1000
46+
ballY := detectionFrame.Balls[0].Y
47+
*ballY += ballSpeed / 100 * 1000
48+
ballSpeed += ballAcc * 0.01
49+
if *ballY > 4700 || ballSpeed <= 0 {
50+
*ballY = 0
51+
ballSpeed = 3
4852
}
4953
}
5054

0 commit comments

Comments
 (0)