MetaMotionS: Unclear output data format
Hi,
I am busy reverse engineering the C++ SDK for using the metamotionS in Dart.
For now I am rapid prototyping the config and start of the Sensor Fusion in Python.
I am able to get a stream of data on the notification gatt service, and its header indicaties it is indeed Sensor Fusion data.
However the data, when converted to float32, shows for a full rotation something like around 11.00.
This makes no sense to me.
I basically performed the same instructions as is done in the C++ SDK in mbl_mw_sensor_fusion_config and mbl_mw_sensor_fusion_start.
I tried to configure it for NDOF and Euler angles
The output in bytes after a full rotation:
[25, 8, 129, 240, 179, 67, 29, 93, 45, 65, 230, 105, 140, 188, 129, 240, 179, 67]
The first two bytes 25 and 8 is the header and indicates sensor fusion data in euler format, the the data has 4 floats for heading, pitch, roll, and yaw (MblMwEulerAngles).
Therefore the decoded data for heading, pitch, roll, and yaw is:
359.88, 10.84, -0.02, 359.88
What am I missing here, why do I get 10.84, where I would expect a full rotation (360 degrees, or just around 0).
(The values around 359,88 are there because of a slight negative rotation around that axis, not the axis I turned the full 360 degrees)
Thank you in advance!!!
Comments
@Doubie
It may be within the error margin immediately after turning on the sensor fusion. If you are not using a fixture there may be some angle error in the final resting position. Auto calibration of the magnetometer may be kicking in or introducing an offset.
I would definitely be careful to follow the settings the C++ API uses when configuring sensor fusion. Some of the modes require fairly specific sampling rates from the raw sensor, and that is generally enforced by the API.
In general as you break down different modules, I would preserve the sequencing of commands as closely as possible. There are many operations throughout the firmware that need to happen in order to behave correctly.
Hi @Matt,
Thanks for your response.
I reverse engineered all the sequences from the SDK, including the sample rates (those +1 and -1 of the enums as well)
I'm a bit lost here why it only outputs 10 at a full rotation instead of 360 degrees. I have been fiddling around quite a bit already.
I kept all the sequences in the mbl_mw_sensor_fusion_config and mbl_mw_sensor_fusion_start.
As a summary, this is the sequence now (in pseudo python code, for a MetaMotionS):
@Doubie
Just playing with the sensorfusion a little bit at my desk.
When sensor fusion is first enabled pitch and roll both start at zero. Shortly afterwards they converge to true pitch and roll values, presumably mostly from the gravity vector but possible magnetometer as well.
It seems quite possible that the pitch value of around 10 is just the absolute pitch of the surface your sensor is sitting on?
I would maybe try capturing a short stream so there is more data to consider. The fact that you're getting something that seems close to valid is a very good sign. If you still have doubts, it would be much easier if you could print out all the bytes you are sending the device as hex strings, for me to look at.