加速度计和陀螺仪多值 - DJI iOS UXSDKDemo
Accelerometer and Gyroscope Multiple Values - DJI iOS UXSDKDemo
有没有办法从所有三个轴 (xyz) 获取加速度计和陀螺仪传感器数据?使用下面的代码,我始终记录 "LOG: Gyroscope: 5.0000" 或 "LOG: Gyroscope: 6.0000"。加速度计也会出现相同的结果。为什么每个轴只输出一个值而不是三个值?另外,为什么值始终恰好是 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);
}];
您好,我已经进一步研究了这个问题。您正在记录的值是在枚举中声明的 IMU 和陀螺仪的总体状态,因此您没有获得正在寻找的值的恒定状态。该数据不可用似乎是我们这边的一个错误。
有没有办法从所有三个轴 (xyz) 获取加速度计和陀螺仪传感器数据?使用下面的代码,我始终记录 "LOG: Gyroscope: 5.0000" 或 "LOG: Gyroscope: 6.0000"。加速度计也会出现相同的结果。为什么每个轴只输出一个值而不是三个值?另外,为什么值始终恰好是 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);
}];
您好,我已经进一步研究了这个问题。您正在记录的值是在枚举中声明的 IMU 和陀螺仪的总体状态,因此您没有获得正在寻找的值的恒定状态。该数据不可用似乎是我们这边的一个错误。