Owne / ardupilot-mega

Automatically exported from code.google.com/p/ardupilot-mega
0 stars 0 forks source link

Incomplete implementation of current sensor? #304

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.Use APM 2.0 (&2.01) Beta
2.Setup Current sensing via CLI
3.COnntect to HK GCS via Xbee

What is the expected output? What do you see instead?

The CLI tests appear to produce the expected output.
The voltage reported by GCS is fixed at 10.8V, no indication of current being 
consumed and remaining capacity of battery.

What version of the product are you using? On what operating system?
As above..

Please provide any additional information below.
I seem to remember that 2.0 beta showed the correct capacity of the battery in 
the GCS but no current consumption information, though this does not happen in 
2.01. I'm not sure if this issue is as a result of HKGCS or APM but reviewing 
the code for APM I cannot see a mechanism to allow the appropriate variables to 
be sent via Mavlink unless I am missing something fundamental.

Furthermore the current sensor still need to be tied into the fail-safe 
mechanism for low battery I believe.

Original issue reported on code.google.com by petebir...@gmail.com on 28 Mar 2011 at 2:05

GoogleCodeExporter commented 8 years ago
I can confirm this problem. The reason is that the function read_current(); is 
not being called in the medium_loop. After commenting the "if 
(g.current_enabled)" statement in "ArduPilotMega.pde" file, the values in the 
log seem to be alright.

Original comment by el_andre...@hotmail.com on 28 Mar 2011 at 8:16

GoogleCodeExporter commented 8 years ago
The sensor is disabled by default in Paramters.h:
[...]
current_enabled (DISABLED,  k_param_current,    PSTR("CURRENT_ENABLE")),
[...]

Best way would be to use a define in config.h such as:

#ifndef CURRENT_SENSOR
#define CURRENT_SENSOR DISABLED
#endif

In Parameters.h use:

[...]
current_enabled (CURRENT_SENSOR,k_param_current,PSTR("CURRENT_ENABLE")),
[...]

And the user configures the sensor in APM-Config.h by defining:
#define CURRENT_SENSOR ENABLED

All current logging code, including the variable definition, could be enclosed 
in

#if CURRENT_SENSOR == ENABLED
do sume CURRENT stuff....
#endif

This would reduce code size for the people that do not want a current sensor at 
all.

Original comment by el_andre...@hotmail.com on 29 Mar 2011 at 7:02

GoogleCodeExporter commented 8 years ago
Guys, the current sensor implementation IS incomplete.  There are bits of it 
copied over from ACM, but I do not have a current sensor so have not tried to 
get it complete yet.  I consider it an unsupported feature for 2.0.

That said, it will get done some day ;)

Original comment by dewei...@gmail.com on 2 Apr 2011 at 1:31

GoogleCodeExporter commented 8 years ago
I have a spare current sensor and can mail it to you if that would help - 
please contact me at giantkillerrobot-at-gmail.com

Original comment by giantkil...@gmail.com on 3 Apr 2011 at 4:38

GoogleCodeExporter commented 8 years ago
I have made significant changes and corrections here.  Please read the comment 
for issue 294 carefully as you will need to change a bit of configuration.  
Should be good to go, although I have not tested it yet.

GKR - got the sensor.  The SparkFun AVC is this Saturday, and that has my full 
attention for another 72 hours or so, then I will test this with hardware.  
Many thanks...

Original comment by dewei...@gmail.com on 21 Apr 2011 at 3:53

GoogleCodeExporter commented 8 years ago
Sorry, I meant issue 298.

Original comment by dewei...@gmail.com on 21 Apr 2011 at 3:54