Movesense - 加速度计采样率变化失败

时间:2018-01-26 13:22:36

标签: android accelerometer movesense

我无法使用移动API更改加速度计采样率: 我正在订阅这些命令:

 String strContract = sb.append("{\"Uri\": \"").append(connectedSerial).append(URI_MEAS_ACC_26).append("\"}").toString();
        Log.d(LOG_TAG, "subscribeToSensor 1" + strContract);

        subscribedDeviceSerial = connectedSerial;

        mdsSubscription = mMds.builder().build(this).subscribe(URI_EVENTLISTENER, strContract, new MdsNotificationListener() {

我试过这些字符串:

static private String URI_MEAS_ACC_13 = "/Meas/Acc/13";
static private String URI_MEAS_ACC_26 = "/Meas/Acc/26";
static private String URI_MEAS_ACC_52 = "/Meas/Acc/52";
static private String URI_MEAS_ACC_104 = "/Meas/Acc/104";
static private String URI_MEAS_ACC_208 = "/Meas/Acc/208";

将字符串更改为26,52和104订阅有效。然而,检查来自传感器的时间戳之间的差值仍然总是77 [ms] - 即始终保持13 [Hz]的采样率。请帮忙!

一些带有URI_MEAS_ACC_52的日志打印输出:

01-26 15:13:00.811 10469-10469/com.Activity: Starting Scan 
01-26 15:13:00.811 10469-10469/com.Activity:  onScanClicked 1 
01-26 15:13:01.121 10469-10469/com.Activity: scanResult: ScanResult{bleDevice=RxBleDeviceImpl{bluetoothDevice=Movesense 174430000143(0C:8C:DC:20:EE:13)}, rssi=-52, timestampNanos=99177277644328, callbackType=CALLBACK_TYPE_ALL_MATCHES, scanRecord=com.polidea.rxandroidble.internal.scan.ScanRecordImplNativeWrapper@34583822}
01-26 15:13:01.181 10469-10469/com.Activity: scanResult: ScanResult{bleDevice=RxBleDeviceImpl{bluetoothDevice=Movesense 174430000143(0C:8C:DC:20:EE:13)}, rssi=-52, timestampNanos=99177372142661, callbackType=CALLBACK_TYPE_ALL_MATCHES, scanRecord=com.polidea.rxandroidble.internal.scan.ScanRecordImplNativeWrapper@36f672b3}
01-26 15:13:02.571 10469-10469/com.Activity: scanResult: ScanResult{bleDevice=RxBleDeviceImpl{bluetoothDevice=Movesense 174430000143(0C:8C:DC:20:EE:13)}, rssi=-52, timestampNanos=99178753134171, callbackType=CALLBACK_TYPE_ALL_MATCHES, scanRecord=com.polidea.rxandroidble.internal.scan.ScanRecordImplNativeWrapper@1b36cfe9}
01-26 15:13:03.961 10469-10469/com.Activity: After Scan
01-26 15:13:03.971 10469-10469/com.Activity: 2: scanResult: [0C:8C:DC:20:EE:13 - Movesense 174430000143 [-52]]
01-26 15:13:03.971 10469-10469/com.Activity: connectBLEDevice 1: Connecting to BLE device: 0C:8C:DC:20:EE:13
01-26 15:13:06.621 10469-10469/com.Activity: connectBLEDevice 2: onConnect:0C:8C:DC:20:EE:13
01-26 15:13:07.921 10469-10469/com.Activity: connectBLEDevice 3: onConnectionComplete:0C:8C:DC:20:EE:13 - Movesense 174430000143 [-52]
01-26 15:13:07.921 10469-10469/com.Activity: subscribeToSensor 1: {"Uri": "174430000143/Meas/Acc/52"}
01-26 15:13:08.451 10469-10469/com.Activity: subscription onNotification(): {"Body": {"Timestamp": 43, "ArrayAcc": [{"x": -0.043072346597909927, "y": -0.53601139783859253, "z": 9.8563880920410156}, {"x": 0.01914326474070549, "y": -0.56711924076080322, "z": 9.8348522186279297}, {"x": -0.021536173298954964, "y": -0.6436922550201416, "z": 9.8348522186279297}, {"x": 0.7346227765083313, "y": -1.3184924125671387, "z": 9.7606725692749023}]}, "Uri": "174430000143/Meas/Acc/52", "Method": "PUT"}
01-26 15:13:08.601 10469-10469/com.Activity: subscription onNotification(): {"Body": {"Timestamp": 120, "ArrayAcc": [{"x": -0.31347095966339111, "y": -0.75137311220169067, "z": 9.9879980087280273}, {"x": -0.23689790070056915, "y": -0.60779863595962524, "z": 9.6601696014404297}, {"x": -0.11964540183544159, "y": -0.56472629308700562, "z": 9.7319574356079102}, {"x": -0.10528795421123505, "y": -0.56233340501785278, "z": 9.8468170166015625}]}, "Uri": "174430000143/Meas/Acc/52", "Method": "PUT"}
01-26 15:13:08.631 10469-10469/com.Activity: subscription onNotification(): {"Body": {"Timestamp": 197, "ArrayAcc": [{"x": -0.16750356554985046, "y": -0.61737030744552612, "z": 9.949711799621582}, {"x": -0.021536173298954964, "y": -0.61737030744552612, "z": 9.7941732406616211}, {"x": -0.093323417007923126, "y": -0.58626246452331543, "z": 9.8611745834350586}, {"x": -0.14836029708385468, "y": -0.61497735977172852, "z": 9.8539953231811523}]}, "Uri": "174430000143/Meas/Acc/52", "Method": "PUT"}
01-26 15:13:08.671 10469-10469/com.Activity: subscription onNotification(): {"Body": {"Timestamp": 273, "ArrayAcc": [{"x": -0.1411815732717514, "y": -0.6436922550201416, "z": 9.8683528900146484}, {"x": -0.13878867030143738, "y": -0.59583413600921631, "z": 9.7726364135742188}, {"x": -0.074180148541927338, "y": -0.65565681457519531, "z": 9.8276739120483398}, {"x": -0.14357449114322662, "y": -0.61258447170257568, "z": 9.8683528900146484}]}, "Uri": "174430000143/Meas/Acc/52", "Method": "PUT"}
01-26 15:13:08.731 10469-10469/com.Activity: subscription onNotification(): {"Body": {"Timestamp": 350, "ArrayAcc": [{"x": -0.12203831225633621, "y": -0.49772489070892334, "z": 9.8468170166015625}, {"x": -0.18664683401584625, "y": -0.55036884546279907, "z": 9.9664621353149414}, {"x": -0.25364825129508972, "y": -0.60540574789047241, "z": 9.7726364135742188}, {"x": -0.19861137866973877, "y": -0.60061991214752197, "z": 9.8348522186279297}]}, "Uri": "174430000143/Meas/Acc/52", "Method": "PUT"}

1 个答案:

答案 0 :(得分:1)

您将获得具有相同打包率但包大小不同的数据。一个探头用于13Hz,两个探头用于26Hz等。逻辑更复杂,但你总是应该检查你有多少探头。