Hello.
I am trying to get 2 informations from my autopilot via companion computer.
- message :If the autopilot is “starting” / “calibrating” / “has som error”/ “is airborne”
- message :If the autopilot is “armed”
This is my function:
m_s = mavlink_msg_heartbeat_get_system_status(msg);
base_mode = mavlink_msg_heartbeat_get_base_mode(msg);
armed = MAV_MODE_FLAG_SAFETY_ARMED & base_mode;
I can reliably read MAV_MODE_FLAG on bit 128 with value of 1 (armed) or 0 (disarmed)
However i have problem reading system_status.
I thought that during startup it should have values of 0/1/2
When ready to Arm it should have value of 3
And when airborne the value should be 4
However while booting, the value is 4 and than after some time it changes to 3 in both armed and disarmed state.
Can you please tell me what am i missing?
Is there a different parameter, which contains this informations?
Autopilot is Cube Black (AC 4.0.3)
I have an update on this topic.
I decided that only message appart from arm state i need is if the autopilot is / is not armable (if it passed prearm checks).
I have found out that in mavlink its message: MAV_SYS_STATUS_PREARM_CHECK which should be part of sys_status message. Yet in arducopter it is not.
So my question is : Is it possible to read if the autopilot is / is not armable using some of the messages that arducopter provides?
I would use the ARMING_CHECK (?) param to enable appropriate bits then you should be able to check for them at runtime.
I have a PR that fixes that. I hope it will get merged soon.
1 Like
Nice one. I have a pull request in myself. I put it in last week so am hoping it doesn’t take too long to get accepted. It’s my first PR.
I really hope thay fix that.
Right now i am using EKF_STATUS_FLAGS. I read all of the bits, and when in total they are equal to 831 or 895 i consider it “armable”. The problem is, it doesn´t reflect all the possible prearm check fails.
So i hope that they will soon integrate to arducopter true “prearm status”.
1 Like