Commit Graph

238 Commits

Author SHA1 Message Date
Leonard Hall d5e898156f AP_BattMonitor: allow using resting voltage for failsafe 2017-06-06 14:57:04 +09:00
Leonard Hall 8709fe58ec AP_BattMonitor: resistance learning 2017-06-06 14:57:04 +09:00
Randy Mackay f64777849f AP_BattMonitor: rename VOLT_TIMER to LOW_TIMER 2017-06-06 14:57:04 +09:00
Randy Mackay 989677ddfd AP_BattMonitor: move has_current to backend 2017-06-06 14:57:04 +09:00
Michael du Breuil f026438f22 AP_BattMonitor: Fetch remaining capacity 2017-05-30 20:28:12 +09:00
Francisco Ferreira 9c027713d1
AP_BattMonitor: update current/voltage parameter documentation
Remove information for old APM boards
Correct information for The Cube (Pixhawk 2.1) Power2 port
2017-05-19 01:19:23 +01:00
Dr.-Ing. Amilcar Do Carmo Lucas 25cfee9824 AP_BattMonitor: Use SI units conventions in parameter units
Follow the rules from:
http://physics.nist.gov/cuu/Units/units.html
http://physics.nist.gov/cuu/Units/outside.html
and
http://physics.nist.gov/cuu/Units/checklist.html
one further constrain is that only printable (7bit) ASCII characters are allowed
2017-05-17 18:07:25 +10:00
Andrew Tridgell d4e6720b01 AP_BattMonitor: added BATT_VOLT_TIMEO
this is useful for aircraft with very low C batteries, to prevent a low
voltage failsafe on takeoff. For long endurance aircraft low C batteries
are often used, and the voltage sags a lot on takeoff, but it fine for
the rest of the flight
2017-04-28 17:40:18 +10:00
Michael du Breuil 22ab8de4d2 AP_BattMonitor: SMBus: Fetch pack capacity 2017-04-28 00:36:10 +01:00
Michael du Breuil f919c409bb AP_BattMonitor: Remove redundant state copy
Every backend stored a instance reference, which wasn't used in most locations
which is redundant given that the state already tracks the instance for us as
well.
2017-04-28 00:36:10 +01:00
Michael du Breuil 3ab3face9b AP_BattMonitor: SMBus: Read serial number 2017-04-28 00:36:10 +01:00
Michael du Breuil e0d49e6d84 AP_BattMonitor: Use a unified SMBus temperature interface 2017-04-21 00:38:41 +01:00
Michael du Breuil 9c3b97347a AP_BattMonitor: Unify read_word interface 2017-04-21 00:38:41 +01:00
Michael du Breuil 3319c3ccdc AP_BattMonitor: Use a common PEC helper 2017-04-21 00:38:41 +01:00
Michael du Breuil a96772e46e AP_BattMonitor: get Solo battery voltage from sum of cell voltages
Minimizes the number of transactions on the bus, and reduces the amount of noise we have to consider
2017-04-19 14:17:24 +01:00
Michael du Breuil 8f24d211ce AP_BattMonitor: Solo add support for temperature and cells
Also fixs a buffer overflow when reading the ManufacturerData
2017-04-19 14:17:24 +01:00
Michael du Breuil 043b93d643 AP_BattMonitor: Maxell support temperature 2017-04-19 14:17:24 +01:00
Michael du Breuil de02bd52ed AP_BattMonitor: SMBus_Maxell request voltages 2017-04-19 14:17:24 +01:00
Michael du Breuil 121ebebfef AP_BattMonitor: Add temperature interface 2017-04-19 14:17:24 +01:00
Michael du Breuil e39ae6d48c AP_BattMonitor: Add cell monitoring 2017-04-19 14:17:24 +01:00
Pierre Kancir 9c587d8d67 AP_BattMonitor: fix warning in example 2017-04-13 19:56:16 +01:00
Andre Kjellstrup 94eabed583 AP_BattMonitor: update volt and curr pin param descriptions 2017-04-13 13:30:23 +09:00
Randy Mackay dcc4f69f7c AP_BattMonitor: confirm pec support before attempting to read voltage
Previously we checked PEC support continuously at 10hz.  With this change PEC support (or lack of support) is determined first before we try to read from the battery.  Once determined, we do not repeat the checks.
Also simplified logic to determine PEC support based on version (should have no functional effect)
Also renamed get_pec_support to check_pec_support
Also renamed _pec_confirm to _pec_confirmed
2017-03-30 10:34:45 +09:00
Randy Mackay 884892be16 AP_BattMonitor: const some temp variables
Also other minor changes in response to peer review
2017-03-30 10:34:45 +09:00
Tatsuya Yamaguchi 6b4a46d467 AP_BattMonitor: fix to use the return value of get_pec_support 2017-03-30 10:34:45 +09:00
Tatsuya Yamaguchi b052f96f6c AP_BattMonitor: check a PEC support using SpecificationInfo 2017-03-30 10:34:45 +09:00
Randy Mackay 8c7b214d71 AP_BattMonitor: fix param description 2017-02-15 20:01:59 +10:00
Randy Mackay ebb60e8d2f AP_BattMonitor: remove PX4 driver 2017-02-09 10:45:01 +09:00
Tatsuya Yamaguchi 3e445fd4b8 AP_BattMonitor: add Maxell Battery support 2017-02-09 10:45:00 +09:00
Tatsuya Yamaguchi d30350276c AP_BattMonitor: I2C driver becomes Solo driver
Rename class to Solo
Use internal I2C bus
Add capacity, current, button press checking
Only check continuously for voltage if reading fails for more than 5 seconds
2017-02-09 10:44:50 +09:00
Randy Mackay bad8910b93 AP_BattMonitor: example sketch uses Solo battery 2017-02-09 09:21:55 +09:00
Randy Mackay e4c99a22bc AP_BattMonitor: add override specifier to Bebop 2017-02-09 08:35:12 +09:00
murata f18b8844bf AP_BattMonitor: Unify from print or println to printf. 2017-01-27 18:20:22 +11:00
Lucas De Marchi 5472bc4de1 Global: change Device::PeriodicCb signature
Remove bool return as it's never being used and not supported on PX4.
2017-01-14 10:03:54 +11:00
Georgii Staroselskii e735a56c82 AP_BattMonitor: add default PM definitions for Navio boards
As it turns out we haven't had default PM defs for power modules
intended to be used with Navio boards.
2016-12-01 05:41:37 -08:00
Andrew Tridgell 4f231f9355 AP_BattMonitor: fixed thread usage for SMBus_I2C 2016-11-09 17:08:02 +11:00
murata c808ee2f49 Global: To nullptr from NULL.
RC_Channel: To nullptr from NULL.

AC_Fence: To nullptr from NULL.

AC_Avoidance: To nullptr from NULL.

AC_PrecLand: To nullptr from NULL.

DataFlash: To nullptr from NULL.

SITL: To nullptr from NULL.

GCS_MAVLink: To nullptr from NULL.

DataFlash: To nullptr from NULL.

AP_Compass: To nullptr from NULL.

Global: To nullptr from NULL.

Global: To nullptr from NULL.
2016-11-02 16:04:47 -02:00
Francisco Ferreira 3a89421c70 AP_BattMonitor: remove Bebop fixed capacity
Bebop, Bebop2 and Disco all use this class but it was always setting the capacity to the Bebop one, overriding the parameter
2016-10-24 09:24:11 -03:00
Mathieu OTHACEHE 152edf7189 Global: remove mode line from headers
Using a global .dir-locals.el file is a better alternative than
reincluding the same emacs header in every file of the project.
2016-10-24 09:42:01 -02:00
Lucas De Marchi ae53920e5b build: don't build examples with old build system
We currently check examples are buildable with waf which doesn't need
the libraries to be specified in a make.inc file.  Having the makefiles
there is misleading since people try to build and realize the build is
broken.
2016-10-11 13:03:08 +11:00
Andrew Tridgell 79ed5c7091 AP_BattMonitor: fixed typo 2016-09-21 17:37:32 +10:00
Andrew Tridgell 06cccd6d3b AP_BattMonitor: update disco battery lookup table 2016-09-21 13:48:53 +10:00
floaledm ec157bd4c2 AP_BattMonitor: Get pack_capacity_mah function 2016-08-25 10:16:18 +10:00
Andrew Tridgell d05a08ff4d AP_BattMonitor: auto-start batt_smbus driver if enabled 2016-08-10 19:54:00 +10:00
LukeMike b5cf0308cd VRBRAIN / AP_BattMonitor_Analog: definition of default value for battery monitor for all VirtualRobotix boards 2016-08-07 20:31:51 +10:00
Lucas De Marchi f36e8d9c05 AP_HAL_Linux: remove AP_HAL_Linux_Namespace header
This centralized namespace header encourages centralizing things on
umbrella headers that are a pain to maintain. Force each part of
AP_HAL_Linux to include what is used.

While at it, do some whitespace cleanups and minor changes to adhere to
coding style.
2016-07-29 20:25:03 -03:00
Tom Pittenger 5108b4cbb6 AP_BattMonitor: move vehicle dependant code to be c-file only, not header 2016-07-25 18:10:57 -07:00
Lucas De Marchi 64d17702e6 AP_BattMonitor: AP_BattMonitor_SMBus: fix after conversion to I2CDevice
- Fix bus number
    - Minor updates to coding style
2016-07-22 13:10:51 -03:00
Luiz Ywata 0cf4353382 AP_BattMonitor: AP_BattMonitor_SMBus: use I2CDevice interface 2016-07-22 13:10:51 -03:00
Andrew Tridgell 39dac57b56 AP_BattMonitor: support Disco battery monitoring 2016-07-20 13:38:17 +10:00
Tom Pittenger d2c9b02ca5 AP_BattMonitor: remove voltage2() since we have voltage(x) available 2016-06-02 16:59:26 -07:00
Tom Pittenger a1564bd337 AP_BattMonitor: check actual battery instances instead of max possible instances 2016-06-02 16:59:21 -07:00
Lucas De Marchi e448f161d2 AP_BattMonitor: remove support for flymaple 2016-05-23 21:49:45 -03:00
Ricardo de Almeida Gonzaga 5237c86bca AP_BattMonitor: Fix typos 2016-05-13 19:20:05 -03:00
Tom Pittenger 0e775f595d AP_BattMonitor: make param BATT_WATT_MAX plane only 2016-04-21 13:59:45 -07:00
Jonathan Challinger 06ccf88cc9 AP_BattMonitor_SMBus: set AP_Notify powering_off flag 2016-04-21 10:04:37 +10:00
Tom Pittenger 035f3b16a1 AP_BattMonitor: add new param BATT_WATT_MAX
Description: If battery wattage (voltage * current) exceeds this value then the system will reduce max throttle (THR_MAX and TKOFF_THR_MAX) to satisfy this limit. This helps limit high current to low C rated batteries regardless of battery voltage. The max throttle will slowly grow back to THR_MAX (or TKOFF_THR_MAX) if demanding the current max and under the watt max.
2016-03-02 10:14:25 -08:00
Lucas De Marchi 69f6a73c19 Global: fix missing renames for HAL_BOARD_SUBTYPE_LINUX_ERLEBOARD
Commit b87fd58 (AP_HAL: ERLEBOARD legacy support) renamed the define but
forgot some around.
2016-02-19 12:35:18 -02:00
Lucas De Marchi f865e085b1 AP_BattMonitor: add defaults for minlure 2016-02-19 11:55:31 -02:00
Lucas De Marchi 62f50aede7 AP_BattMonitor: replace header guard with pragma once 2016-02-18 14:52:34 -02:00
Peter Barker afafcbc4f3 AP_BattMonitor: correct names of #defines 2016-01-30 12:48:19 -02:00
mirkix b5cb48ba6d AP_BattMonitor: Add BBBMINI defaults 2016-01-28 13:44:44 -02:00
Gustavo Jose de Sousa c2e3f05dbf waf: ardupilotwaf: prefix build context methods with ap_
It helps to distinguish between things from waf and things from ardupilotwaf.
2016-01-22 20:10:29 -02:00
Gustavo Jose de Sousa 3d22490397 waf: examples: use methods from bld instead of ardupilotwaf 2016-01-22 20:10:29 -02:00
Gustavo Jose de Sousa d281067bcc waf: make example binaries be placed in 'examples' dir
This commit makes examples' wscripts use ardupilotwaf.example() instead of
ardupilot.program().
2016-01-15 16:46:41 -02:00
pkancir c117b41188 AP_BattMonitor: add PXF default pins 2016-01-11 15:44:24 -02:00
Jonathan Challinger 8fdbb36827 AP_BattMonitor: add is_powering_off 2016-01-07 15:14:07 +09:00
Jonathan Challinger a3789542cd AP_BattMonitor: fix example build 2015-12-29 10:46:35 -08:00
Lucas De Marchi a096703b06 Global: don't link with AP_Progmem
AP_Progmem is not used anymore.
2015-12-27 15:58:12 -02:00
Lucas De Marchi 0a1dbab24e AP_BattMonitor: remove unused AP_ADC_AnalogSource 2015-12-03 13:32:42 +11:00
Caio Marcelo de Oliveira Filho 6e7b73610d waf: add waf support 2015-12-03 07:54:30 +11:00
Andrew Tridgell 6dd45998f4 AP_BattMonitor: support FMUv4 2015-11-27 18:54:30 +11:00
Caio Marcelo de Oliveira Filho 3b4e18043b AP_BattMonitor: examples use millis/micros/panic functions 2015-11-20 12:29:52 +09:00
Caio Marcelo de Oliveira Filho 9eb945d24f AP_BattMonitor: use millis/micros/panic functions 2015-11-20 12:29:45 +09:00
Andrew Tridgell 8f4ce7f20b build: removed all nocore.inoflag files
these were APM2 specific
2015-11-16 08:05:17 +11:00
Lucas De Marchi 12c88570d7 AP_BattMonitor: remove checks for HAL_BOARD_APM2 and HAL_BOARD_APM1 2015-11-04 12:14:11 +11:00
Lucas De Marchi 831d8acca5 Remove use of PROGMEM
Now variables don't have to be declared with PROGMEM anymore, so remove
them. This was automated with:

    git grep -l -z PROGMEM | xargs -0 sed -i 's/ PROGMEM / /g'
    git grep -l -z PROGMEM | xargs -0 sed -i 's/PROGMEM//g'

The 2 commands were done so we don't leave behind spurious spaces.

AVR-specific places were not changed.
2015-10-30 14:35:16 +09:00
Lucas De Marchi d276029e35 AP_BattMonitor: fix class name after rename in AP_HAL_Linux 2015-10-21 10:11:19 +11:00
Caio Marcelo de Oliveira Filho 8e1e77007e AP_BattMonitor: remove unnecessary includes in example 2015-10-21 09:16:10 +11:00
Caio Marcelo de Oliveira Filho ec52df991c build: compile only the HAL files needed by the board
Instead of requiring every program to specify the HAL related modules,
let the build system do it (in practice everything we compiled depended
on HAL anyway). This allow including only the necessary files in the
compilation.
2015-10-21 09:16:07 +11:00
Caio Marcelo de Oliveira Filho 2e464a53c2 AP_HAL: make code not depend on concrete HAL implementations
The switching between different AP_HAL was happening by giving different
definitions of AP_HAL_BOARD_DRIVER, and the programs would use it to
instantiate.

A program or library code would have to explicitly include (and depend)
on the concrete implementation of the HAL, even when using it only via
interface.

The proposed change move this dependency to be link time. There is a
AP_HAL::get_HAL() function that is used by the client code. Each
implementation of HAL provides its own definition of this function,
returning the appropriate concrete instance.

Since this replaces the job of AP_HAL_BOARD_DRIVER, the definition was
removed.

The static variables for PX4 and VRBRAIN were named differently to avoid
shadowing the extern symbol 'hal'.
2015-10-21 09:16:07 +11:00
Lucas De Marchi 6c19f741df AP_BattMonitor: use method for downcast
Instead of just doing a static cast to the desired class, use a method
named "from". Pros:

  - When we have data shared on the parent class, the code is cleaner in
    child class when it needs to access this data. Almost all the data
    we use in AP_HAL benefits from this

  - There's a minimal type checking because now we are using a method
    that can only receive the type of the parent class
2015-09-23 09:01:29 +10:00
Randy Mackay bb891a62d3 BattMonitor: fix parameter descriptions 2015-08-26 11:17:48 +09:00
Gustavo Jose de Sousa ff20124f1d AP_BattMonitor: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-11 16:28:42 +10:00
Randy Mackay 42c7b4a116 BattMon_SMBus: remove unnecessary I2C semaphore give 2015-08-07 15:50:38 +09:00
Randy Mackay 3dfb447fd7 BattMon: has_current true for Bebop
The bebop does not actually provide current but it does estimate the
percentage of battery remaining
2015-07-23 21:49:32 +09:00
Randy Mackay 8403b504d1 BattMon: add Bebop to monitor param description 2015-07-23 21:49:32 +09:00
Randy Mackay 9482578c60 BattMon: Bebop always uses bebop batt monitor 2015-07-23 21:49:31 +09:00
Randy Mackay 84b6ab0707 BattMon_Bebop: use ARRAY_SIZE
Also remove printf of failure message, instead we should add the battery
monitor health to the SYS_STATUS message sent to the ground station
2015-07-23 21:49:30 +09:00
Randy Mackay 3b36178a0b BattMon_Bebop: init members in constructor 2015-07-23 21:49:29 +09:00
Jean-Baptiste Dubois 35ae562dbe AP_BattMonitor: Add battery support for Bebop Hardware 2015-07-23 21:49:27 +09:00
Przemek Lekston 90378b21da AP_BattMonitor: Fix battery monitor Floating Point Exception in SITL
Adds a sanity check to avoid division by zero when BATT_CAPACITY is set to 0.
2015-06-29 16:42:52 +10:00
mirkix a1d478909a AP_BattMonitor: Add Linux support for example 2015-06-18 09:00:01 +10:00
Andrew Tridgell debe7db861 AP_BattMonitor: convert example from .pde to .cpp 2015-06-01 16:58:11 +10:00
Randy Mackay 5560d3dba1 BattMonitor: fix example sketch 2015-05-12 21:34:24 +09:00
Andrew Tridgell 8055e5792d AP_BattMonitor: fix for HAL_SITL rename 2015-05-05 09:45:55 +10:00
Tom Pittenger dbc01e2f1a BattMon: fix compile warning re to unused variable 2015-04-24 14:18:36 +09:00
Tom Pittenger 0926cf17dd BattMon: fix compile warnings re float constants 2015-04-24 12:27:23 +09:00
Randy Mackay 56d2306a18 BattMon_SMBus_PX4: read capacity 2015-04-11 14:10:22 +09:00
Randy Mackay c6440a48b3 BattMon_Backend: add init and set_capacity methods 2015-04-11 14:10:19 +09:00
Randy Mackay c7dd6ae816 BattMon: SMBus becomes unhealthy after 5sec timeout
Also remove unused internal variable
2015-03-20 11:05:30 +09:00
Randy Mackay c44f304253 BattMon: analog monitor always healthy 2015-03-20 11:05:27 +09:00
Randy Mackay 1217ab9579 BattMon: add get_type method 2015-03-03 15:48:24 +09:00
Emile Castelnuovo 90663664f3 AP_BattMonitor: VRBRAIN deleted unused boards, corrected default batt volt divider. 2015-02-02 08:44:01 +11:00
Randy Mackay 5ba1b20d3b BattMon: add SMBus to MONITOR param description 2015-01-02 17:20:05 +09:00
Randy Mackay 022c549339 BattMon_SMBus_I2C: use get_PEC to check reads 2014-12-31 15:23:00 +09:00
Randy Mackay bf0e5a350c BattMon_SMBus_I2C: add get_PEC method 2014-12-31 15:22:59 +09:00
Randy Mackay 3951e4d99b BattMon: example sketch reads from SMBus 2014-12-31 15:22:58 +09:00
Randy Mackay aecc8aac1f BattMon: correct typo in monitor type enum 2014-12-31 15:22:57 +09:00
Randy Mackay 909d525206 BattMon: fix example sketch compile error 2014-12-31 15:22:51 +09:00
Randy Mackay 76a28a962c BattMon: remove #defines for monitor type 2014-12-31 15:22:47 +09:00
Randy Mackay f077ecd338 BattMon_PX4: class to read from PX4Firmware via orb 2014-12-31 15:22:46 +09:00
Randy Mackay 3f35dc54fe BattMon_I2C: smart battery class for APM 2014-12-31 15:22:45 +09:00
Randy Mackay 314db1403d BattMon_SMBus: smart battery monitor driver 2014-12-31 15:22:45 +09:00
Randy Mackay 4d7df9ed26 BattMon_Analog: move analog features to new class 2014-12-31 15:22:44 +09:00
Randy Mackay 39dbf05c8f BattMon_Backend: create backend class 2014-12-31 15:22:43 +09:00
Randy Mackay eec66d8451 BattMon: parent class becomes frontend class 2014-12-31 15:22:42 +09:00
Randy Mackay 45e0e48e54 BattMon: minor param description update 2014-10-14 12:42:45 +09:00
Andrew Tridgell 40709f655e AP_BattMonitor: fixed example build 2014-08-13 21:46:22 +10:00
Andrew Tridgell ab6302540d AP_BattMonitor: added 2nd battery voltage monitoring 2014-08-09 22:50:14 +10:00
Andrew Tridgell 93f2d81ff4 AP_BattMonitor: fixed example build 2014-07-25 17:54:19 +10:00
Emile Castelnuovo bdd9fe77c7 VRBRAIN: change default pin for analog input. 2014-07-01 12:23:25 +02:00
LukeMike 8f552d5758 VRBRAIN: Changed the management of VirtualRobotix's boards. 2014-06-19 11:27:38 +02:00
Kevin Hester 80cb13e222 BattMon: fixup line endings 2014-04-15 15:56:43 +09:00
Emile Castelnuovo 1d27e0d127 AP_BattMonitor: added #defines for VRBRAIN board 2014-04-08 16:19:19 +10:00
Andrew Tridgell dcb42af3e9 AP_BattMonitor: fixed example build 2014-04-03 07:49:06 +11:00
Randy Mackay d09fd0d035 BattMonitor: add @Increment to CAPACITY description 2013-10-29 11:23:27 +09:00
Andrew Tridgell f34b1c280d AP_BattMonitor: added set_monitoring() API
needed for test sketch
2013-10-23 09:40:42 +11:00
Randy Mackay 1a070e61f0 BattMon: amp-per-volt reduced to 17 (was 18.002) 2013-10-10 11:14:01 +09:00
Craig3DRobotics e5501bf911 AP_BattMonitor: Updated parameter descriptions 2013-10-09 15:33:03 -07:00
Andrew Tridgell cd65e2109d AP_BattMonitor: fixed type in docs 2013-10-10 07:22:05 +11:00
Randy Mackay 9aea577eb1 BattMonitor: correct default pins for PX4 2013-10-08 10:28:48 +09:00
Randy Mackay f1309ed63f BattMonitor: bug fix for current_total_mah 2013-10-03 11:16:24 +09:00
Randy Mackay 7d73e62a23 BattMonitor: add exhausted method
Current total calculations changed to use micros instead of millis for
improved accuracy
Removed unused pack_capacity accessor
Initialise private members
2013-10-03 11:16:19 +09:00
Randy Mackay d9fe099885 BattMonitor: update comments and defaults 2013-10-03 11:16:17 +09:00
Andrew Tridgell 366d73124a AP_Battery: fixed parameter name and default voltage ratio
also setup SITL with right pins
2013-10-03 11:16:15 +09:00
Andrew Tridgell 88777beab0 AP_BattMonitor: minor cleanups
cleanup name to be multiplier not div ratio, and make 2 variables
non-static
2013-10-03 11:16:10 +09:00
Randy Mackay 8b06a12fa4 BattMonitor: initial draft lib 2013-10-03 11:16:01 +09:00