batterywatcher.c File Reference

This file contains functions needed to implement a battery watcher. More...

#include <math.h>
#include "logger.h"
#include "batterywatcher.h"
#include "kh3moves.h"

Include dependency graph for batterywatcher.c:

Go to the source code of this file.

Defines

#define _ISOC99_SOURCE
 Needed for floating point constants, like INFINITY.

Functions

int getBatteryVoltage (char *buffer, float *value)
 Gets the battery's voltage in Volt [V] from Khepera.
int getBatteryCurrent (char *buffer, float *value)
 Gets the battery's current in Ampère [A] from Khepera.
int getBatteryTemp (char *buffer, float *value)
 Gets the battery's temperature in degree Celcius [C] from Khepera.
int getBatteryRelCapacity (char *buffer, float *value)
 Gets the battery's capacity in percent [%] from Khepera.
void * batteryWatcher (void *arg)
 This thread watches the battery status and shows its staus periodicaly.

Variables

knet_dev_t * dsPic
 Khepera status device.
char batteryWatcherQuitReq = 0
 If set to 1, battery watcher will quit.
WINDOW * bwLogWindow = NULL
 ncurses window, where the logging output will go to.


Detailed Description

This file contains functions needed to implement a battery watcher.

Battery watcher is a thread, which watches the battery's capacity and reports it every now and then. If the battery voltage falls below a certain value battery watcher will become more persistent with it's warning until the voltage falls falls below an absolute minimum in which case battery watcher will stop the robot and terminate the program.

Version:
Id
batterywatcher.c,v 1.9 2008/09/18 12:59:00 prokop Exp

Definition in file batterywatcher.c.


Define Documentation

#define _ISOC99_SOURCE

Needed for floating point constants, like INFINITY.

Definition at line 32 of file batterywatcher.c.


Function Documentation

void* batteryWatcher ( void *  arg  ) 

This thread watches the battery status and shows its staus periodicaly.

Additionally it shows a warning if the battery's power goes below a predefined value.

Parameters:
arg Arguments for this thread, see batteryWatcherArgs.
Returns:
Nothing.

Definition at line 112 of file batterywatcher.c.

int getBatteryCurrent ( char *  buffer,
float *  value 
)

Gets the battery's current in Ampère [A] from Khepera.

Parameters:
buffer character buffer for mystic usage by libkorebot. Will contain register values we asked for.
value Pointer to a variable, in which we store the result.
Returns:
0 if an error occured, 1 else.

Definition at line 70 of file batterywatcher.c.

int getBatteryRelCapacity ( char *  buffer,
float *  value 
)

Gets the battery's capacity in percent [%] from Khepera.

Parameters:
buffer character buffer for mystic usage by libkorebot. Will contain register values we asked for.
value Pointer to a variable, in which we store the result.
Returns:
0 if an error occured, 1 else.

Definition at line 102 of file batterywatcher.c.

int getBatteryTemp ( char *  buffer,
float *  value 
)

Gets the battery's temperature in degree Celcius [C] from Khepera.

Parameters:
buffer character buffer for mystic usage by libkorebot. Will contain register values we asked for.
value Pointer to a variable, in which we store the result.
Returns:
0 if an error occured, 1 else.

Definition at line 86 of file batterywatcher.c.

int getBatteryVoltage ( char *  buffer,
float *  value 
)

Gets the battery's voltage in Volt [V] from Khepera.

Parameters:
buffer character buffer for mystic usage by libkorebot. Will contain register values we asked for.
value Pointer to a variable, in which we store the result.
Returns:
0 if an error occured, 1 else.

Definition at line 54 of file batterywatcher.c.


Variable Documentation

If set to 1, battery watcher will quit.

Definition at line 43 of file batterywatcher.c.

WINDOW* bwLogWindow = NULL

ncurses window, where the logging output will go to.

Definition at line 46 of file batterywatcher.c.

knet_dev_t* dsPic

Khepera status device.

Definition at line 58 of file kh3moves.c.


Generated on Sun Sep 28 21:20:01 2008 for Guard by  doxygen 1.5.6