We are using a pixhawk cube with PX4 1.8.2.
Also we have a companion computer that connected through UART to the pixhawk.
Using mavros we do all communication.
Our algorithm of the end of landing:
we sent the velocity vector to the copter using /mavros/setpoint_raw/local
after copter reached a desired point we sent MAV_CMD_COMPONENT_ARM_DISARM
we continue to send the velocity setpoints
we are waiting on the /mavros/state topic to get armed: False state
after we get disarmed copter we stop to send velocity setpoints
And usually all goes well, but sometime we get Failsafe enabled: no offboard.
It’s ok, but failsafe is configured to return to home and copter try to rich 20m height inside landing box. So, it can easily lead to crash.
Our short investigation shown, that PX4 processed the command MAV_CMD_COMPONENT_ARM_DISARM and told to mavros that copter is disarmed. But it looks like here is some race conditions, and some parts of PX4 still think that copter is armed.
Reading the docs, it sounds like you’ll get this warning if you stop sending setpoints while you’re still in offboard mode. Any reason not to land in LAND mode/are you sure you’re out of offboard mode before you stop sending setpoints?
Thanks for your answer!
Yes, you are right and copter still in OFFBOARD mode, but it’s reported disarm.
In my opinion, if copter is sending “disarmed” state, so it shouldn’t do any other things, like triggering failsafe, should it?
The reason is we are doing very precise landing, so we need to do it using setpoint and offboard mode.
Probably not - but I’m not an expert. But assuming that in the first instance you just want a solution so you can keep on working … I’d try setting the mode to HOLD or similar before stopping offboard mode. An alternative is to try set https://docs.px4.io/en/advanced_config/parameter_reference.html#COM_OBL_RC_ACT to LAND - so if there is a timeout the vehicle won’t failsafe to RTL behaviour.
@JulianOes Can you answer these questions, or suggest someone else?
Should failsafes be disabled when landed and disarmed? Specifically I would expect the offboard mode to not trigger an RTL failsafe in this case.
Is there a preferred mode to switch offboard mode out of when landed in order to put it into an “idle” state?
Yes, that is the solution, but it sounds like a bit dirty workaround. Failsafe is not a right way to work. =)
So, I’ll wait for the answers from @JulianOes and I think, for this moment, waiting for the changes of flight mode from OFFBOARD will be a good solution.
Thanks you a lot!
How are you checking that the copter actually disarmed? Are you checking the mavros_msgs::CommandBool::Response &res in:
From my quick look at the MAVROS code it looks like it usually waits for an ack and only then would report it to be a success.
From the log I can see that PX4 never realized that it was landed. Therefore the question is, did it ever actually disarm? From the PX4 logs I would argue no, it never disarmed.
I checked the commander code and code not immediately see a reason why it would not have disarmed though, it should even disarm if not landed.
(I know it’s scary. It’s something I want to look into this summer!)
I would probably wait until the vehicle reports to be “landed” and only then send the disarm command. Or better yet you could use auto-disarm using Parameter Reference · PX4 Developer Guide.
They should be but, as said, according to the log it was not landed or disarmed yet.
Not that I know off but if really landed it should not happen.
I also can add, that one of the last messages in our ROS-logs is the log from mavros: FCU: DISARMED by arm/disarm component command. And I’m not sure, but it seems, that PX4 has processed MAV_CMD_COMPONENT_ARM_DISARM, but it didn’t done a disarm completely.
With a first glance, I’ve not found any evidences, that here is no race conditions. Sorry for my insistence, but could you explain me, where is the grantees in the code, that disarming and failsafe can’t happens simultaneously?
I’m looking at the commander source of 1.8.2 and I can’t see how a new armed status would be acked but not published immediately to the rest of the system.
Oh, yes, I’ve wrote the code that can easily reproduce the situation, when a failsafe is enabled even if a copter reported a disarm.
It’s happens every time, if you stop sending the setpoints, but do not change a flight mode from OFFBOARD.
In this case, event if internally vehicle_status.armed_state != ARMED, firmware will trigger the failsafe.
If you have a code, that can flight by setpoints in offboard mode, just do this:
Takeoff by setpoint
Send ARM_DISARM to disarm copter
Wait for state.armed = false from /mavros/state topic.
Stop sending setpoins
And see the result.
I think, it relates to my previous replay.
Hope it’ll help @JulianOes
Thanks!
Thanks for the digging, you’re correct that it can still go into failsafe and that’s probably wrong or not always desired and we should fix it, however, I still can’t see how it would arm again …
Dear all: The similar issue “Failsafe enabled: no offboard” happens during my precise landing.
My hardware is Jetson TX1 and Pixhawk PX4_FMU_V5.
The Software Version is v1.13.3.
The “Failsafe enabled: no offboard” makes my drone unexpectedly switch from offboard mode to AUTO.LAND mode during the precise landing mission.