KalebKE/FSensor

front / back inverted compass

openmotion opened this issue · 0 comments

i get compass / gyroscope data from sensor on my android app for google glass i have the rotation degree
but front and backdirection are inverted when marker is rotated

private void updateValues(float[] values) {
 float value_0 = fusedOrientation[0];
float gyro_left_right_degree = (float) (Math.toDegrees(value_0) + 360) % 360;

}

https://i.stack.imgur.com/3u7TT.png

this is my code for creating a line from my lat/lng pos

 public static GeoPoint movePoint(double latitude, double longitude, double distanceInMetres, double bearing) {
        double brngRad = toRadians(bearing);
        double latRad = toRadians(latitude);
        double lonRad = toRadians(longitude);
        int earthRadiusInMetres = 6371000;
        double distFrac = distanceInMetres / earthRadiusInMetres;
        double latitudeResult = asin(sin(latRad) * cos(distFrac) + cos(latRad) * sin(distFrac) * cos(brngRad));
        double a = atan2(sin(brngRad) * sin(distFrac) * cos(latRad), cos(distFrac) - sin(latRad) * sin(latitudeResult));
        double longitudeResult = (lonRad + a + 3 * PI) % (2 * PI) - PI;
        //Log.i(TAG,"movePoint latitude: " + toDegrees(latitudeResult) + ", longitude: " + toDegrees(longitudeResult));
        GeoPoint GeoPoint = new GeoPoint(toDegrees(latitudeResult), toDegrees(longitudeResult));
        return GeoPoint;
    }

Thanks