wiseman / mavelous

multi-platform ground station for drones that speak the MAVLink protocol
MIT License
167 stars 85 forks source link

Battery indicator seems broken on Arducopter 2.8.1 #50

Open dccourt opened 11 years ago

dccourt commented 11 years ago

I'm not sure which parameter the battery status indication is being read from, but for me it always says "-102%" in mavelous.

In QGroundControl and MissionPlanner, I see the correct voltage reading being displayed.

I'm running Arducopter 2.8.1 on APM 2.5.

pchickey commented 11 years ago

Can you please provide the value of the SYS_STATUS packet in mavproxy (prints at the prompt with > status SYS_STATUS) while the indicator shows this error?

dccourt commented 11 years ago

Will do. While code reading it looked like there might be some interaction with avionics battery vs main battery - anyway, now I know how to dump the packets, I'll take a look at both the relevant ones.

dccourt commented 11 years ago

I struggled to get the prompt working with mav_proxy (not sure why) but anyway, I was able to grab the relevant data from status.txt:

101: SYS_STATUS {onboard_control_sensors_present : 4294966319, onboard_control_sensors_enabled : 4294945839, onboard_control_sensors_health : 4294966319, load : 0, voltage_battery : 11165, current_battery : -1, battery_remaining : -106, drop_rate_comm : 0, errors_comm : 0, errors_count1 : 0, errors_count2 : 0, errors_count3 : 0, errors_count4 : 0}

This corresponds to a battery indicator in mavelous of -106 - i.e. it seems to be taken directly from the battery_remaining param.

dccourt commented 11 years ago

This is an APM2.5 with a homemade voltage divider supplying the battery voltage metrics, and no current sensor (current sensor is disabled in arducopter config parameters). My guess is that this means that the arducopter firmware can't calculate battery_remaining properly.

My suggestion is that we change the code in mavelous to look at current_battery. If it's == -1, then display voltage_battery / 1000 for the battery status, otherwise behave as before.

Ideally we'd also allow for configuration of a low-battery threshold, and have colour-coding of the icon based on that - especially since the battery status number doesn't seem to be displayable on small-screen devices such as phones. I'm not sure what the right UI design for that is - perhaps have preset thresholds for the colours based on a drop-down preference setting of the number of cells? Or, for simplicity, just a pair of voltage thresholds, for the red and yellow colours. (Alternatively, a pop-up indicator on the battery icon that displays battery status, as per GPS, would be a good start).

If you guys let me know what you think for the design, I'd be happy to draft up and test a patch.

pchickey commented 11 years ago

Thanks for tracking down this behavior, we hadn't accounted for users who have just a voltage sensor. I've only tested with my 3DR power board, which has voltage and current.

Yes, I agree a configurable low battery threshold is a great idea. You can probably add a popover like the GPS has fairly easily now that I've refactored that code. We could look into a better UI for low voltage alarms, maybe via a dismissable alert that appears below the navbar or at the bottom of the screen.

I'd be happy to code review and accept a patch to add any of this functionality.

Pat

On Mon, Mar 11, 2013 at 2:38 PM, David Court notifications@github.comwrote:

This is an APM2.5 with a homemade voltage divider supplying the battery voltage metrics, and no current sensor (current sensor is disabled in arducopter config parameters). My guess is that this means that the arducopter firmware can't calculate battery_remaining properly.

My suggestion is that we change the code in mavelous to look at current_battery. If it's == -1, then display voltage_battery / 1000 for the battery status, otherwise behave as before.

Ideally we'd also allow for configuration of a low-battery threshold, and have colour-coding of the icon based on that - especially since the battery status number doesn't seem to be displayable on small-screen devices such as phones. I'm not sure what the right UI design for that is - perhaps have preset thresholds for the colours based on a drop-down preference setting of the number of cells? Or, for simplicity, just a pair of voltage thresholds, for the red and yellow colours. (Alternatively, a pop-up indicator on the battery icon that displays battery status, as per GPS, would be a good start).

If you guys let me know what you think for the design, I'd be happy to draft up and test a patch.

— Reply to this email directly or view it on GitHubhttps://github.com/wiseman/mavelous/issues/50#issuecomment-14744505 .