Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I test for IMU and compass errors? #27

Open
masayuki-kobayashi1 opened this issue Sep 27, 2023 · 5 comments
Open

How do I test for IMU and compass errors? #27

masayuki-kobayashi1 opened this issue Sep 27, 2023 · 5 comments

Comments

@masayuki-kobayashi1
Copy link

masayuki-kobayashi1 commented Sep 27, 2023

We would like to use the SDK to determine if the IMU and Compass are normal or abnormal.
Normal conditions could be tested.
However, I do not know how an abnormal condition can be intentionally caused to the hardware and test them.
Thank you.

@AutelSDK
Copy link
Owner

AutelSDK commented Oct 9, 2023

private Evo2FlyController flyController;
public void startCalibrationIMU(CallbackWithTwoParams<CalibrateIMUStep, CalibrateIMUStatus> callback) {
flyController.startCalibrationIMU(callback);
}

@AutelSDK
Copy link
Owner

AutelSDK commented Oct 9, 2023

now way to mock abnormal condition caused to the hardware

@AutelSDK
Copy link
Owner

AutelSDK commented Oct 9, 2023

FlyControllerManager2.getInstance().startImuCalibration(new CallbackWithOneParam() {
@OverRide
public void onSuccess(CommandInfoInternal data) {
if (data.isSuccess()) {
FlyControllerManager2.getInstance().addIMUCalibrationStateListener(TAG, new CallbackWithOneParam() {
@OverRide
public void onSuccess(ImuCalibrationStateInfo data) {
if (null != callback) {
AutelLog.d("CommonCmdRequest", "startCalibrationIMU : " + data.getStep() + " status:" + data.getStatus());
callback.onSuccess(CalibrateIMUStep.find(data.getStep()), CalibrateIMUStatus.find(data.getStatus()));
}
}

                        @Override
                        public void onFailure(AutelError error) {

                        }
                    });
                } else {
                    if (null != callback)
                        callback.onFailure(AutelError.COMMAND_FAILED);
                }
            }

            @Override
            public void onFailure(AutelError error) {
                if (null != callback)
                    callback.onFailure(error);
            }
        });

@masayuki-kobayashi1
Copy link
Author

How do I determine if there is an error or if calibration is needed?

Do I only need to check the following in order to fly?


isCompassOk = evoFlyControllerInfo.getFlyControllerStatus().isCompassValid();

isImuOk = evoFlyControllerInfo.getFlyControllerStatus().getArmErrorCode() != ARMWarning.IMU_LOSS
                && evoFlyControllerInfo.getFlyControllerStatus().getArmErrorCode() != ARMWarning.DISARM_IMU_LOSS;

@masayuki-kobayashi1
Copy link
Author

@AutelSDK
Any updates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants