-
-
Notifications
You must be signed in to change notification settings - Fork 362
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
simplify map rotation and use a low pass filter for damping #982
Conversation
You can (automatically) let issues close when a PR is merged, i.e. to make the process straightforward, you may add the "magic text" there in the pull request description. |
/* | ||
* time smoothing constant for low-pass filter 0 ≤ alpha ≤ 1 ; a smaller | ||
* value basically means more smoothing See: http://en.wikipedia.org/wiki | ||
* /Low-pass_filter#Discrete-time_realization |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would not split URL in two lines
I changed the file and it seems to have worked to push it to github. |
I hope you tested it.😉 |
I tested it :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have to admit, I do not really understand how/why this works (if it works, I did not test it yet), so I only commented on some code style issues.
Did you test that it works when:
- Tilting the phone?
- Rotating the phone from portrait mode to landscape mode, upside down etc.?
{ | ||
if(compassTimer == null) initializeCompassAnimator(); | ||
float Declination = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
variable names should start with lowercase
|
||
compassAnimator.targetRotation = azimut + displayRotation; | ||
compassAnimator.targetTilt = displayTilt; | ||
compassAnimator.targetTilt = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
targetTilt is always 0? This can't be correct,
private LowPassFilter filterYaw = new LowPassFilter(0.03f); | ||
|
||
static float rot = (float) 0.0; | ||
static float tilt = (float) 0.0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be no static mutable fields here.
Also, CompassAnimator does some smoothing on its own. So, this could be removed with this low-pass filter in place? |
@hochwasser will you continue to work on this PR or did you forgot it? |
@ENT8R I'm working on it. Before I do the next move the open issues from westnordost have to be fixed. The next thing in line is the interface to the map. Then I have to figure out what use "tilt" has. @ENT8R did you do anything in the map rotation area? |
I actually tried to implement a very first version of the automatic map rotation with #436 some time ago
Why is it not correct?
Google Maps does it this way. In StreetComplete you have to push up with two fingers to achieve the same effect. |
I implemented something like this now myself. |
I just tested it but from my point of view this filters out a little bit too much... The map is only moving very slow. And what is strange in addition to that is that the blue triangle which is showing the direction is moving much more faster than the map. |
The smoothing is a big extreme, yes, but perhaps you have a good sensor in your smartphone. There are a lot of shitty sensors out there. Also, now it behaves like a good-old analog compass. This can't be. I didn't change anything in that regard. |
I mean the map uses a filter now but the blue direction triangle is still using no filter so the movement is different... |
No, the direction triangle also uses that filter |
@ENT8R |
This PR will close #636
The following issues are addressed: