Start a new topic

Magnetometer/compass questions (Android)

Hi! I am using Wikitude 7.1.0 with ODG R-7 smartglasses. I have some difficulties calibrating the compass and therefore, have some questions regarding how the magnetometer is used by Wikitude.


1. What values does Wikitude use from the magnetometer: TYPE_MAGNETIC_FIELD or TYPE_MAGNETIC_FIELD_UNCALIBRATED? 


2. In an older topic it was stated that inserting compass values manually is not possible with Wikitude. Is this still the case?


3. I noticed that in the hardware class, there is a method: sensors.compass.correctionAngle 

 

 

"Defines a correction angle clockwise of the compass in degrees. Values will be applied modulo 360. A value of 361 degrees has the same effect as setting the value to 1 degree." 

How is this method used, exactly? Is this correction value added or substracted from the actual value?

Thanks for your help! :)


Hi Janna,


please describe your issue a bit more.

Is it the compass heading that is incorrect?

Do you encounter the same issue in the sample app?


1.) Since the ODG R-7 has a gyroscope the SDK will use TYPE_ROTATION_VECTOR, for devices without gyroscope the SDK uses TYPE_MAGNETIC_FIELD in combination with TYPE_ACCELEROMETER.


2.) It is still the case that you can not insert sensor values into the SDK.


3.) It can be used in combination with a more accurate compass to counter errors in the phone/glass compass. The rotation will be added.


Best Regards,

Alex

The issue is that an object rendered to a GPS point is not always shown at the correct location. With several objects, this is seen as the objects keeping the correct distances with respect to each other but with regards to the world, the group of rendered objects is at different times turned or shifted. For example, depending on the time of running the application, you might see these objects in different directions than the previous time. In one test, an object was supposed to be shown (more or less) North of the user, but was shown more to the South of the user instead. Looking at a compass app it was seen that the compass heading was indeed incorrect, as the direction of North was, according to the compass, closer to the South. I came to the conclusion that application “thought” it was rendering the object to the correct place, but interpreted the user’s heading wrong.

 

If memory serves, the sample app uses relative locations for geo-objects, so I’m not sure how to do comparisons with the samples. Perhaps I could try to modify some of them and see if I encounter the same issue.

 

So the ODG SDK utilizes both the magnetometer and the gyroscope?

Hi Janna,


the sample app does use relative locations but you could try to check a sample that includes a radar(Browsing Pois).

The radar has a compass augmentation, which you could use to verify the issue.


Yes, since SDK 7.0 the ODG magnetometer, accelerometer and gyroscope.


Best Regards,

Alex 

Excellent, I will try the radar sample! 


Just to be clear, Wikitude gets the rotation matrix from the TYPE_ROTATION_VECTOR values (SensorManager.getRotationMatrixFromVector) and then the heading from SensorManager.getOrientation using that rotation matrix?

Hi Janna,


we do not use SensorManager.getOrientation, we just use the rotation matrix.


Best Regards,

Alex

 


Hi, it seems that the problem is not the magnetometer. Based on tests, there is a problem with the rotation vector.


Here is an image of the coordinate system defined by ODG. Is the coordinate system depicted in the image behind the link what Wikitude is expecting?  


In my tests, I noticed that determining orientation using the rotation vector only works when the device is tilted so that the z-axis is pointing upwards (the user is looking down). This would correspond to a phone being held levelly on a table as defined by Android. This is not specific to Wikitude, I tested compass apps for Android. To me, this behavior does not sound like what should be expected. The reason is still unclear and I am talking with ODG support. 


For software done with Wikitude, this problem could be bypassed if it was possible to modify the rotation vector values used by the SDK. Apparently modifying sensor values is not possible for Android operating systems. Is adding functions for inserting modified sensor data something that Wikitude could consider? There could be other incentives for this as well, as described in my suggestion here.

Hi Janna,


thank you for your research on this. It would be great if you could inform us about the information you receive from ODG so we could maybe improve our ODG SDK in the future.


I could send you a custom version of the SDK 7.1 that would not use the gyroscope, if that would help you, until we can provide a way to inject sensor data into the SDK.

Note that a version without the gyroscope would lead to less stable POIs.


Best Regards,

Alex

Hi,


A custom version of the SDK would be great if it is possible for you to provide it! Without the gyroscope, the orientation calculations would be done based on just the accelerometer and magnetometer and not the rotation vector, right? So perhaps that could help. What information do you need for sending it?


I am happy to communicate the information I receive from ODG. So far the reason behind the issue could be incorrect factory calibration of the magnetometer. On the other hand, according to the coordinate axis system defined by ODG, yaw or the compass heading would be the rotation around the Y-axis and not Z, which is usually is. I am wondering if that is also a component in this matter.


Thank you so much for being so cooperative and helpful!

Hi Janna.


you can download the custom SDK here.


Best Regards,

Alex

Hi, and thanks for the custom SDK. Unfortunately, the issue still persist. It is as if the magnetometer coordinate axes are defined incorrectly. So in order to work with this device, some way to inject sensor data for the SDK is needed. In the feature request here it was said such a feature could be included in an upcoming release. Can you provide any estimate on when this release might happen, please? Or, could it be possible to get a custom version of the SDK with an additional function for the rotation vector data before that? 


I am working in a project that has a demanding timetable and we have been set back because of this issue with the device. So we are seeking options to rectify this situation as soon as possible and appreciate all the help. 

Hi Janna,


I was able to reproduce this issue with our ODG-R7 and created a ticket in our internal issue tracker. We are planning to investigate a few wearable related issues soon where this issue should be addressed.


Unfortunately i can not provide an estimate on when the sensor value injection feature will be implemented yet.


Best Regards,

Alex

Hi,


Thanks for letting me know. I was hoping this issue was due to this particular device being incorrectly calibrated - this is the conclusion ODG support came to, and they agreed to replace the device. However, since this issue can be seen with your device as well, either both this device and your device have incorrect calibration or the reason is something else, for example the coordinate system definition by ODG. But the product has been sold since 2015 (if I remember correctly) and thus, one would think such a problem would have been noticed and fixed earlier. 


Have you ever managed to get the orientation/compass working with the ODG R-7? Is your ODG R-7 running the Marshmallow version of their OS?

Hi, 


I tested it with SDK version 7.0  and it seems to work fine there. 

Can you verify this for your app as well?


You can download it here.



Hi,


Is there some change between the SDK versions that would explain why 7.0 works and 7.1 does not? The radar sample at least seems to work with the 7.0 version. I will do further testing with my own app.

Login or Signup to post a comment