# inspEnergyBatt

This project contains a C++ driver for use with the Inspired Energy based battery balls for the Dorado AUV.

Config
--------------------
The driver requires a config file to be placed in $AUV_CONFIG_DIR, an example of which is provided in `src/example_battery.cfg`
The config file must define one battery, and may define up to four batteries.
The convention is straight forward and can be seen in te below excerpt from the example configuration file:

```
//Battery 1
b1Name  = Batt1;
b1IP    = 134.89.32.131;
b1Port  = 20003;
b1DischFET = 1;
b1AuxFET = 0;
b1Aux2FET = 0;

//Battery 2
b2Name  = Batt2;
b2IP    = 134.89.32.146;
b2IPort = 20003;
b2DischFET = 1;
b2AuxFET = 0;
b2Aux2FET = 0;
```

If extra batteries are defined, in the config file, but are not installed. The battery driver will periodically write to Syslog because the driver expects traffic from the missing battery ball. Unused batteries can be commented out with C-style `//` comments.

Driver startup
--------------------
To launch the driver, issue a command of the following form: `$ battServer -cfg <config_file>`, for example:

`$ battServer -cfg ctdBatteries.cfg`

The IP addresses, and port numbers should correspond to the batteries installed in the vehicle.

Logs
-----------
Logfiles will be created for each battery ball, with names `Batt1.log`, and `Batt2.log` (given the name configuration above), and placed in $AUV_LOG_DIR. Note that for the time being, it is best to keep the naming convention static, since the MATLAB log plotting code assumes log files of the form `BattN.log`. A copy of the configuration file is also copied to $AUV_LOG_DIR.