Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code related to ConvertToRight function #7

Open
worry80 opened this issue May 9, 2020 · 2 comments
Open

Code related to ConvertToRight function #7

worry80 opened this issue May 9, 2020 · 2 comments

Comments

@worry80
Copy link

worry80 commented May 9, 2020

When I wrote the AgentClient code, I noticed some problems with the ConvertToRight function. the players' direction is stored in radians, but when the Referee system converts the court data to the yellow team data, 180 is used as the Pi, which leads to the confusion of the angle.So I hope to replace 180 with Pi to solve this problem.

Below is the source code of this function.(Program.cs: 614)

private static FiraMessage.RefToCli.Environment ConvertToRight(FiraMessage.RefToCli.Environment cliEnvironment)
        {
            return new FiraMessage.RefToCli.Environment
            {
                FoulInfo = cliEnvironment.FoulInfo,
                Frame = new Frame
                {
                    Ball = new FiraMessage.Ball
                    {
                        X = -cliEnvironment.Frame.Ball.X,
                        Y = -cliEnvironment.Frame.Ball.Y
                    },
                    RobotsBlue =
                    {
                        cliEnvironment.Frame.RobotsBlue.Select((robot, i) => new FiraMessage.Robot
                        {
                            RobotId = robot.RobotId,
                            X = -robot.X,
                            Y = -robot.Y,
                            Orientation = robot.Orientation > 0 ? robot.Orientation - 180 : robot.Orientation + 180
                        })
                    },
                    RobotsYellow =
                    {
                        cliEnvironment.Frame.RobotsYellow.Select((robot, i) => new FiraMessage.Robot
                        {
                            RobotId = robot.RobotId,
                            X = -robot.X,
                            Y = -robot.Y,
                            Orientation = robot.Orientation > 0 ? robot.Orientation - 180 : robot.Orientation + 180
                        })
                    }
                }
            };
        }
@worry80
Copy link
Author

worry80 commented May 10, 2020

I found the same situation in ConvertFromRight function, SecondHalfTransform function and MatchInfo2Packet function

@peng1999
Copy link
Member

You are always welcome to create a PR directly. But because of the COVID-19 pandemic, it will take a little longer to merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants