Koala Library
|
Test for the Koala robot of the koala library. More...
Go to the source code of this file.
Defines | |
#define | BIG_SPEED_FACTOR 25 |
#define | SPEED_FACTOR 1 |
#define | MAX_SPEED 500 |
#define | MIN_SPEED 1 |
#define | DEFAULT_SPEED 200 |
#define | ROTATE_HIGH_SPEED_FACT 0.5 |
#define | ROTATE_LOW_SPEED_FACT 0.7 |
#define | ROTATE_DIG_SPEED_FACT 0.5 |
#define | ROT_SPEED_HIGH_TRESH 300 |
#define | STOP_TIME 100000 |
#define | SIGN(x) ((x)>0?1:((x)<0?-1:0)) |
#define | BR_IRGAIN 1 |
#define | fwSpeed 200 |
#define | BMIN_SPEED 10 |
#define | RotSpeedL 50 |
#define | RotSpeedR -50 |
#define | MAX_DIST 60 |
#define | MIN_DIST 25 |
#define | US_BAR_LEN 23 |
#define | ACGY_BAR_LEN 30 |
#define | MAX_US_DISTANCE 250.0 |
#define | MAX_G 2 |
#define | US_VAL(val) ((val)==KOALA_US_DISABLED_SENSOR ? "Not activated" : ((val)==KOALA_US_NO_OBJECT_IN_RANGE ? "No object in range" : ((val)==KOALA_US_OBJECT_NEAR ? "Object at less than 25cm" : "Object in range 25..250cm"))) |
Functions | |
static void | ctrlc_handler (int sig) |
char * | kitoa (int val, int base) |
long long | timeval_diff (struct timeval *difference, struct timeval *end_time, struct timeval *start_time) |
int | drive_robot () |
int | braitenbergAvoidance () |
int | test_sound () |
int | main (int argc, char *argv[]) |
Variables | |
static int | quitReq = 0 |
Test for the Koala robot of the koala library.
Definition in file koala_test.c.
#define ACGY_BAR_LEN 30 |
Referenced by main().
#define BIG_SPEED_FACTOR 25 |
Definition at line 128 of file koala_test.c.
Referenced by drive_robot().
#define BMIN_SPEED 10 |
Definition at line 386 of file koala_test.c.
Referenced by braitenbergAvoidance().
#define BR_IRGAIN 1 |
Braintenberg demo program
none. |
Definition at line 384 of file koala_test.c.
Referenced by braitenbergAvoidance().
#define DEFAULT_SPEED 200 |
Definition at line 132 of file koala_test.c.
Referenced by drive_robot().
#define fwSpeed 200 |
Definition at line 385 of file koala_test.c.
Referenced by braitenbergAvoidance().
#define MAX_DIST 60 |
Definition at line 391 of file koala_test.c.
Referenced by braitenbergAvoidance().
#define MAX_SPEED 500 |
Definition at line 130 of file koala_test.c.
Referenced by drive_robot().
#define MAX_US_DISTANCE 250.0 |
Referenced by main().
#define MIN_DIST 25 |
Definition at line 392 of file koala_test.c.
Referenced by braitenbergAvoidance().
#define MIN_SPEED 1 |
Definition at line 131 of file koala_test.c.
Referenced by drive_robot().
#define ROT_SPEED_HIGH_TRESH 300 |
Definition at line 137 of file koala_test.c.
Referenced by drive_robot().
#define ROTATE_DIG_SPEED_FACT 0.5 |
Definition at line 136 of file koala_test.c.
Referenced by drive_robot().
#define ROTATE_HIGH_SPEED_FACT 0.5 |
Definition at line 134 of file koala_test.c.
Referenced by drive_robot().
#define ROTATE_LOW_SPEED_FACT 0.7 |
Definition at line 135 of file koala_test.c.
Referenced by drive_robot().
#define RotSpeedL 50 |
Definition at line 388 of file koala_test.c.
#define RotSpeedR -50 |
Definition at line 389 of file koala_test.c.
#define SIGN | ( | x | ) | ((x)>0?1:((x)<0?-1:0)) |
Definition at line 140 of file koala_test.c.
Referenced by drive_robot().
#define SPEED_FACTOR 1 |
Definition at line 129 of file koala_test.c.
Referenced by drive_robot().
#define STOP_TIME 100000 |
Definition at line 138 of file koala_test.c.
#define US_BAR_LEN 23 |
Referenced by main().
#define US_VAL | ( | val | ) | ((val)==KOALA_US_DISABLED_SENSOR ? "Not activated" : ((val)==KOALA_US_NO_OBJECT_IN_RANGE ? "No object in range" : ((val)==KOALA_US_OBJECT_NEAR ? "Object at less than 25cm" : "Object in range 25..250cm"))) |
Referenced by main().
int braitenbergAvoidance | ( | ) |
Definition at line 394 of file koala_test.c.
References BMIN_SPEED, BR_IRGAIN, fwSpeed, KOALA_AUTOM_NONE, KOALA_AUTOM_US_SENSOR_BIT, koala_configure_auto_monitoring_mode(), koala_configure_us_io(), koala_get_battery_data(), koala_get_from_auto_mode(), koala_kbhit(), koala_read_motor_position(), koala_set_motor_speed(), koala_set_motor_speed_accel(), KOALA_US_ALL, KOALA_US_SENSORS_NUMBER, MAX_DIST, MIN_DIST, auto_struct_s::mode, timeval_diff(), and auto_struct_s::us.
Referenced by main().
static void ctrlc_handler | ( | int | sig | ) | [static] |
Make sure the program terminate properly on a ctrl-c
Definition at line 52 of file koala_test.c.
References koala_change_term_mode(), koala_set_motor_speed_open_loop(), and quitReq.
Referenced by main().
int drive_robot | ( | ) |
Drive the robot with the keyboard
none |
Definition at line 152 of file koala_test.c.
References BIG_SPEED_FACTOR, DEFAULT_SPEED, koala_change_term_mode(), koala_clrscr(), koala_kbhit(), koala_read_motor_speed(), koala_set_motor_speed(), koala_set_motor_speed_accel(), KOALA_SPEED_TO_MM_S, MAX_SPEED, MIN_SPEED, ROT_SPEED_HIGH_TRESH, ROTATE_DIG_SPEED_FACT, ROTATE_HIGH_SPEED_FACT, ROTATE_LOW_SPEED_FACT, SIGN, and SPEED_FACTOR.
Referenced by main().
char* kitoa | ( | int | val, |
int | base | ||
) |
convert integer to string in specific base
val | value to be converted |
base | base of the value |
Definition at line 71 of file koala_test.c.
Referenced by main().
int main | ( | int | argc, |
char * | argv[] | ||
) |
Main program
argc | number of arguments |
argv | argument array |
Definition at line 553 of file koala_test.c.
References auto_struct_s::accel, ACGY_BAR_LEN, gps_data_s::altitude, braitenbergAvoidance(), ctrlc_handler(), gps_data_s::date_time, drive_robot(), auto_struct_s::gps, auto_struct_s::gps_raw, auto_struct_s::gyro, kitoa(), KOALA_ACCEL_G, KOALA_ACCEL_VALUES_NUMBER, KOALA_AD_TO_V, koala_clrscr(), koala_configure_auto_monitoring_mode(), koala_configure_pid(), koala_configure_us_io(), koala_get_battery_data(), koala_get_firmware_version_revision(), koala_get_from_auto_mode(), koala_get_motor_status(), koala_getcommand_line_nowait(), koala_gps_data(), KOALA_GYRO_DEG_S, KOALA_GYRO_VALUES_NUMBER, koala_init(), koala_kbhit(), KOALA_MAX_I2C_DATA, KOALA_MOTOR_ACC_DIV, KOALA_MOTOR_ACC_INC, KOALA_MOTOR_CST_SPEED, KOALA_MOTOR_D, KOALA_MOTOR_I, KOALA_MOTOR_MAX_CURRENT, KOALA_MOTOR_MIN_SPACC, KOALA_MOTOR_P, KOALA_MOTOR_POS_MARGIN, KOALA_PULSE_TO_MM, koala_read_accelerometer(), koala_read_ad(), koala_read_gyroscope(), koala_read_i2c(), koala_read_io(), koala_read_motor_current(), koala_read_motor_position(), koala_read_motor_speed(), koala_read_us_sensors(), koala_reset_microcontroller(), koala_scan_i2c(), koala_send_gps_cmd(), koala_set_motor_speed(), koala_set_motor_speed_accel(), koala_set_motor_speed_open_loop(), koala_set_motor_target_position(), koala_set_position_encoders(), koala_set_pwr_io_output(), koala_set_speed_profile(), KOALA_SPEED_TO_MM_S, KOALA_TIME_BTWN, KOALA_US_DISABLED_SENSOR, KOALA_US_NO_OBJECT_IN_RANGE, KOALA_US_SENSOR_NAMES, KOALA_US_SENSORS_NUMBER, koala_write_i2c(), gps_data_s::lat_car, gps_data_s::lat_val, auto_struct_s::left_current, auto_struct_s::left_position, auto_struct_s::left_speed, gps_data_s::long_car, gps_data_s::long_val, MAX_G, MAX_US_DISTANCE, auto_struct_s::mode, quitReq, auto_struct_s::right_current, auto_struct_s::right_position, auto_struct_s::right_speed, gps_data_s::sat_nb, gps_data_s::speed, test_sound(), auto_struct_s::us, US_BAR_LEN, US_VAL, and gps_data_s::valid_sat.
int test_sound | ( | ) |
test sound
Definition at line 539 of file koala_test.c.
Referenced by main().
long long timeval_diff | ( | struct timeval * | difference, |
struct timeval * | end_time, | ||
struct timeval * | start_time | ||
) |
Compute time difference
difference | difference between the two times, in structure timeval type |
end_time | end time |
start_time | start time |
Definition at line 96 of file koala_test.c.
Referenced by braitenbergAvoidance().
int quitReq = 0 [static] |
Definition at line 46 of file koala_test.c.
Referenced by ctrlc_handler(), and main().