Skip to content

Commit 5d5e3bc

Browse files
committed
[bugfix] Fixed coordinates and rotation
1 parent 64b7794 commit 5d5e3bc

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

pkg/vision/converter.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func ProtoToPackage(frame *sslproto.SSL_DetectionFrame, geometry *sslproto.SSL_G
4545

4646
func createBallShape(ball *sslproto.SSL_DetectionBall) Circle {
4747
return Circle{
48-
Center: Point{*ball.X, *ball.Y},
48+
Center: Point{*ball.X, -*ball.Y},
4949
Radius: ballRadius,
5050
Style: Style{
5151
StrokeWidth: &ballStrokeWidth,
@@ -62,8 +62,8 @@ func addGeometryShapes(pack *Package, geometry *sslproto.SSL_GeometryData) {
6262
pack.GoalDepth = float32(*geometry.Field.GoalDepth)
6363
for _, line := range geometry.Field.FieldLines {
6464
pack.Lines = append(pack.Lines, Line{
65-
P1: Point{*line.P1.X, *line.P1.Y},
66-
P2: Point{*line.P2.X, *line.P2.Y},
65+
P1: Point{*line.P1.X, -*line.P1.Y},
66+
P2: Point{*line.P2.X, -*line.P2.Y},
6767
Style: Style{
6868
Stroke: &white,
6969
StrokeWidth: &lineWidth,
@@ -72,7 +72,7 @@ func addGeometryShapes(pack *Package, geometry *sslproto.SSL_GeometryData) {
7272
}
7373
for _, arc := range geometry.Field.FieldArcs {
7474
pack.Circles = append(pack.Circles, Circle{
75-
Center: Point{*arc.Center.X, *arc.Center.Y},
75+
Center: Point{*arc.Center.X, -*arc.Center.Y},
7676
Radius: *arc.Radius,
7777
Style: Style{
7878
Stroke: &white,
@@ -111,7 +111,7 @@ func goalLinesPositive(geometry *sslproto.SSL_GeometryData) (lines []Line) {
111111
func createBotPath(bot *sslproto.SSL_DetectionRobot, fillColor string) Path {
112112
b := Bot{center2Dribbler, botRadius}
113113
x := float64(*bot.X)
114-
y := float64(*bot.Y)
114+
y := -float64(*bot.Y)
115115
o := float64(*bot.Orientation)
116116
return Path{
117117
D: []PathElement{
@@ -148,7 +148,7 @@ func createBotPath(bot *sslproto.SSL_DetectionRobot, fillColor string) Path {
148148
func createBotId(bot *sslproto.SSL_DetectionRobot, strokeColor string) Text {
149149
return Text{
150150
Text: strconv.Itoa(int(*bot.RobotId)),
151-
P: Point{*bot.X, *bot.Y},
151+
P: Point{*bot.X, -*bot.Y},
152152
Style: Style{
153153
Fill: &strokeColor,
154154
},
@@ -165,17 +165,17 @@ func (b Bot) orient2CornerAngle() float64 {
165165
}
166166

167167
func (b Bot) botRightX(orientation float64) float64 {
168-
return math.Cos(orientation+b.orient2CornerAngle()) * b.botRadius
168+
return math.Cos(-orientation+b.orient2CornerAngle()) * b.botRadius
169169
}
170170

171171
func (b Bot) botRightY(orientation float64) float64 {
172-
return math.Sin(orientation+b.orient2CornerAngle()) * b.botRadius
172+
return math.Sin(-orientation+b.orient2CornerAngle()) * b.botRadius
173173
}
174174

175175
func (b Bot) botLeftX(orientation float64) float64 {
176-
return math.Cos(orientation-b.orient2CornerAngle()) * b.botRadius
176+
return math.Cos(-orientation-b.orient2CornerAngle()) * b.botRadius
177177
}
178178

179179
func (b Bot) botLeftY(orientation float64) float64 {
180-
return math.Sin(orientation-b.orient2CornerAngle()) * b.botRadius
180+
return math.Sin(-orientation-b.orient2CornerAngle()) * b.botRadius
181181
}

0 commit comments

Comments
 (0)