This is an application that demonstrates the various khepera3 commands. More...
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_t * | dsPic |
static knet_dev_t * | mot1 |
static knet_dev_t * | mot2 |
static kb_command_t | cmds [] |
This is an application that demonstrates the various khepera3 commands.
Khepera3 test application
Khepera3 test application
Definition in file khepera3_test.c.
#define BR_IRGAIN 30 |
Braintenberg demo program
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().
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.
int braitenbergAvoidance | ( | int | argc, | |
char * | argv[], | |||
void * | data | |||
) |
Definition at line 565 of file khepera3_test.c.
References BR_IRGAIN, fwSpeed, kb_gpio_get(), kbhit(), kh3_proximity_ir(), kh3_sendcommand(), kmot_GetMeasure(), kmot_SetMode(), kmot_SetPoint(), kMotMesSpeed, kMotModeStopMotor, kMotRegPos, kMotRegSpeed, KNET_INT0, knet_llread(), MAXBUFFERSIZE, MIN_SPEED, RotSpeedL, and RotSpeedR.
void clear_screen | ( | ) |
clear screen
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.
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.
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.
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.
Definition at line 127 of file khepera3_test.c.
References initMot(), kh3_init(), KNET_BUS_I2C, and knet_open().
Referenced by main().
int initMot | ( | knet_dev_t * | hDev | ) |
initMot initializes then configures the motor control unit.
hDev | device handle |
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().
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.
int measureUS | ( | int | argc, | |
char * | argv[], | |||
void * | data | |||
) |
measureUS retrieves ultrasonic measure from a given transceiver.
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.
int motMove | ( | int | argc, | |
char * | argv[], | |||
void * | data | |||
) |
motMove configures the motor controller position in the engine control unit.
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.
int motSpeed | ( | int | argc, | |
char * | argv[], | |||
void * | data | |||
) |
motSpeed configures the motor controller speed in the engine control unit.
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.
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.
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.
int quit | ( | int | argc, | |
char * | argv[], | |||
void * | data | |||
) |
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.
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.
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.
char buf[1024] [static] |
Definition at line 20 of file khepera3_test.c.
Referenced by main().
kb_command_t cmds[] [static] |
{ { "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.