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

Improve acceleration output resolution #718

Closed
rzeira opened this issue Dec 2, 2021 · 5 comments
Closed

Improve acceleration output resolution #718

rzeira opened this issue Dec 2, 2021 · 5 comments
Labels
enhancement New feature or request plugin: motion

Comments

@rzeira
Copy link

rzeira commented Dec 2, 2021

Feature Request

Plugin

Motion plugin

Description

Output resolution for acceleration currently goes down to one decimal place (i.e. 10 cm/s^2 at best). The equivalent cordova plugin provides the same acceleration measurement on the same hardware down to several decimal places, as if it was returning the full floating point number. Would it be possible to return the same float with the Capacitor motion plugin?

Preferred Solution

Return full float output from motion plugin.

@jcesarmobile jcesarmobile added enhancement New feature or request plugin: motion labels Dec 3, 2021
@jcesarmobile
Copy link
Member

At the moment Motion plugin uses the web implementation in all platforms, so only Google and Apple can fix this.

We might consider switching to a native implementation.

@arielhasidim
Copy link

adding more info:
In the last week I experienced with Motion API and cordova-plugin-device-orientation as alternatives for getting compass-orientation, and sadly Motion-API is no good for me as alternative right now:

  • In the docs, though the subtitle states "The Motion API tracks accelerometer and device orientation (compass heading, etc.)", in the bottom is looks like you get only relative acceleration and rotation rate and no "compass" feature.
  • Even if Motion-API is implemented exactly like the Web-API, and actually has "compass feature", there are big differences with implementation for different browsers and iOS versions. Check this example
  • Asking for compass permission every launch upon user gesture is not an acceptable UX for me, and shouldn't be for every developer wishes to create native experience
  • cordova-plugin-device-orientation works great out of the box for me, I don't ask for premission over and over, I have really nice and simple method to listen for changes in compass reads with filtering by minimal change in degrees with very accurate resolution!

That's why I think Motion-API should implement native methods to get "devices compass", and even adopt the methods used in the old Cordova's plugin.

My project info:
"@capacitor/cli": "3.3.2",
"@capacitor/ios": "^3.3.2",
"@capacitor/angular": "^2.0.0",
"@angular/cli": "^13.1.1",
"@capacitor/motion": "^1.0.4", // not in use
"cordova-plugin-device-orientation": "^2.0.1",

BTW - Be aware that heading and compass used sometimes interchangeably to describe relative deviation from the magnetic north, while sometimes heading is used to to describe the vector of change in position relative to the north. I'm talking about implementing digital compass in my app and not the other kind of heading.

@HarelM
Copy link

HarelM commented Jul 28, 2022

I think native implementation is the right direction.
I also think a heading value in addition to the other values can help show the device orientation for navigation apps etc (for example, the one I'm writing) instead of trying to calculate it in JS code...
I don't like the fact that device-orientation plugin is deprecated and there's no real alternative (which means I'm using a deprecated software... :-() so it would be extremely helpful to have the motion plugin well supported.
If there's something I can do to progress this further let me know, I'll be happy to throw a PR based on the device-orientation code in Cordova...

@jcesarmobile
Copy link
Member

I've created a new issue for using native code in motion plugin, so I'm going to close this one in favor of the other one since the only way of improving the acceleration output resolution would be to use native code
#1192

@jcesarmobile jcesarmobile closed this as not planned Won't fix, can't repro, duplicate, stale Sep 20, 2022
@ionitron-bot
Copy link

ionitron-bot bot commented Oct 20, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of the plugin, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Oct 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request plugin: motion
Projects
None yet
Development

No branches or pull requests

4 participants