Re: [sensors] Investigate possibility of synchronizing coordinate systems

After taking a deeper look at this issue I think:
1) At the moment we do not need such a powerful tool as the [remapCoordinateSystem](https://developer.android.com/reference/android/hardware/SensorManager.html#remapCoordinateSystem(float%5B%5D,%20int,%20int,%20float%5B%5D)) function in Android, also an extra function call might annoy the users :)
2) It looks risky to rely on [orientation types](https://w3c.github.io/screen-orientation/#dom-orientationtype) for the sensor data mapping, as orientation type values are [assigned arbitrary by the UA](https://w3c.github.io/screen-orientation/#reading-the-screen-orientation).
   
After discussing this with @alexshalamov  we'd like to propose the following plan for fixing the issue:

- [ ] The [OrientationSensor API](https://w3c.github.io/orientation-sensor/) defines two local coordinate systems :
   - Device Coordinate System - bound to the physical device, same as used by sensors now (https://w3c.github.io/accelerometer/#local-coordinate-system)
   - Screen(View? Viewport ?) Coordinate System - bound to the `screen` as per [CSSOM-VIEW](https://www.w3.org/TR/cssom-view-1/), where  `X` points from screen left to right, `Y` points from screen bottom to top, `Z` is a vector product `X`x`Y`

- [ ] The OrientationSensor API defines:
```
   TriaxialSensorOptions : SensorOptions {
      DOMString coordSystem = "device"
   }
```

to be used for construction of all motion sensors

```
 // Device coordinate system
let accel = new Accelerometer({ coordSystem:"device" });  // or new Accelerometer(); 

// Screen coordinate system
let orientSensor = new RelativeOrientationSensor({ coordSystem:"screen" });

```
In future we could add `coordSystem:"custom"` + user-provided remapping function as @kenchris [proposed](https://github.com/w3c/sensors/issues/257#issuecomment-357068764).

- [ ] In order to solve the [opaqueness](https://github.com/w3c/sensors/issues/257#issuecomment-356901407), the Generic Sensor API defines:
```
Sensor {
readonly attribute SensorOptions? options;
}
```


-- 
GitHub Notification of comment by pozdnyakov
Please view or discuss this issue at https://github.com/w3c/sensors/issues/257#issuecomment-358721651 using your GitHub account

Received on Thursday, 18 January 2018 17:32:56 UTC