From 266c33def293211d6ec1093327a2d63a7196d321 Mon Sep 17 00:00:00 2001 From: Tamagoham Date: Tue, 16 Jul 2024 11:18:40 -0500 Subject: [PATCH 1/4] :warning: fix ball disappear when camera is more than 2 --- visionreceive.go | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/visionreceive.go b/visionreceive.go index c053038..7b0ec83 100644 --- a/visionreceive.go +++ b/visionreceive.go @@ -219,6 +219,14 @@ 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 @@ -289,7 +297,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 { @@ -369,15 +377,6 @@ func VisionReceive(chvision chan bool, port int, ourteam int, goalpos int, simmo } } } - - // 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 = true if packet.Detection.GetBalls() != nil { From 9a067b64ede3a994c7758206aa1329169a8743fb Mon Sep 17 00:00:00 2001 From: Tamagoham Date: Tue, 16 Jul 2024 11:18:57 -0500 Subject: [PATCH 2/4] :warning: commented out --- visionreceive.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/visionreceive.go b/visionreceive.go index 7b0ec83..c27dd86 100644 --- a/visionreceive.go +++ b/visionreceive.go @@ -297,7 +297,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) + // log.Println("maxconfball: ", maxconfball) // Get Blue Robots for _, robot := range packet.Detection.GetRobotsBlue() { switch halfswitch_n { From a11f2b6385cdee5f2641d5e3625e0958f46b7098 Mon Sep 17 00:00:00 2001 From: Tamagoham Date: Tue, 16 Jul 2024 11:39:23 -0500 Subject: [PATCH 3/4] :warning: fix ball exist check --- visionreceive.go | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/visionreceive.go b/visionreceive.go index c27dd86..c6d7885 100644 --- a/visionreceive.go +++ b/visionreceive.go @@ -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 @@ -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 { @@ -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 @@ -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 { From 16443cc1acbc05ebe6f04b6f5088b4dc263b7c88 Mon Sep 17 00:00:00 2001 From: Tamagoham Date: Wed, 17 Jul 2024 11:15:24 +0200 Subject: [PATCH 4/4] :warning: remove logs --- visionreceive.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/visionreceive.go b/visionreceive.go index c6d7885..92dbac0 100644 --- a/visionreceive.go +++ b/visionreceive.go @@ -433,8 +433,6 @@ 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 {