Is there a way to get the accelerometer and gyroscope sensor data from all three axises (xyz)? Using the code below, I consistently log the "LOG: Gyroscope: 5.0000" or "LOG: Gyroscope: 6.0000". The same result occurs for the accelerometer. Why is it outputting only one value instead of three for each of the axises? Also, why are the values exactly 5 and 6 consistently? Shouldn't there be much more variation?
//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);
}];
Hi I've looked into this issue some more. The values you are logging are overall states of the IMU and the Gyro that are declared in an enum hence why you aren't getting a constant state of values you are looking for. It appears to be a bug on our end that this data isn't available.