soldierman / happykillmore-gcs

Automatically exported from code.google.com/p/happykillmore-gcs
Other
0 stars 0 forks source link

APM current sensor data battery remaining in micro Ah #22

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I have the atto pilot current sensor attached to my APM. To read a "good 
Battery remaining" I have to enter 220000 for a 2200mAh batt in the settings.

There might be a *100 missing.

Current reads alway 0.

HK, Thanks for your super GCS.

Original issue reported on code.google.com by christof...@aaa-immobilien.ch on 12 May 2011 at 1:47

GoogleCodeExporter commented 9 years ago
I am running v1.2.96 and the Battery & Throttle instrument shows a constant 
10.8 volts and the amps and mAh never register any value.  I was able to get 
the Throttle to register from 0% to 100% by adjusting the transmitter's 
throttle servo offset.

Great Application.

Allen (HUMVEE)

Original comment by allenbis...@comcast.net on 16 May 2011 at 3:42

GoogleCodeExporter commented 9 years ago
The current value does not exist in the MAVlink protocol. We have asked Lorenz 
to add it, but it's not there yet. Battery life is something I need to fix

Original comment by paulbmather@gmail.com on 16 May 2011 at 3:45

GoogleCodeExporter commented 9 years ago
i am using GCS v1.2.98. I am using APM2.1 with attopilot current and voltage 
sensor. In the APM CLI setup i have chosen "battery 4". I am getting the 
correct voltage but in the GCS the current is still not active. shows zero. how 
should i get the current activated.

Original comment by nova...@yahoo.com on 22 May 2011 at 2:00

GoogleCodeExporter commented 9 years ago
Currect does not exist in MAVlink. You'll have to wait for them to add it.

Original comment by paulbmather@gmail.com on 30 May 2011 at 2:48

GoogleCodeExporter commented 9 years ago
to get the actual voltage. put the battery total voltage (from the last wire of 
the lipo balancer)+ve on the An0 pin and in CLI setup set "battery 4". then use 
a divide ratio in the APM_cinfig.h to get the correct voltage in CLI. Divide 
ration is a around 5.0 but is more off a hit and trial since the the battery 
graph is linear between the Vmax and Vmin of a lipo. by trying different divide 
ratio one would get fairly accurate voltage upto third places after decimal. 

Original comment by nova...@yahoo.com on 31 May 2011 at 3:25

GoogleCodeExporter commented 9 years ago
Hi Paul,

What message do you listen to for Battery Current ?
uint16_t __mavlink_sys_status_t::battery_remaining ?

best regards,

Oliver.

Original comment by fueck...@gmail.com on 31 May 2011 at 10:37

GoogleCodeExporter commented 9 years ago
I found the missing bits in the ACM code and have raised a Defect request to 
get it fixed. Works fine for me now.

Here the patch:

Index: ArduCopterMega/Mavlink_Common.h
===================================================================
--- ArduCopterMega/Mavlink_Common.h (revision 2450)
+++ ArduCopterMega/Mavlink_Common.h (working copy)
@@ -70,9 +70,8 @@
            }

            uint8_t status      = MAV_STATE_ACTIVE;
-           uint16_t battery_remaining = 10.0 * (float)(g.pack_capacity - 
current_total)/g.pack_capacity; //Mavlink scaling 100% = 1000
+           uint16_t battery_remaining = 1000.0 * (float)(g.pack_capacity - 
current_total)/g.pack_capacity; //Mavlink scaling 100% = 1000
            uint8_t motor_block = false;
-
            mavlink_msg_sys_status_send(
                    chan,
                    mode,
@@ -80,7 +79,7 @@
                    status,
                    load * 1000,
                    battery_voltage * 1000,
-                   motor_block,
+                   battery_remaining,
                    packet_drops);
            break;
        }

Original comment by fueck...@gmail.com on 1 Jun 2011 at 1:20