HappyKillmore: do you have any plans to activate mAh reporting in HK-GCS?

I hope that I understand the situation correctly:

1) MAVlink protocol has a message type that includes a slot for reporting mAh remaining in battery.

2) HK-GCS does not utilize the mAh information, so the very nice widget for reporting battery status only responds to battery voltage and battery capacity does not change with time.

3) HK-GCS has a place (and widget) for showing battery amps, but MAVlink does not have a message type with a slot for that data, so HK_GCS has to show battery current as constantly zero. This is not the fault of HHK-GCS; it's not being supplied with relevant data. Hopefully a future MAVlink protocol update will at least provide battery current data in a message so that it can be displayed by ground stations.

I found these things out (courtesy in large part to Doug Weibel) when I added a current sensor to APM 2.12 and found that no ground station is able to report battery capacity remaining or battery current. Only APM terminal shows battery current and capacity.

At the moment, I'm thinking of adding a work-around by modifying the APM 2.12 code so that I can select (via an RC channel value) whether the battery_voltage variable is filled with actual battery voltage or battery current or mAh before it is sent to HK-GCS. A kludgy way to multiplex that data, but it will probably suit my usage well enough.

Views: 45

Reply to This

Replies to This Discussion

Yes, I do plan on addressing this. I was waiting for some decision from the MAVlink team on our proposal of additional fields in a message....but I don't believe they have responded. Right now, there is no field for current (amps) in the MAVlink protocol... You wouldn't believe the number of posts and complaints having to do with battery capacity. I know it's important. I just didn't know it was this important. You don't need to do a work around. I'll fix way I'm handling the message. When I originally wrote tha parsing routine, APM wasn't passing anything having to do with battery capacity or voltage.

 

I've been swamped with other projects recently and haven't had time to work on my GCS....

I agree that there is no MAVlink field for current, but the "battery remaining" field is working for me in APM 2.12 and seems to be  reported properly in HK GCS 1.2.96.  "Battery remaining" is transferred as a percentage of the capacity entered in APM (i.e. if you have used 200 mAh and the capacity was set to 2000mAh it will return 90%.) The HK GCS mAh counter then scales the value you have entered on the settings/instruments page by the percentage parameter. I see the bar and numerical value coming down as I use more of the battery.

In 2.11 there was a problem with the scaling in mavlink_common.h that meant that the parameter was too low by a factor of 100, so it was always reporting back less than 1% remaining, but this was corrected in 2.12

That's very interesting. I am running HK-GCS 1.2.98. Maybe that's the difference.
I actually haven't soldered in the reistors on mine...so that's another reason I haven't tested. I think Doug's got code working for AttoPilot's sensor....so I might be able to use that instead as I have one of their sensors here on my desk....but I should probably try to make it work with just the APM as well. I'll try to get this stuff working tomorrow.

I downloaded HK-GCS 1.2.96 (deprecated) and installed it.

 

I still get battery voltage reported correctly by HK-GCS, but the mAh does not change.

 

When I look at the parsed serial data, the only place that battery data appears is in waypoint data.  There I see...

 

WP#0,Dist=0,Battery=11.12,Mode=,Throttle=0.2

 

1.2.96 and 1.2.98 are the same.

 

But you and Simon report that mAh does work.  So what am I missing?   I do have battery mode set to 4 and APM Terminal gives good numbers when I run  test] current

 

?? 

I updated to 1.2.98 and it still works for me. I am also using mode 4 for the monitoring. Have you checked that it reads back as 4 and that BATT_CAPACITY reads back as something reasonable? (default is 1750, although I set mine to 2500)

Do you see the mAh value counting up in the APM terminal current test?

I don't see any values in the HK GCS serial monitor that look related to the battery apart from the voltage you describe above, but the widget is still responding.
mode does read back as 4
BATT_CAPACITY is default at 1750 (I have a 1500 battery, so I haven't made the change yet.)

mAh value is counting up in the terminal current test.

And !! in HK-GCS, mAh is changing, but very very slowly.

I have looked at Mavlink_Common.h and I see that both battery_voltage and percentage of remaining capacity are being multiplied by 1000 before being stored in a uint16. That all seems very reasonable.

I am drawing very little current, just what is needed to run the APM+IMU.

I suspect that the serial monitor display is not necessarily a strict parsing of a MAVlink packet. I say that because mAh is working for you and Simon and "something" is happening for me as well.

I'm going to look closer at my current sensor.

I have confirmed that both 1.2.96 and 1.2.98 DO report declining mAh values.

 

I had a zero-offset constant that was a little off and caused the current sensor calculation to report very small ma drain --- too small to see unless I waited several minutes.  When I correct that value and put a larger load on the battery, all works as expected.

 

It's still a mystery as to why the serial data display of HK_GCS doesn't show a capacity being read, but I'm going to leave that up to HappyKillmore.

 

Thanks for the prodding.

Please download 1.2.100 and let me know how it goes.

 

Please also note that you might need to go into File, Settings, Instruments and verify your max capacity is set correctly as well as your voltage limits. I've been changing my regional settings a lot and have found sometimes it looses my decimal place and 12.5V becomes 125V.... Let me know what you find so I can fix it for everyone. I'll also look into using the parameter value from APM as the max mAh value and post another update.

1) No problem found with either mAh or voltage settings.  I changed them from my previous settings, just as a test, and there were no decimal place errors.

 

2) Since the max mAh parameter has to match in APM and HK-GCS, it makes sense to automate that matching.  Then the user only has to set the APM parameter.  Nice.

 

3) I am happily using HK_GCS during my initial testing of APM.  I've not launched an aircraft (EasyStar) yet --- still getting things mounted.

 

4) I did kludge up a way to return amps from APM/MAVlink for display by HK-GCS.  I co-opted HDOP.  That's working well for me.

 

5) The serial data display now shows capacity and amps (which will remain equal to zero until there is a change to a MAVlink message I assume.)

 

6) I discovered the "donate" button on your site and tested it.  That seems to work too.

 

Thanks

Thanks Bob! So at this point things are working correctly with the exception of current (amps) in the default MAVlink protocol? Doug is ready to add it, he just needs the OK from the PIXHAWK guys about which message it's going in.... I went ahead and did #2 in your last post. I think 1.2.101 has it.

RSS

Social Networking

Contests

Season Two of the Trust Time Trial (T3) Contest has now begun. The fourth round is an accuracy round for multicopters, which requires contestants to fly a cube. The deadline is April 14th.

A list of all T3 contests is here

Groups

Advertisement

© 2013   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service