mavlink/MAVSDK-Swift

Mavlink crashes after trying to call «Arm» command

Harvester-76 opened this issue · 6 comments

When I call drone.arm() it completes with an error. After command completion in my «onError» callback I have the next error

Снимок экрана 2021-03-18 в 17 55 26

«The operation couldn’t be completed. (MAVSDK_Swift.Action.ActionError error 1.)»

After that my application crashes in another thread in binary file (90% that it happens somewhere inside SDK) so that I can’t even understand where exactly it happens. I suppose that there might be some problem in Mavlink communication with the drone but I need to understand what exactly happens and what seems to be wrong for SDK to work correctly.

Снимок экрана 2021-03-18 в 17 54 38

@douglaswsilva @byuarus: Would you happen to have an opinion on that? Does it look like a crash indeed, or is it because the error is not handled properly? Just to be sure 😊.

@JonasVautherin I haven't seen the crash in drone.arm() action but I saw very similar crashes in other places during connection and initial subscription on telemetry while testing H520.
I'll add more info when I'll find repo steps in mavsdk-swift-example app.

@JonasVautherin Could you please tell what does "The operation couldn’t be completed. (MAVSDK_Swift.Action.ActionError error 1" error mean? Does this error correspond to MAV_RESULT_FAILED or MAV_RESULT_DENIED?

I think your log says MAVSDK_Swift.Action.ActionResult.Result.unknown. I would think it is sent from here, so somehow send_command_async() fails with an "unknown" code...

Is it a PX4 drone?

Is it a PX4 drone?

It's not but it uses mavlink for communication.

Firmware developer says:
For 'arm' command the drone returns https://mavlink.io/en/messages/common.html#MAV_RESULT
either MAV_RESULT_ACCEPTED or MAV_RESULT_FAILED or MAV_RESULT_DENIED.

Can either of this values lead to the error?

I am sorry, at this point I think you'll have to go debug what's happening in C++. I only use PX4 myself, and in your case I don't even know what autopilot you are using.

One thing you can do is try your code against PX4 SITL and check that it works 👍.