Skip to content
Snippets Groups Projects
Commit f3db18ad authored by Fernando Herrero's avatar Fernando Herrero
Browse files

Update README.md

parent f39c062a
No related branches found
No related tags found
No related merge requests found
battery_monitor library {#mainpage}
================
============
## Description
C++ driver to monitor the paylaod battery for the Tibi, Dabo and Teo platforms.
## Installation
* Add the labrobotica repository if it is not already added:
``` sudo sh -c 'echo "deb [arch=amd64] http://147.83.76.226/~irilabo/packages xenial main" > /etc/apt/sources.list.d/labrobotica_repo.list' ```
``` wget -O - http://147.83.76.226/~irilabo/labrobotica_repo.gpg.key | sudo apt-key add - ```
``` sudo apt update ```
* Install the package:
``` sudo apt install iri-battery-monitor-dev ```
## Disclaimer
Copyright (C) 20017-2019 Institut de Robòtica i Informàtica Industrial, CSIC-UPC.
Mantainer: IRI labrobotica (labrobotica@iri.upc.edu)
Author: shernand (shernand@iri.upc.edu)
All rights reserved.
This file is part of battery_monitor driver library
battery_monitor driver library is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
## For developers
<details><summary>click here</summary>
<p>
## Dependencies
This package requires of the following system libraries and packages
......@@ -19,26 +62,27 @@ This package also requires of the following IRI libraries:
* [iriutils](https://gitlab.iri.upc.edu/labrobotica/algorithms/iriutils "iriutils gitlab page"), a set of basic tools.
* [comm](https://gitlab.iri.upc.edu/labrobotica/drivers/comm "comm gitlab page"), a set of drivers for standard communication devices.
* [dynamixel](https://gitlab.iri.upc.edu/labrobotica/drivers/dynamixel "dynamixel gitlab page"), a set of drivers for Dynamixel Bus communications
* [dynamixel](https://gitlab.iri.upc.edu/labrobotica/drivers/dynamixel "dynamixel gitlab page"), a driver for dynamixel communication protocol.
## Compilation and installation
Download this repository and create a build folder inside:
> ``` mkdir build ```
``` mkdir build ```
Inside the build folder execute the following commands:
> ``` cmake .. ```
``` cmake .. ```
The default build mode is DEBUG. That is, objects and executables include debug information.
The RELEASE build mode optimizes for speed. To build in this mode execute instead
> ``` cmake .. -DCMAKE_BUILD_TYPE=RELEASE ```
``` cmake .. -DCMAKE_BUILD_TYPE=RELEASE ```
The release mode will be kept until next time cmake is executed.
> ``` make ```
``` make -j $(nproc)```
In case no errors are reported, the generated libraries (if any) will be located at the
_lib_ folder and the executables (if any) will be located at the _bin_ folder.
......@@ -46,81 +90,65 @@ _lib_ folder and the executables (if any) will be located at the _bin_ folder.
In order to be able to use the library, it it necessary to copy it into the system.
To do that, execute
> ``` make install ```
``` make install ```
as root and the shared libraries will be copied to */usr/local/lib/iridrivers* directory
and the header files will be copied to */usr/local/include/iridrivers* dierctory. At
this point, the library may be used by any user.
as root and the shared libraries will be copied to */usr/local/lib/iri/battery_monitor* directory
and the header files will be copied to */usr/local/include/iri/battery_monitor* dierctory.
At this point, the library may be used by any user.
To remove the library from the system, exceute
> ``` make uninstall ```
``` make uninstall ```
as root, and all the associated files will be removed from the system.
To generate the documentation execute the following command:
> ``` make doc ```
## How to use it
### Test
A test example is provided, which will output the battery information on the screen.
``` make doc ```
First, you may need to:
### Scripts
* unload the *ftdi_sio* module, so the device is detected as a serial-usb device:
It's also needed to run some commands, gathered in these scripts:
* Manually once:
``` sudo rmmod ftdi_sio```
* Unload the *ftdi_sio* module, so the device is detected as a serial-usb device:
* Persistently, you can run the provided script
```source scripts/unbind_ftdi_udev.sh```
* load the *pcspkr* module, so the motherboard buzzers makes sound when alarms are enabled:
* Or manually once:
* Manually once:
``` sudo rmmod ftdi_sio```
``` sudo modprobe pcspkr```
* Load the *pcspkr* module, so the motherboard buzzers makes sound when alarms are enabled:
* Persistently, you can run the provided script:
```source scripts/load_pcspkr.sh```
Then you can run the example and see the battery status information on the screen
* Or manually once:
> ``` ./bin/battery_monitor_test```
``` sudo modprobe pcspkr```
### Library
## How to use it
To use this library in an other library or application, in the CMakeLists.txt file, first it is necessary to locate if the library has been installed or not using the following command
> ``` FIND_PACKAGE(<library name>) ```
``` FIND_PACKAGE(battery_monitor) ```
In the case that the package is present, it is necessary to add the header files directory to the include directory path by using
> ``` INCLUDE_DIRECTORIES(${<librray name>_INCLUDE_DIR}) ```
``` INCLUDE_DIRECTORIES(${battery_monitor_INCLUDE_DIRS}) ```
and it is also necessary to link with the desired libraries by using the following command
> ``` TARGET_LINK_LIBRARIES(<executable name> ${<library name>_LIBRARY}) ```
## Disclaimer
Copyright (C) 2009-2018 Institut de Robòtica i Informàtica Industrial, CSIC-UPC.
Mantainer: IRI labrobotics (labrobotica@iri.upc.edu)
``` TARGET_LINK_LIBRARIES(<executable name> ${battery_monitor_LIBRARIES}) ```
Author: shernand (shernand@iri.upc.edu)
This package is distributed in the hope that it will be useful, but without any warranty. It is provided "as is" without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of the program is with you. should the program prove defective, the GMR group does not assume the cost of any necessary servicing, repair or correction.
In no event unless required by applicable law the author will be liable to you for damages, including any general, special, incidental or consequential damages arising out of the use or inability to use the program (including but not limited to loss of data or data being rendered inaccurate or losses sustained by you or third parties or a failure of the program to operate with any other programs), even if the author has been advised of the possibility of such damages.
## Examples
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
There is one example called _test\_battery\_monitor_, which prints the battery information on the screen.
```./bin/battery_monitor_test```
</p>
</details>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment