khepera3_test.c File Reference

This is an application that demonstrates the various khepera3 commands. More...

Include dependency graph for khepera3_test.c:

Go to the source code of this file.

Defines

#define MAXBUFFERSIZE   100
#define BR_IRGAIN   30
#define fwSpeed   20
#define MIN_SPEED   10
#define RotSpeedL   50
#define RotSpeedR   -50

Functions

int kbhit (void)
void clear_screen ()
int initMot (knet_dev_t *hDev)
int initKH3 (void)
int proxIR (int argc, char *argv[], void *data)
int ambIR (int argc, char *argv[], void *data)
int voltageBAT (int argc, char *argv[], void *data)
int tstampRST (int argc, char *argv[], void *data)
int revisionOS (int argc, char *argv[], void *data)
int configureOS (int argc, char *argv[], void *data)
int measureUS (int argc, char *argv[], void *data)
int getallus (int argc, char *argv[], void *data)
int motSpeed (int argc, char *argv[], void *data)
int motMove (int argc, char *argv[], void *data)
int motStop (int argc, char *argv[], void *data)
int braitenbergAvoidance (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 arc, char *argv[])

Variables

static int quitReq = 0
static char buf [1024]
static knet_dev_tdsPic
static knet_dev_tmot1
static knet_dev_tmot2
static kb_command_t cmds []

Detailed Description

This is an application that demonstrates the various khepera3 commands.

Khepera3 test application

Author:
Arnaud Maye (K-Team SA)
Note:
Copyright (C) 2005 K-TEAM SA
Bug:
none discovered.
Todo:
nothing.

Khepera3 test application

Author:
Arnaud Maye (K-Team SA)
Note:
Copyright (C) 2005 K-TEAM SA
Bug:
none discovered.
Todo:
nothing.

Definition in file khepera3_test.c.


Define Documentation

#define BR_IRGAIN   30

Braintenberg demo program

Parameters:
none. 

Definition at line 559 of file khepera3_test.c.

Referenced by braitenbergAvoidance().

#define fwSpeed   20

Definition at line 560 of file khepera3_test.c.

Referenced by braitenbergAvoidance().

#define MAXBUFFERSIZE   100

Definition at line 17 of file khepera3_test.c.

#define MIN_SPEED   10

Definition at line 561 of file khepera3_test.c.

Referenced by braitenbergAvoidance().

#define RotSpeedL   50

Definition at line 562 of file khepera3_test.c.

Referenced by braitenbergAvoidance().

#define RotSpeedR   -50

Definition at line 563 of file khepera3_test.c.

Referenced by braitenbergAvoidance().


Function Documentation

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

ambIR retrieves ambiant ir measure using kb_khepera3.c library.

Definition at line 206 of file khepera3_test.c.

References clear_screen(), kbhit(), kh3_ambiant_ir(), MAXBUFFERSIZE, and sensors.

Here is the call graph for this function:

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

clear screen

Returns:
A value :
  • 1 if success
  • 0 if any error

Definition at line 70 of file khepera3_test.c.

Referenced by ambIR(), getallus(), and proxIR().

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

configureOS configures various parameters inside the kh3 firmware using kb_khepera3.c library.

Parameters:
argc number of argument
argv first param (argv[1]) is the index pointing in configuration array. 2nd the second param (argv[2]) is the value to store where the index point at.
data data

Definition at line 376 of file khepera3_test.c.

References kh3_configure_os(), and MAXBUFFERSIZE.

Here is the call graph for this function:

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

getallus retrieves ultrasonic measure from all the transceivers.

Definition at line 450 of file khepera3_test.c.

References clear_screen(), kbhit(), kh3_configure_os(), kh3_measure_us(), and MAXBUFFERSIZE.

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 732 of file khepera3_test.c.

References kb_command_s::name.

int initKH3 ( void   ) 

initKH3 initialize various things in the kh3 then sequentialy open the various required handle to the three i2c devices on the khepera3 using knet_open from the knet.c libkorebot's modules. Finaly, this function initializes then configures the motor control unit.

Returns:
A value :
  • 0 if success
  • <0 if any error

Definition at line 127 of file khepera3_test.c.

References initMot(), kh3_init(), KNET_BUS_I2C, and knet_open().

Referenced by main().

Here is the call graph for this function:

int initMot ( knet_dev_t hDev  ) 

initMot initializes then configures the motor control unit.

Parameters:
hDev device handle
Returns:
A value :
  • 1 if success
  • 0 if any error

Definition at line 85 of file khepera3_test.c.

References kmot_ConfigurePID(), kmot_ResetError(), kmot_SetBlockedTime(), kmot_SetLimits(), kmot_SetMargin(), kmot_SetMode(), kmot_SetOptions(), kmot_SetSampleTime(), kmot_SetSpeedProfile(), kMotModeIdle, kMotRegCurrent, kMotRegPos, kMotRegSpeed, kMotSWOptDirectionInv, kMotSWOptStopMotorBlk, and kMotSWOptWindup.

Referenced by initKH3().

Here is the call graph for this function:

int kbhit ( void   ) 

Definition at line 34 of file khepera3_test.c.

Referenced by ambIR(), braitenbergAvoidance(), getallus(), and proxIR().

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

Definition at line 743 of file khepera3_test.c.

References buf, initKH3(), kb_parse_command(), kh3_revision(), MAXBUFFERSIZE, and quitReq.

Here is the call graph for this function:

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

measureUS retrieves ultrasonic measure from a given transceiver.

Parameters:
argc number of argument
argv first param (argv[1]) is the us number to read from (1 to 5).
data data

Definition at line 401 of file khepera3_test.c.

References kh3_measure_us(), and MAXBUFFERSIZE.

Here is the call graph for this function:

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

motMove configures the motor controller position in the engine control unit.

Parameters:
argc number of argument
argv first param (argv[1]) is the motor1 position. second param (argv[2]) is the motor2 position.
data data

Definition at line 523 of file khepera3_test.c.

References kmot_SetPoint(), and kMotRegPos.

Here is the call graph for this function:

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

motSpeed configures the motor controller speed in the engine control unit.

Parameters:
argc number of argument
argv first param (argv[1]) is the motor1 speed. 2nd second param (argv[2]) is the motor2 speed.
data data

Definition at line 502 of file khepera3_test.c.

References kmot_SetPoint(), and kMotRegSpeed.

Here is the call graph for this function:

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

motStop stops the motor in the engine control unit.

Definition at line 539 of file khepera3_test.c.

References kmot_SetMode(), and kMotModeStopMotor.

Here is the call graph for this function:

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

proxIR retrieves proximity ir measure using kb_khepera3.c library.

Definition at line 157 of file khepera3_test.c.

References clear_screen(), kbhit(), kh3_proximity_ir(), MAXBUFFERSIZE, and sensors.

Here is the call graph for this function:

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

Quit the program.

Definition at line 698 of file khepera3_test.c.

References quitReq.

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

revisionOS retrieves the khepera3 os version using kb_khepera3.c library.

Definition at line 340 of file khepera3_test.c.

References kh3_revision(), kmot_GetFWVersion(), KMOT_REVISION, KMOT_VERSION, and MAXBUFFERSIZE.

Here is the call graph for this function:

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

tstampRST resets the relative time stamp using kb_khepera3.c library.

Definition at line 327 of file khepera3_test.c.

References kh3_reset_tstamp(), and MAXBUFFERSIZE.

Here is the call graph for this function:

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

voltageBAT retrieves the battery voltage using kb_khepera3.c library.

Definition at line 258 of file khepera3_test.c.

References kh3_battery_voltage(), and MAXBUFFERSIZE.

Here is the call graph for this function:


Variable Documentation

char buf[1024] [static]

Definition at line 20 of file khepera3_test.c.

Referenced by main().

kb_command_t cmds[] [static]
Initial value:
 {
 { "quit"            , 0 , 0 , quit } ,
 { "exit"            , 0 , 0 , quit } ,
 { "bye"             , 0 , 0 , quit } ,
 { "setcfg"          , 2 , 2 , configureOS },
 { "getrev"          , 0 , 0 , revisionOS },
 { "getbat"          , 1 , 1 , voltageBAT },
 { "rststamp"        , 0 , 0 , tstampRST },    
 { "getambir"        , 0 , 0 , ambIR },
 { "getproxir"       , 0 , 0 , proxIR },
 { "getus"           , 1 , 1 , measureUS },
 { "getallus"           , 0 , 0 , getallus },
 { "setmotspeed"     , 2 , 2 , motSpeed },
 { "setmotmove"      , 2 , 2 , motMove },
 { "motstop"         , 0 , 0 , motStop },
 { "braiten"         , 0 , 0 , braitenbergAvoidance},
 { "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 709 of file khepera3_test.c.

knet_dev_t* dsPic [static]

handle to the various khepera3 devices (knet socket, i2c mode)

Definition at line 25 of file khepera3_test.c.

knet_dev_t* mot1 [static]

Definition at line 26 of file khepera3_test.c.

knet_dev_t* mot2 [static]

Definition at line 27 of file khepera3_test.c.

int quitReq = 0 [static]

Definition at line 19 of file khepera3_test.c.

Referenced by main(), and quit().

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