mavlink / MAVSDK-Swift

MAVSDK client for Swift.
https://mavsdk.mavlink.io
BSD 3-Clause "New" or "Revised" License
27 stars 25 forks source link

Mavlink crashes after trying to call «Arm» command #191

Open Harvester-76 opened 3 years ago

Harvester-76 commented 3 years ago

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
JonasVautherin commented 3 years ago

@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 :blush:.

byuarus commented 3 years ago

@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.

viona31 commented 3 years ago

@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?

JonasVautherin commented 3 years ago

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?

viona31 commented 3 years ago

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?

JonasVautherin commented 3 years ago

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 :+1:.