While investigating a mid flight power down of my pixhawk driven hexa, Im hooked up via APM planner’s graph view and plugging in and un-plugging power sources to try to find what’s causing my problem.
In the graph view, several Power_Status flag number appears that I can’t find in this list: pixhawk.ethz.ch/mavlink/
(link won’t work on Safari 6.1.6 by some reason)
Attaching screen dumps.
Major is when flag values goes from 1 to 35, as appears to be without any obvious provocation in my attached picture. 34 is probably because I just then unplug the main power source and pixhawk jumps over to back up power via the servo rail.
Anyone know more about these numbers? Thanks!
And now another Power status flag: 3. Appears in the graph just after main and servo power’s been connected a few seconds apart starting with main
Sent using Tapatalk
The value you are looking at is defined as below,
typedef enum MAV_POWER_STATUS
MAV_POWER_STATUS_BRICK_VALID=1, /* main brick power supply valid | /
MAV_POWER_STATUS_SERVO_VALID=2, / main servo power supply valid for FMU | /
MAV_POWER_STATUS_USB_CONNECTED=4, / USB power is connected | /
MAV_POWER_STATUS_PERIPH_OVERCURRENT=8, / peripheral supply is in over-current state | /
MAV_POWER_STATUS_PERIPH_HIPOWER_OVERCURRENT=16, / hi-power peripheral supply is in over-current state | /
MAV_POWER_STATUS_CHANGED=32, / Power status has changed since boot | /
MAV_POWER_STATUS_ENUM_END=33, / | */
The values are ORed together, which in this case means just added-up.
BRICK refers to the power module (more specifically, the pixhawk dedicated power input, whatever the source).
3 (1 OR 2) means,
MAV_POWER_STATUS_BRICK_VALID and MAV_POWER_STATUS_SERVO_VALID
In your case anything other than this indicates you are having a fault. Without the VSERVO connection you would expect only 1.
34 (2 OR 32) means,
MAV_POWER_STATUS_SERVO_VALID and MAV_POWER_STATUS_CHANGED
Only VSERVO is present, and there have been changes in power status
35 (1 OR 2 OR 32) means,
MAV_POWER_STATUS_BRICK_VALID and MAV_POWER_STATUS_SERVO_VALID and MAV_POWER_STATUS_CHANGED
BRICK and VSERVO are currently, but at some point one of them was missing.
If you plug/unplug the USB port during your testing, you will flag MAV_POWER_STATUS_CHANGED without it actually being a problem. This will also add 4 to your value while the USB is connected.
Thanks! But i dont follow here…“Added up”? Shall I combine number to get new values. Now I got 33 in the graph for example…
Sent using Tapatalk
The different parameters are binary bit-fields, as follows,
bit = 1 is ‘set’, bit = 0 is ‘clear’
These are the binary equivalents of the flag values,
76543210 = bit order
00000001 = 1 (bit 0 set); MAV_POWER_STATUS_BRICK_VALID
00000010 = 2 (bit 1 set); MAV_POWER_STATUS_SERVO_VALID
00000100 = 4 (bit 2 set); MAV_POWER_STATUS_USB_CONNECTED
00001000 = 8 (bit 3 set); MAV_POWER_STATUS_PERIPH_OVERCURRENT
00010000 = 16 (bit 4 set); MAV_POWER_STATUS_PERIPH_HIPOWER_OVERCURRENT
00100000 = 32 (bit 5 set); MAV_POWER_STATUS_CHANGED
Now you can combine any of these together to indicate any or all of the flags being set at a particular time.
If you convert your number (33) to binary, you will get,
You see bit 0 and bit 5 are set, which correspond to MAV_POWER_STATUS_BRICK_VALID and MAV_POWER_STATUS_CHANGED. Which means your power module is active, and the power status has changed (something added /removed) since power on.
The key to understanding all of this is to realize there is only one possible way to add the values 1,2,4,8,16,32,64,128 to get any particular number between 0 and 255 (an 8 bit number); it might be helpful to read-up on binary numbers.
Aah! Rings a very very distant bell from uni. Think I got it, thanks a lot!!