Skip to content

Commit

Permalink
⚠️ fix ball exist check
Browse files Browse the repository at this point in the history
  • Loading branch information
Tamagoham committed Jul 16, 2024
1 parent 9a067b6 commit a11f2b6
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions visionreceive.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,14 +219,6 @@ func VisionReceive(chvision chan bool, port int, ourteam int, goalpos int, simmo
// f := new(os.File)
// f, _ = os.OpenFile("./ball_cords.txt", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0644)

// Get Most High Confidence ball
var maxconfball *pb_gen.SSL_DetectionBall = &pb_gen.SSL_DetectionBall{
Confidence: proto.Float32(0.0),
X: proto.Float32(0.0),
Y: proto.Float32(0.0),
PixelX: proto.Float32(0.0),
PixelY: proto.Float32(0.0),
}
for {
var visible_in_vision_b [16]bool
var visible_in_vision_y [16]bool
Expand Down Expand Up @@ -297,7 +289,7 @@ func VisionReceive(chvision chan bool, port int, ourteam int, goalpos int, simmo
left_geo_goal_x = left_geo_goal_x * -1
}
}
// log.Println("maxconfball: ", maxconfball)

// Get Blue Robots
for _, robot := range packet.Detection.GetRobotsBlue() {
switch halfswitch_n {
Expand Down Expand Up @@ -377,7 +369,17 @@ func VisionReceive(chvision chan bool, port int, ourteam int, goalpos int, simmo
}
}
}
// is_ball_exists = true

// Get Most High Confidence ball
var maxconfball *pb_gen.SSL_DetectionBall = &pb_gen.SSL_DetectionBall{
Confidence: proto.Float32(0.0),
X: proto.Float32(0.0),
Y: proto.Float32(0.0),
PixelX: proto.Float32(0.0),
PixelY: proto.Float32(0.0),
}

is_ball_exists = false

if packet.Detection.GetBalls() != nil {
var usethisball bool
Expand Down Expand Up @@ -431,6 +433,8 @@ func VisionReceive(chvision chan bool, port int, ourteam int, goalpos int, simmo
// framecounter = int(1 / frameinterval)
// }

log.Println(ball)

// log.Println("framecounter: ", framecounter)

if framecounter-pre_framecounter > 0 {
Expand Down

0 comments on commit a11f2b6

Please sign in to comment.