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

Referenced by braitenbergAvoidance().

#define fwSpeed   20

Definition at line 391 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 392 of file khepera3_test.c.

Referenced by braitenbergAvoidance().

#define RotSpeedL   50

Definition at line 393 of file khepera3_test.c.

Referenced by braitenbergAvoidance().

#define RotSpeedR   -50

Definition at line 394 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 129 of file khepera3_test.c.

References kh3_ambiant_ir(), and MAXBUFFERSIZE.

Here is the call graph for this function:

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

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

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

Parameters:
1st 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.

Definition at line 263 of file khepera3_test.c.

References kh3_configure_os(), 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 453 of file koala_GoAutomation.c.

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 :
  • 1 if success
  • 0 if any error

Definition at line 81 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.

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

Definition at line 39 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 main ( int  arc,
char *  argv[] 
)

Definition at line 566 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:
1st first param (argv[1]) is the us number to read from (1 to 5).

Definition at line 286 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:
1st first param (argv[1]) is the motor1 position.
2nd second param (argv[2]) is the motor2 position.

Definition at line 355 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:
1st first param (argv[1]) is the motor1 speed.
2nd second param (argv[2]) is the motor2 speed.

Definition at line 336 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.

Parameters:
none. 

Definition at line 372 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 111 of file khepera3_test.c.

References kh3_proximity_ir(), and MAXBUFFERSIZE.

Here is the call graph for this function:

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

Quit the program.

Definition at line 522 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 229 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 216 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 147 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.

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 },
 { "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 533 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.


Generated on Wed Dec 15 11:49:28 2010 for KoreBot Library by  doxygen 1.5.5