klrf_test.c File Reference

This module provides useful basic examples to interface with the LedRangeFinder library for korebot. More...

Include dependency graph for klrf_test.c:

Go to the source code of this file.

Defines

#define NB_COLUMNS_MAX   80.0
#define NB_LINES_MAX   24.0
#define DEFAULT_X_FACTOR   (2.0*2000.0)
#define DEFAULT_Y_FACTOR   (2.0*2000.0)
#define MAX_X_FACTOR   (2.0*5600.0)
#define MAX_Y_FACTOR   (2.0*5600.0)
#define MIN_X_FACTOR   (2.0*500.0)
#define MIN_Y_FACTOR   (2.0*500.0)
#define LRF_DEVICE   "/dev/ttyACM0"
#define ZOOM_FACTOR   1.25

Functions

static void ctrlc_handler (int sig)
int laseron (int argc, char *argv[], void *data)
int laseroff (int argc, char *argv[], void *data)
int poweron (int argc, char *argv[], void *data)
int poweroff (int argc, char *argv[], void *data)
void lrfheader ()
int setfile (int argc, char *argv[], void *data)
int lrfinit (int argc, char *argv[], void *data)
int lrfmeasure (int argc, char *argv[], void *data)
int lrfmeasureaverage (int argc, char *argv[], void *data)
int quit (int argc, char *argv[], void *data)
int help (int argc, char *argv[], void *data)
int main (int argc, char *argv[])

Variables

static int quitReq = 0
static int lrfHandle = -1
static FILE * outfile
static char filename [256]
static float x_factor = DEFAULT_X_FACTOR
static float y_factor = DEFAULT_Y_FACTOR
static kb_command_t cmds []
static char buf [1024]

Detailed Description

This module provides useful basic examples to interface with the LedRangeFinder library for korebot.

simple led range finder test executable

Author:
Arnaud Maye (K-Team SA), J. Tharin : 2011.11.07 modified for using Hokuyo URG-04LX-UG01 LRF
Note:
Copyright (C) 2011 K-TEAM SA
Bug:
none discovered.
Todo:

Definition in file klrf_test.c.


Define Documentation

#define DEFAULT_X_FACTOR   (2.0*2000.0)

Definition at line 34 of file klrf_test.c.

Referenced by lrfmeasure().

#define DEFAULT_Y_FACTOR   (2.0*2000.0)

Definition at line 35 of file klrf_test.c.

#define LRF_DEVICE   "/dev/ttyACM0"

Definition at line 41 of file klrf_test.c.

#define MAX_X_FACTOR   (2.0*5600.0)

Definition at line 36 of file klrf_test.c.

Referenced by lrfmeasure().

#define MAX_Y_FACTOR   (2.0*5600.0)

Definition at line 37 of file klrf_test.c.

Referenced by lrfmeasure().

#define MIN_X_FACTOR   (2.0*500.0)

Definition at line 38 of file klrf_test.c.

Referenced by lrfmeasure().

#define MIN_Y_FACTOR   (2.0*500.0)

Definition at line 39 of file klrf_test.c.

Referenced by lrfmeasure().

#define NB_COLUMNS_MAX   80.0

Definition at line 30 of file klrf_test.c.

Referenced by lrfmeasure().

#define NB_LINES_MAX   24.0

Definition at line 31 of file klrf_test.c.

Referenced by lrfmeasure().

#define ZOOM_FACTOR   1.25

Definition at line 47 of file klrf_test.c.

Referenced by lrfmeasure().


Function Documentation

static void ctrlc_handler ( int  sig  )  [static]

Make sure the program terminate properly on a ctrl-c

Parameters:
sig signal

Definition at line 55 of file klrf_test.c.

References filename, kb_lrf_Close(), lrfHandle, outfile, and quitReq.

Referenced by main().

Here is the call graph for this function:

int help ( int  argc,
char *  argv[],
void *  data 
)

Display a list of available commands.

Definition at line 429 of file klrf_test.c.

References kb_command_s::name.

int laseroff ( int  argc,
char *  argv[],
void *  data 
)

Set laser beam off

Definition at line 94 of file klrf_test.c.

References kb_lrf_Laser_Off(), and lrfHandle.

Referenced by lrfmeasure().

Here is the call graph for this function:

int laseron ( int  argc,
char *  argv[],
void *  data 
)

Set laser beam on

Definition at line 78 of file klrf_test.c.

References kb_lrf_Laser_On(), and lrfHandle.

Here is the call graph for this function:

void lrfheader (  ) 

Set header of output file for saving lrf data

Definition at line 142 of file klrf_test.c.

References outfile.

Referenced by lrfmeasure().

int lrfinit ( int  argc,
char *  argv[],
void *  data 
)

Initialise lrf communication

Definition at line 186 of file klrf_test.c.

References kb_lrf_Init(), LRF_DEVICE, and lrfHandle.

Here is the call graph for this function:

int lrfmeasure ( int  argc,
char *  argv[],
void *  data 
)
int lrfmeasureaverage ( int  argc,
char *  argv[],
void *  data 
)

Get measures from the lrf, averaged

Definition at line 388 of file klrf_test.c.

References lrfmeasure().

Here is the call graph for this function:

int main ( int  argc,
char *  argv[] 
)

Definition at line 448 of file klrf_test.c.

References buf, ctrlc_handler(), filename, kb_clrscr(), kb_init(), kb_lrf_Close(), kb_parse_command(), kb_set_debug_level(), lrfHandle, outfile, and quitReq.

Here is the call graph for this function:

int poweroff ( int  argc,
char *  argv[],
void *  data 
)

Set power supply off, close the laser communication

Definition at line 123 of file klrf_test.c.

References kb_lrf_Close(), kb_lrf_Laser_Off(), kb_lrf_Power_Off(), and lrfHandle.

Here is the call graph for this function:

int poweron ( int  argc,
char *  argv[],
void *  data 
)

Set power supply on

Definition at line 113 of file klrf_test.c.

References kb_lrf_Power_On().

Here is the call graph for this function:

int quit ( int  argc,
char *  argv[],
void *  data 
)

Quit the program.

Definition at line 399 of file klrf_test.c.

References quitReq.

int setfile ( int  argc,
char *  argv[],
void *  data 
)

Open output file for saving lrf data

Definition at line 158 of file klrf_test.c.

References filename, and outfile.


Variable Documentation

char buf[1024] [static]

Main program to process the command line.

Definition at line 446 of file klrf_test.c.

Referenced by main().

kb_command_t cmds[] [static]
Initial value:
 {
  { "quit"            , 0 , 0 , quit } ,
  { "exit"            , 0 , 0 , quit } ,
  { "bye"             , 0 , 0 , quit } ,
  { "setfile"         , 1 , 1 , setfile },
  { "lrfinit"        , 0 , 0 , lrfinit },
  { "laseron"           , 0 , 0 , laseron },
  { "laseroff"          , 0 , 0 , laseroff },
  { "poweron"           , 0 , 0 , poweron },
  { "poweroff"          , 0 , 0 , poweroff },
  { "lrfmeasure"      , 1 , 2 , lrfmeasure }, 
  { "help"            , 0 , 0 , help } ,
  { NULL              , 0 , 0 , NULL }
}

The command table contains: command name : min number of args : max number of args : the function to call

Definition at line 411 of file klrf_test.c.

char filename[256] [static]

Definition at line 27 of file klrf_test.c.

Referenced by ctrlc_handler(), kb_config_init(), main(), and setfile().

int lrfHandle = -1 [static]

Definition at line 22 of file klrf_test.c.

Referenced by ctrlc_handler(), laseroff(), laseron(), lrfinit(), lrfmeasure(), main(), and poweroff().

FILE* outfile [static]

Definition at line 25 of file klrf_test.c.

Referenced by ctrlc_handler(), lrfheader(), lrfmeasure(), main(), and setfile().

int quitReq = 0 [static]

Definition at line 21 of file klrf_test.c.

Referenced by ctrlc_handler(), main(), and quit().

float x_factor = DEFAULT_X_FACTOR [static]

Definition at line 44 of file klrf_test.c.

Referenced by lrfmeasure().

float y_factor = DEFAULT_Y_FACTOR [static]

Definition at line 45 of file klrf_test.c.

Referenced by lrfmeasure().

Generated on Fri Dec 2 09:58:53 2011 for KoreBot Library by  doxygen 1.6.3