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

xVel, yVel in handleUpdate #100

Open
afracxas opened this issue Jan 5, 2021 · 1 comment
Open

xVel, yVel in handleUpdate #100

afracxas opened this issue Jan 5, 2021 · 1 comment

Comments

@afracxas
Copy link

afracxas commented Jan 5, 2021

Hi, this is TOM.
I found some strange thing below code in handleUpdate function. It may be bug or not.
double xVel = sdi.getSpeed() * Math.cos(sdi.getCourse());
double yVel = sdi.getSpeed() * Math.sin(sdi.getCourse());
sdi.getCourse() return bearing of android location.
Unit of bearing is degree not radian. But argument of Math.cos/sin is an angle, in radians.
And the start point (zero degree) of bearing is north. so I think that code should be modified like below
double xVel = sdi.getSpeed() * Math.sin(Math.toRadians(sdi.getCourse()));
double yVel = sdi.getSpeed() * Math.cos(Math.toRadians(sdi.getCourse()));

@Lezh1k
Copy link
Collaborator

Lezh1k commented Jan 8, 2021

Hello, Tom (@afracxas )

Thank you, I'll check this.

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