0

3 つの軸 (xyz) すべてから加速度計とジャイロスコープのセンサー データを取得する方法はありますか? 以下のコードを使用して、一貫して「LOG: Gyroscope: 5.0000」または「LOG: Gyroscope: 6.0000」を記録します。加速度計についても同じ結果が得られます。軸ごとに 3 つではなく 1 つの値しか出力しないのはなぜですか? また、値が一貫して正確に 5 と 6 なのはなぜですか? もっとバリエーションがあってもいいじゃないですか。

//GYROSCOPE
    DJIFlightControllerKey *IMUStateGyroscopeStateForLog = [DJIFlightControllerKey keyWithParam:DJIFlightControllerParamIMUStateGyroscopeState];

// Will get called once to get current value of the key
[[DJISDKManager keyManager] getValueForKey:IMUStateGyroscopeStateForLog withCompletion:^(DJIKeyedValue * _Nullable value, NSError * _Nullable error) {
    }];

// Called only when the value for the key changes
[[DJISDKManager keyManager] startListeningForChangesOnKey:IMUStateGyroscopeStateForLog withListener:self andUpdateBlock:^(DJIKeyedValue * _Nullable oldValue, DJIKeyedValue * _Nullable newValue) {
    NSLog(@"LOG: Gyroscope: %f", newValue.doubleValue);
    }];




//ACCELEROMETER
DJIFlightControllerKey *IMUStateAccelerometerStateForLog = [DJIFlightControllerKey keyWithParam:DJIFlightControllerParamIMUAccelerometerState];

// Will get called once to get current value of the key
[[DJISDKManager keyManager] getValueForKey:IMUStateAccelerometerStateForLog withCompletion:^(DJIKeyedValue * _Nullable value, NSError * _Nullable error) {
    }];

// Called only when the value for the key changes
[[DJISDKManager keyManager] startListeningForChangesOnKey:IMUStateAccelerometerStateForLog withListener:self andUpdateBlock:^(DJIKeyedValue * _Nullable oldValue, DJIKeyedValue * _Nullable newValue) {
    NSLog(@"LOG: Accelerometer: %f", newValue.doubleValue);
    }];
4

1 に答える 1