Logging Sensor Fusion and Raw Data
To start off, my setup is as follows: 7 MetaMotionC , 1 Rpi 4, 2 BLE Dongle (4 sensors on first Ble donlge , and 3 on the second), Code in Python. The purpose of the project is to record specific exercise data such as Acc, Gyro, Mag, Pressure, and Quaternion while the user is doing specific sets of exercises. I have all 7 sensors attached to the body and the Rpi (server that starts the sensors) on the ground or on a table. The Rpi and sensors aren't far apart from one another (Less then a meter apart).
Now, from what I have learned from searching through the forums and testing with my code are the following points related to logging:
1.There is a limited number of loggers that can be initiated by mbl_mw_datasignal_log()
2. Many raw sensors outputs can be logged at once by mbl_mw_datasignal_log() due to each having a small size (ex,raw Acc & raw Gyro & raw Mag & pressure all in the same session)
2. A maximum of 2 Sensor Fusion elements (Quaternion, Corrected Acc, Corrected gyro, etc.) can be logged any one time by mbl_mw_datasignal_log()
3. When it is needed to log both Raw data and Sensor Fusion, the only possible combination is 1 sensor fusion element and 2 raw data elements (ex, Quaternion & raw acc & raw gyro)
4. The number of elements that you are able to log with mbl_mw_datasignal_log() doesn't change even if you try to use the fuser processor to group all raw data (ex. raw acc & raw gyro & raw mag & pres) together in one logger object and another with a sensor fusion element (ex. Quaternion)
5. Many of the common processors don't work on sensor fusion elements for sensor fusion data manipulation is not supported
I would appreciate to know if everything I have stated as if now is correct.
So, I had initially wanted to log 5 components (Corrected Acc, Corrected Gyro, Corrected Mag, Quaternions, and Pressure). This is what I ideally want to do. However, due to the fact that only 2 elements can be logged from the sensor fusion module, I had to reduce it to only the Quaternions and switch back to the Raw Acc, Raw Gyro, Raw Mag as they are smaller in size and can all be logged. Next, I realised that it is was only possible to log 1 sensor fusion with only 2 additional raw data elements. I tried to group all of the 4 raw data elements into one data fuser processor to have only 2 log objects (the fuser processor and the Quaternions) but did not work as it seems that the same size is still being registered by the logger.
Now I am stuck as I need to log all 5 elements but can't think of any other solutions. I have thought up of a work around which is LOGGING all 4 raw elements (Raw Acc, Raw Gyro, Raw Mag, Pressure) and STREAMING the 1 sensor fusion element (Quaternions) and it works. However, I would like log all of them if possible so are there any solution I can try??
I have had a lot of trouble with streaming as I have been getting many disconnections. I have been able to create a reconnect function to handle a sudden disconnection is detected but I don't know how to make it continue from where it left off. For example, I would not know did it get disconnected before streaming so I would just need to connect it and make it wait at stand by, or did it disconnected while streaming which would take some time to connect and start recording again and thus lead to many of the data being lost which would ruin my session. Restarting the whole system would be a better choice and redoing the session than writing a complicated re connection algorithm. I had used the maximum BLE parameters to try to have a stable connection but it still isn't that reliable:
libmetawear.mbl_mw_settings_set_ad_parameters(self.device.board, 1000, 0, 0) libmetawear.mbl_mw_settings_set_tx_power(self.device.board, 4) libmetawear.mbl_mw_settings_set_connection_parameters(self.device.board, 7.5, 7.5, 0, 6000) sleep(1.5)
The problem is not the number of sensors connected to each BLE dongle( 4 - 3 sensors) for it is mentioned in the documentations that this number of sensors should have a reliable connection. I do restart the sensors when I disconnect to it manually which of course means that the previous mentioned connection settings (such as Tx-power) are reset to default but I reinitialise them again when I first connect to a sensor which should strengthen the connection after it has been connected.
To summarise, here are my main questions:
1. Is there anyway you can think of to log Corrected Acc, Corrected Gyro, Corrected Mag, Quaternion, and Pressure?
2. If not, how about logging Raw Acc, Raw Gyro, Raw Mag, Quaternion , and Pressure?
3. if not, then I would need to stream the Quaternion. Is there anyway to strengthen the connection stability so that a disconnection doesn't occur. Additionally, in a different post it was mentioned that you could reduce the Quaternion frequency (default 100 Hz) by using the processors (Accumulator/Averager) but that is not possible as the processors don't work on sensor fusion elements as previously discussed. So, is there any additional techniques to reduce the Quaternion frequency from 100Hz to something 25Hz because I will need to stream a maximum of 4 sensor Quaternions to one BLE Donge and as it is known the Maximum data throughput for a BLE connection is at 100-120 Hz.
I know you will ask what is the need to record of these elements but they are all necessary for my research project.