Sensor Fusion Question
Two code examples:
A: https://pastebin.com/wJu4J95a
B: https://pastebin.com/2vtKrqNB
Both connect to a MetaWear device, subscribe to sensor fusion and print the raw data. The only difference is that example A only subscribes to the Euler angles, whereas B subscribes to both Euler and the corrected acceleration. What I don't understand is: the second one crashes with a "Bus Error" message - no explanation given. Example A runs perfectly.
What am I missing? And how should I get my corrected acceleration data if not like this?
This discussion has been closed.
Comments
You need to configure the bt connection for high frequency streaming:
https://mbientlab.com/cppdocs/latest/advanced_features.html#high-frequency-streaming
The "bus error" is most likely from some socket code used by the underling BT library.
Your code is how to get corrected acceleration data though 2 sensor fusion outputs @ 100Hz each is not recommended over the BLE link.
How should I go about getting both Euler and corrected acceleration then?
Calling
Does not remove the bus error.
Reduce the streaming frequency or log the data.
I haven't been able to reproduce the bus error on my openSUSE VM; I'll try on the Pi when I get it back. How long does your script run before it shows up?
T - 0 seconds.
The combination of Euler + corrected acceleration isn't working, even at reduced speeds.
However, the combination of Euler + Quaternion is working as expected.
For reference, this is a list of permutation that works:
While these throw an uncatchable (by Python) Bus error.
Meaning, that I can subscribe to CORRECTED_MAG + EULER_ANGLE at the same time, but not to CORRECTED_ACC + EULER_ANGLE. Is this intended behavior? MetaMotionR with latest firmware.
Well, clearly it's not intended that a bus error would be thrown if you attempt to subscribe to those specific combinations of sensor fusion signals.
I narrowed down the cause of the bus error to these lines in the C++ code:
https://github.com/mbientlab/MetaWear-SDK-Cpp/blob/0.13.4/src/metawear/impl/cpp/datainterpreter.cpp#L222
https://github.com/mbientlab/MetaWear-SDK-Cpp/blob/0.13.4/src/metawear/impl/cpp/datainterpreter.cpp#L211
For whatever reason, it doesn't seem like ARM appreciates typecasting the
uint8_t*
array to aMblMwCorrectedCartesianFloat*
; the same code runs fine on x86 CPUs. I'll push a patch up today and you can try the updated C++ code to see if that fixes your issue.Yes it's ARM. Raspberry PI 3 B+ to be exact.
And no, it's still not working.
Gyro, Magnet, Quater and Euler are working fine though. Even all four at the same time with
(7.5, 7.5, 0, 6000)
settings.Did you update the
libmetawear.so
library with the latest release? The new C++ code works fine on my Pi3.