Koala Library
|
header of Funtions for commanding the Koala More...
Go to the source code of this file.
Data Structures | |
struct | gps_data_s |
struct | auto_struct_s |
Defines | |
#define | KOALA_SERIAL_PORT_NAME "/dev/ttyS1" |
#define | KOALA_SERIAL_PORT_BAUDRATE B115200 |
#define | KOALA_MAX_BUFFER 1024 |
#define | KOALA_DELIM "," |
#define | KOALA_AUTOM_US_SENSOR_BIT 1<<0 |
#define | KOALA_AUTOM_MOTOR_SPEED 1<<1 |
#define | KOALA_AUTOM_MOTOR_POSITION 1<<2 |
#define | KOALA_AUTOM_MOTOR_CURRENT 1<<3 |
#define | KOALA_AUTOM_ACCEL_VALUE 1<<4 |
#define | KOALA_AUTOM_GYRO_VALUE 1<<5 |
#define | KOALA_AUTOM_GPS_DATA 1<<6 |
#define | KOALA_AUTOM_GPS_NEMA 1<<7 |
#define | KOALA_AUTOM_MAGNE_VALUE 1<<8 |
#define | KOALA_AUTOM_ALL 0x01FF |
#define | KOALA_AUTOM_NONE 0x0000 |
#define | KOALA_US_LEFT_REAR 1<<0 |
#define | KOALA_US_LEFT_FRONT 1<<1 |
#define | KOALA_US_FRONT_LEFT 1<<2 |
#define | KOALA_US_FRONT 1<<3 |
#define | KOALA_US_FRONT_RIGHT 1<<4 |
#define | KOALA_US_RIGHT_FRONT 1<<5 |
#define | KOALA_US_RIGHT_REAR 1<<6 |
#define | KOALA_US_BACK_RIGHT 1<<7 |
#define | KOALA_US_BACK_LEFT 1<<8 |
#define | KOALA_US_ALL 511 |
#define | KOALA_US_NONE 0 |
#define | KOALA_US_SENSORS_NUMBER 9 |
#define | KOALA_IO_0_OUTPUT 0b00000000 |
#define | KOALA_IO_0_INPUT 0b00000001 |
#define | KOALA_IO_0_PWMS 0b00000010 |
#define | KOALA_IO_1_OUTPUT 0b00000000 |
#define | KOALA_IO_1_INPUT 0b00000100 |
#define | KOALA_IO_1_PWMS 0b00001000 |
#define | KOALA_IO_2_OUTPUT 0b00000000 |
#define | KOALA_IO_2_INPUT 0b00010000 |
#define | KOALA_IO_2_PWMS 0b00100000 |
#define | KOALA_IO_3_OUTPUT 0b00000000 |
#define | KOALA_IO_3_INPUT 0b01000000 |
#define | KOALA_IO_3_PWMS 0b10000000 |
#define | KOALA_IO_ALL_OUTPUT 0b00000000 |
#define | KOALA_PWR_IO_0_0 0b00000000 |
#define | KOALA_PWR_IO_0_1 0b00000001 |
#define | KOALA_PWR_IO_1_0 0b00000000 |
#define | KOALA_PWR_IO_1_1 0b00000010 |
#define | KOALA_PWR_IO_2_0 0b00000000 |
#define | KOALA_PWR_IO_2_1 0b00000100 |
#define | KOALA_PWR_IO_3_0 0b00000000 |
#define | KOALA_PWR_IO_3_1 0b00001000 |
#define | KOALA_ACCEL_G (1.0/16384.0) |
#define | KOALA_ACCEL_VALUES_NUMBER 30 |
#define | KOALA_NEW_ACCEL_X 0 |
#define | KOALA_NEW_ACCEL_Y 1 |
#define | KOALA_NEW_ACCEL_Z 2 |
#define | KOALA_GYRO_DEG_S (66.0/1000.0) |
#define | KOALA_GYRO_VALUES_NUMBER 30 |
#define | KOALA_NEW_GYRO_X 0 |
#define | KOALA_NEW_GYRO_Y 1 |
#define | KOALA_NEW_GYRO_Z 2 |
#define | KOALA_MAGNE_VALUES_NUMBER 3 |
#define | KOALA_MAX_I2C_DATA 256 |
#define | KOALA_WHEELS_DISTANCE 250.0 |
#define | KOALA_WHEEL_DIAM 82.5 |
#define | KOALA_PULSE_TO_MM (M_PI*KOALA_WHEEL_DIAM/23400.0) |
#define | KOALA_TIME_BTWN 10 |
#define | KOALA_SPEED_TO_MM_S (KOALA_PULSE_TO_MM/(KOALA_TIME_BTWN/1000.0)) |
#define | KOALA_US_DISABLED_SENSOR 2000 |
#define | KOALA_US_NO_OBJECT_IN_RANGE 1000 |
#define | KOALA_US_OBJECT_NEAR 0 |
#define | KOALA_MOTOR_P 10 |
#define | KOALA_MOTOR_I 3 |
#define | KOALA_MOTOR_D 1 |
#define | KOALA_MOTOR_ACC_INC 5 |
#define | KOALA_MOTOR_ACC_DIV 1 |
#define | KOALA_MOTOR_MIN_SPACC 10 |
#define | KOALA_MOTOR_CST_SPEED 200 |
#define | KOALA_MOTOR_POS_MARGIN 10 |
#define | KOALA_MOTOR_MAX_CURRENT 10 |
#define | KOALA_AD_TO_V (3.3/1024) |
#define | KOALA_RS232_MESSAGE_ERROR_CHAR '#' |
Typedefs | |
typedef struct gps_data_s | gps_data_t |
typedef struct auto_struct_s | koala_auto_data_t |
Functions | |
int | koala_robot_init (void) |
int | koala_robot_release (void) |
int | koala_sendcommand (char *command, int write_len) |
int | koala_getcommand (char *command, int read_len) |
int | koala_getcommand_line (char *command) |
int | koala_get_firmware_version_revision (char *version, char *revision) |
int | koala_get_battery_data (int *bat_type, int *bat_voltage, int *bat_current, int *chrg_current) |
int | koala_configure_auto_monitoring_mode (unsigned int bit_config) |
int | koala_get_from_auto_mode (koala_auto_data_t *data) |
int | koala_configure_us_io (int us_mask, unsigned char io_dir) |
int | koala_configure_pid (int kp, int ki, int kd) |
int | koala_set_speed_profile (int acc_inc, int acc_div, int min_speed, int cst_speed, int pos_margin, int max_current) |
int | koala_set_position_encoders (int left, int right) |
int | koala_set_motor_speed (int left, int right) |
int | koala_set_motor_speed_accel (int left, int right) |
int | koala_set_motor_speed_open_loop (int left, int right) |
int | koala_read_motor_speed (int *left, int *right) |
int | koala_set_motor_target_position (int left, int right) |
int | koala_read_motor_current (int *left, int *right) |
int | koala_read_motor_position (int *left, int *right) |
int | koala_get_motor_status (int *left_status, int *right_status, int *left_pos, int *right_pos) |
int | koala_read_us_sensors (int *values_array) |
int | koala_read_accelerometer (int *values_array) |
int | koala_read_gyroscope (int *values_array) |
int | koala_read_magnetometer (int *values_array) |
int | koala_gps_data (char *valid_sat, int *sat_nb, double *lat_val, char *lat_car, double *long_val, char *long_car, struct tm *date_time, double *speed, int *altitude) |
int | koala_send_gps_cmd (char *gps_cmd) |
int | koala_read_i2c (int i2c_add, int i2c_reg, int nb_read, int *data) |
int | koala_write_i2c (int i2c_add, int i2c_reg, int nb_data, int *data) |
int | koala_scan_i2c (int *nb_devices, int *address) |
int | koala_set_pwr_io_output (int power_out, int IO0, int IO1, int IO2, int IO3) |
int | koala_read_io (int *io_state, int *in_state) |
int | koala_read_ad (int *ad_0, int *ad_1) |
int | koala_reset_microcontroller () |
Variables | |
const char * | KOALA_US_SENSOR_NAMES [] |
header of Funtions for commanding the Koala
Definition in file koala_robot.h.
#define KOALA_ACCEL_G (1.0/16384.0) |
Definition at line 112 of file koala_robot.h.
Referenced by main().
#define KOALA_ACCEL_VALUES_NUMBER 30 |
Definition at line 113 of file koala_robot.h.
Referenced by koala_get_from_auto_mode(), koala_read_accelerometer(), and main().
#define KOALA_AD_TO_V (3.3/1024) |
Definition at line 158 of file koala_robot.h.
Referenced by main().
#define KOALA_AUTOM_ACCEL_VALUE 1<<4 |
Definition at line 57 of file koala_robot.h.
#define KOALA_AUTOM_ALL 0x01FF |
Definition at line 62 of file koala_robot.h.
#define KOALA_AUTOM_GPS_DATA 1<<6 |
Definition at line 59 of file koala_robot.h.
#define KOALA_AUTOM_GPS_NEMA 1<<7 |
Definition at line 60 of file koala_robot.h.
#define KOALA_AUTOM_GYRO_VALUE 1<<5 |
Definition at line 58 of file koala_robot.h.
#define KOALA_AUTOM_MAGNE_VALUE 1<<8 |
Definition at line 61 of file koala_robot.h.
Referenced by main().
#define KOALA_AUTOM_MOTOR_CURRENT 1<<3 |
Definition at line 56 of file koala_robot.h.
#define KOALA_AUTOM_MOTOR_POSITION 1<<2 |
Definition at line 55 of file koala_robot.h.
Referenced by main().
#define KOALA_AUTOM_MOTOR_SPEED 1<<1 |
Definition at line 54 of file koala_robot.h.
#define KOALA_AUTOM_NONE 0x0000 |
Definition at line 63 of file koala_robot.h.
Referenced by braitenbergAvoidance(), and main().
#define KOALA_AUTOM_US_SENSOR_BIT 1<<0 |
Definition at line 53 of file koala_robot.h.
Referenced by braitenbergAvoidance().
#define KOALA_DELIM "," |
Definition at line 50 of file koala_robot.h.
Referenced by koala_read_i2c(), and process_param().
#define KOALA_GYRO_DEG_S (66.0/1000.0) |
Definition at line 119 of file koala_robot.h.
Referenced by main().
#define KOALA_GYRO_VALUES_NUMBER 30 |
Definition at line 120 of file koala_robot.h.
Referenced by koala_get_from_auto_mode(), koala_read_gyroscope(), and main().
#define KOALA_IO_0_INPUT 0b00000001 |
Definition at line 86 of file koala_robot.h.
#define KOALA_IO_0_OUTPUT 0b00000000 |
Definition at line 85 of file koala_robot.h.
#define KOALA_IO_0_PWMS 0b00000010 |
Definition at line 87 of file koala_robot.h.
#define KOALA_IO_1_INPUT 0b00000100 |
Definition at line 89 of file koala_robot.h.
#define KOALA_IO_1_OUTPUT 0b00000000 |
Definition at line 88 of file koala_robot.h.
#define KOALA_IO_1_PWMS 0b00001000 |
Definition at line 90 of file koala_robot.h.
#define KOALA_IO_2_INPUT 0b00010000 |
Definition at line 92 of file koala_robot.h.
#define KOALA_IO_2_OUTPUT 0b00000000 |
Definition at line 91 of file koala_robot.h.
#define KOALA_IO_2_PWMS 0b00100000 |
Definition at line 93 of file koala_robot.h.
#define KOALA_IO_3_INPUT 0b01000000 |
Definition at line 95 of file koala_robot.h.
#define KOALA_IO_3_OUTPUT 0b00000000 |
Definition at line 94 of file koala_robot.h.
#define KOALA_IO_3_PWMS 0b10000000 |
Definition at line 96 of file koala_robot.h.
#define KOALA_IO_ALL_OUTPUT 0b00000000 |
Definition at line 97 of file koala_robot.h.
#define KOALA_MAGNE_VALUES_NUMBER 3 |
Definition at line 125 of file koala_robot.h.
Referenced by koala_get_from_auto_mode(), koala_read_magnetometer(), and main().
#define KOALA_MAX_BUFFER 1024 |
Definition at line 48 of file koala_robot.h.
Referenced by koala_configure_auto_monitoring_mode(), koala_configure_pid(), koala_configure_us_io(), koala_get_battery_data(), koala_get_from_auto_mode(), koala_get_motor_status(), koala_gps_data(), koala_read_accelerometer(), koala_read_ad(), koala_read_gyroscope(), koala_read_i2c(), koala_read_io(), koala_read_magnetometer(), 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(), and koala_write_i2c().
#define KOALA_MAX_I2C_DATA 256 |
Definition at line 127 of file koala_robot.h.
Referenced by koala_read_i2c(), and main().
#define KOALA_MOTOR_ACC_DIV 1 |
Definition at line 151 of file koala_robot.h.
Referenced by main().
#define KOALA_MOTOR_ACC_INC 5 |
Definition at line 150 of file koala_robot.h.
Referenced by main().
#define KOALA_MOTOR_CST_SPEED 200 |
Definition at line 153 of file koala_robot.h.
Referenced by main().
#define KOALA_MOTOR_D 1 |
Definition at line 149 of file koala_robot.h.
Referenced by main().
#define KOALA_MOTOR_I 3 |
Definition at line 148 of file koala_robot.h.
Referenced by main().
#define KOALA_MOTOR_MAX_CURRENT 10 |
Definition at line 155 of file koala_robot.h.
Referenced by main().
#define KOALA_MOTOR_MIN_SPACC 10 |
Definition at line 152 of file koala_robot.h.
Referenced by main().
#define KOALA_MOTOR_P 10 |
Definition at line 147 of file koala_robot.h.
Referenced by main().
#define KOALA_MOTOR_POS_MARGIN 10 |
Definition at line 154 of file koala_robot.h.
Referenced by main().
#define KOALA_NEW_ACCEL_X 0 |
Definition at line 115 of file koala_robot.h.
#define KOALA_NEW_ACCEL_Y 1 |
Definition at line 116 of file koala_robot.h.
#define KOALA_NEW_ACCEL_Z 2 |
Definition at line 117 of file koala_robot.h.
#define KOALA_NEW_GYRO_X 0 |
Definition at line 121 of file koala_robot.h.
#define KOALA_NEW_GYRO_Y 1 |
Definition at line 122 of file koala_robot.h.
#define KOALA_NEW_GYRO_Z 2 |
Definition at line 123 of file koala_robot.h.
#define KOALA_PULSE_TO_MM (M_PI*KOALA_WHEEL_DIAM/23400.0) |
Definition at line 136 of file koala_robot.h.
Referenced by main().
#define KOALA_PWR_IO_0_0 0b00000000 |
Definition at line 101 of file koala_robot.h.
#define KOALA_PWR_IO_0_1 0b00000001 |
Definition at line 102 of file koala_robot.h.
#define KOALA_PWR_IO_1_0 0b00000000 |
Definition at line 103 of file koala_robot.h.
#define KOALA_PWR_IO_1_1 0b00000010 |
Definition at line 104 of file koala_robot.h.
#define KOALA_PWR_IO_2_0 0b00000000 |
Definition at line 105 of file koala_robot.h.
#define KOALA_PWR_IO_2_1 0b00000100 |
Definition at line 106 of file koala_robot.h.
#define KOALA_PWR_IO_3_0 0b00000000 |
Definition at line 107 of file koala_robot.h.
#define KOALA_PWR_IO_3_1 0b00001000 |
Definition at line 108 of file koala_robot.h.
#define KOALA_RS232_MESSAGE_ERROR_CHAR '#' |
Koala Error codes
Definition at line 164 of file koala_robot.h.
#define KOALA_SERIAL_PORT_BAUDRATE B115200 |
Definition at line 46 of file koala_robot.h.
Referenced by koala_robot_init().
#define KOALA_SERIAL_PORT_NAME "/dev/ttyS1" |
#define KOALA_SPEED_TO_MM_S (KOALA_PULSE_TO_MM/(KOALA_TIME_BTWN/1000.0)) |
Definition at line 140 of file koala_robot.h.
Referenced by drive_robot(), and main().
#define KOALA_TIME_BTWN 10 |
Definition at line 138 of file koala_robot.h.
Referenced by main().
#define KOALA_US_ALL 511 |
Definition at line 76 of file koala_robot.h.
Referenced by braitenbergAvoidance().
#define KOALA_US_BACK_LEFT 1<<8 |
Definition at line 75 of file koala_robot.h.
#define KOALA_US_BACK_RIGHT 1<<7 |
Definition at line 74 of file koala_robot.h.
#define KOALA_US_DISABLED_SENSOR 2000 |
Definition at line 142 of file koala_robot.h.
Referenced by main().
#define KOALA_US_FRONT 1<<3 |
Definition at line 70 of file koala_robot.h.
#define KOALA_US_FRONT_LEFT 1<<2 |
Definition at line 69 of file koala_robot.h.
#define KOALA_US_FRONT_RIGHT 1<<4 |
Definition at line 71 of file koala_robot.h.
#define KOALA_US_LEFT_FRONT 1<<1 |
Definition at line 68 of file koala_robot.h.
#define KOALA_US_LEFT_REAR 1<<0 |
Definition at line 67 of file koala_robot.h.
#define KOALA_US_NO_OBJECT_IN_RANGE 1000 |
Definition at line 143 of file koala_robot.h.
Referenced by main().
#define KOALA_US_NONE 0 |
Definition at line 77 of file koala_robot.h.
#define KOALA_US_OBJECT_NEAR 0 |
Definition at line 144 of file koala_robot.h.
#define KOALA_US_RIGHT_FRONT 1<<5 |
Definition at line 72 of file koala_robot.h.
#define KOALA_US_RIGHT_REAR 1<<6 |
Definition at line 73 of file koala_robot.h.
#define KOALA_US_SENSORS_NUMBER 9 |
Definition at line 82 of file koala_robot.h.
Referenced by braitenbergAvoidance(), koala_get_from_auto_mode(), koala_read_us_sensors(), and main().
#define KOALA_WHEEL_DIAM 82.5 |
Definition at line 134 of file koala_robot.h.
#define KOALA_WHEELS_DISTANCE 250.0 |
Definition at line 132 of file koala_robot.h.
Referenced by main().
typedef struct gps_data_s gps_data_t |
Koala types
typedef struct auto_struct_s koala_auto_data_t |
int koala_configure_auto_monitoring_mode | ( | unsigned int | bit_config | ) |
Configure the auto monitoring mode. Enable a peripheral to return automatically without asking its value when refreshed.
bit_config | binary OR bit mask configuration for auto monitoring mode (default: all OFF) see koala_robot.h for constant definition of each Bit 0: US sensor Bit 1: Motor Speed Bit 2: Motor Position Bit 3: Motor Current Bit 4: Accelerometer value Bit 5: Gyroscope value Bit 6: GPS data Bit 7: GPS NEMA Data (will return all GPS raw data) Bit 8: Magnometer value |
Definition at line 232 of file koala_robot.c.
References koala_getcommand_line(), KOALA_MAX_BUFFER, and koala_sendcommand().
Referenced by braitenbergAvoidance(), and main().
int koala_configure_pid | ( | int | kp, |
int | ki, | ||
int | kd | ||
) |
Configure the PID controller value used for the speed control.
kp | P parameter |
ki | I parameter |
kd | D parameter |
Definition at line 491 of file koala_robot.c.
References koala_getcommand_line(), KOALA_MAX_BUFFER, and koala_sendcommand().
Referenced by main().
int koala_configure_us_io | ( | int | us_mask, |
unsigned char | io_dir | ||
) |
Configure the auto monitoring mode. Enable a peripheral to return automatically without asking its value when refreshed.
us_mask | binary OR bit mask configuration for use of Ultrasonic sensors (default: all active) see koala_robot.h for constant definition of each Bit 0: Left rear Bit 1: Left front Bit 2: Front left Bit 3: Front Bit 4: Front right Bit 5: Right front Bit 6: Right rear Bit 7: Back right Bit 8: Back left |
io_dir | binary OR bit mask configuration for direction of the four IO (0..3). Each IO is configure with two following bits: (IO0 = bit0 & 1, IO1 = bit2&3,…). Default: 0 = all output 00 = output 01 = input 10 = PWM servo (50Hz). see koala_robot.h for constant definition of each |
Definition at line 316 of file koala_robot.c.
References koala_getcommand_line(), KOALA_MAX_BUFFER, and koala_sendcommand().
Referenced by braitenbergAvoidance(), and main().
int koala_get_battery_data | ( | int * | bat_type, |
int * | bat_voltage, | ||
int * | bat_current, | ||
int * | chrg_current | ||
) |
Read the different values of the battery
bat_type | 0 = Li-ION, 1 = NiMH, 2 = not initialised |
bat_voltage | Voltage of the battery (unit is 0.1V) |
bat_current | Current of the battery (unit is 0.1A) |
chrg_current | Charge Current (unit is 10mA) |
Definition at line 941 of file koala_robot.c.
References koala_getcommand_line(), KOALA_MAX_BUFFER, and koala_sendcommand().
Referenced by braitenbergAvoidance(), and main().
int koala_get_firmware_version_revision | ( | char * | version, |
char * | revision | ||
) |
retrieves the current OS Firmware version/revision
version | version |
revision | revision |
Definition at line 258 of file koala_robot.c.
References koala_getcommand(), and koala_sendcommand().
Referenced by main().
int koala_get_from_auto_mode | ( | koala_auto_data_t * | data | ) |
Get values from auto mode
data | data received (see koala_robot.h for type definition) |
Definition at line 1164 of file koala_robot.c.
References auto_struct_s::accel, gps_data_s::altitude, gps_data_s::date_time, auto_struct_s::gps, auto_struct_s::gps_raw, auto_struct_s::gyro, KOALA_ACCEL_VALUES_NUMBER, koala_getcommand_line_nowait(), KOALA_GYRO_VALUES_NUMBER, KOALA_MAGNE_VALUES_NUMBER, KOALA_MAX_BUFFER, KOALA_US_SENSORS_NUMBER, 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, auto_struct_s::magne, auto_struct_s::mode, process_param(), auto_struct_s::right_current, auto_struct_s::right_position, auto_struct_s::right_speed, gps_data_s::sat_nb, gps_data_s::speed, auto_struct_s::us, and gps_data_s::valid_sat.
Referenced by braitenbergAvoidance(), and main().
int koala_get_motor_status | ( | int * | left_status, |
int * | right_status, | ||
int * | left_pos, | ||
int * | right_pos | ||
) |
Get Motor control status
Read the actual status of the motor control
left_status | left motor control status Type of actual control: 0: Idle 1: Speed 2: Speed with Acceleration 3: Position 4: Open Loop 5: Current Limitation 6: Error |
right_status | right motor control status |
left_pos | left motor: 1 if the target is reach (position control) |
right_pos | right motor: 1 if the target is reach (position control) |
Definition at line 1053 of file koala_robot.c.
References koala_getcommand_line(), KOALA_MAX_BUFFER, and koala_sendcommand().
Referenced by main().
int koala_getcommand | ( | char * | command, |
int | read_len | ||
) |
gets a command frame from the robot.
Normally an end user don't want to use these function as they are assumed as "low level functions".
read_len | is the size of the message received |
command | is a pointer to a buffer where the command frame will be stored in. |
Definition at line 145 of file koala_robot.c.
References koala_rs232_read().
Referenced by koala_get_firmware_version_revision().
int koala_getcommand_line | ( | char * | command | ) |
gets a command line from the robot.
Normally an end user don't want to use these function as they are assumed as "low level functions".
command | is a pointer to a buffer where the command frame will be stored in. |
Definition at line 168 of file koala_robot.c.
References koala_rs232_readLine().
Referenced by koala_configure_auto_monitoring_mode(), koala_configure_pid(), koala_configure_us_io(), koala_get_battery_data(), koala_get_motor_status(), koala_gps_data(), koala_read_accelerometer(), koala_read_ad(), koala_read_gyroscope(), koala_read_i2c(), koala_read_io(), koala_read_magnetometer(), 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(), and koala_write_i2c().
int koala_gps_data | ( | char * | valid_sat, |
int * | sat_nb, | ||
double * | lat_val, | ||
char * | lat_car, | ||
double * | long_val, | ||
char * | long_car, | ||
struct tm * | date_time, | ||
double * | speed, | ||
int * | altitude | ||
) |
Get GPS data
valid_sat | Valid data flag (V = Warning, A = Valid) |
sat_nb | number of satellites used |
lat_val | latitude |
lat_car | latitude N or S |
long_val | longitude |
long_car | longitude W or E |
date_time | UTC time and time of the latest fix |
speed | Speed over ground (in knots) |
altitude | Actual altitude (in meters) |
Definition at line 760 of file koala_robot.c.
References koala_getcommand_line(), KOALA_MAX_BUFFER, and koala_sendcommand().
Referenced by main().
int koala_read_accelerometer | ( | int * | values_array | ) |
Get Accelerometer value: read the last 10 value of the XYZ acceleration.
values_array | in order x0,y0,z0,x1,y1,z1,...,x9,y9,z9; new values first |
Definition at line 635 of file koala_robot.c.
References KOALA_ACCEL_VALUES_NUMBER, koala_getcommand_line(), KOALA_MAX_BUFFER, koala_sendcommand(), and process_param().
Referenced by main().
int koala_read_ad | ( | int * | ad_0, |
int * | ad_1 | ||
) |
Read the two AD input values (0-1024 => 0 - 3.3V).
ad_0 | analog input port 0 |
ad_1 | analog input port 1 |
Definition at line 910 of file koala_robot.c.
References koala_getcommand_line(), KOALA_MAX_BUFFER, and koala_sendcommand().
Referenced by main().
int koala_read_gyroscope | ( | int * | values_array | ) |
Get Gyroscope value: read the last 10 value of the XYZ.
values_array | in order x0,y0,z0,x1,y1,z1,...,x9,y9,z9; new values first |
Definition at line 664 of file koala_robot.c.
References koala_getcommand_line(), KOALA_GYRO_VALUES_NUMBER, KOALA_MAX_BUFFER, koala_sendcommand(), and process_param().
Referenced by main().
int koala_read_i2c | ( | int | i2c_add, |
int | i2c_reg, | ||
int | nb_read, | ||
int * | data | ||
) |
Read I2C external bus
i2c_add | i2c address |
i2c_reg | i2c register |
nb_read | number of bytes to read (max 128) |
data | bytes read |
Definition at line 795 of file koala_robot.c.
References KOALA_DELIM, koala_getcommand_line(), KOALA_MAX_BUFFER, KOALA_MAX_I2C_DATA, and koala_sendcommand().
Referenced by main().
int koala_read_io | ( | int * | io_state, |
int * | in_state | ||
) |
Read IO state Read the four IO and the two Input state. If the IO are define as output, will be the same value as set with S command, if define as PWM servo output, will be return as 0.
io_state | 4 IO in binary OR bit configuration (lsb=0, msb = 3) |
in_state | 2 digital input |
Definition at line 881 of file koala_robot.c.
References koala_getcommand_line(), KOALA_MAX_BUFFER, and koala_sendcommand().
Referenced by main().
int koala_read_magnetometer | ( | int * | values_array | ) |
Read the magnometer
values_array | sensors values x,y,z in [mGauss] |
Definition at line 459 of file koala_robot.c.
References koala_getcommand_line(), KOALA_MAGNE_VALUES_NUMBER, KOALA_MAX_BUFFER, koala_sendcommand(), and process_param().
Referenced by main().
int koala_read_motor_current | ( | int * | left, |
int * | right | ||
) |
Read the motor current
left | current of left motor [0.1 A] |
right | current of right motor [0.1 A] |
Definition at line 693 of file koala_robot.c.
References koala_getcommand_line(), KOALA_MAX_BUFFER, and koala_sendcommand().
Referenced by main().
int koala_read_motor_position | ( | int * | left, |
int * | right | ||
) |
Read the motor position [pulse]
left | encoder value of left motor |
right | encoder value of right motor |
Definition at line 722 of file koala_robot.c.
References koala_getcommand_line(), KOALA_MAX_BUFFER, and koala_sendcommand().
Referenced by braitenbergAvoidance(), and main().
int koala_read_motor_speed | ( | int * | left, |
int * | right | ||
) |
Read the motor actual speed [pulses / KOALA_TIME_BTWN ms].
left | left speed |
right | right speed |
Definition at line 369 of file koala_robot.c.
References koala_getcommand_line(), KOALA_MAX_BUFFER, and koala_sendcommand().
Referenced by drive_robot(), and main().
int koala_read_us_sensors | ( | int * | values_array | ) |
Read the ultrasonic sensors
values_array | sensors values array 0: Obstacle <25cm 25-250: Obstacle distance in cm 1000: No obstacle detected 2000: Sensor disable |
Definition at line 427 of file koala_robot.c.
References koala_getcommand_line(), KOALA_MAX_BUFFER, koala_sendcommand(), KOALA_US_SENSORS_NUMBER, and process_param().
Referenced by main().
int koala_reset_microcontroller | ( | ) |
Reset microcontroller
Definition at line 1081 of file koala_robot.c.
References koala_getcommand_line(), KOALA_MAX_BUFFER, and koala_sendcommand().
Referenced by main().
int koala_robot_init | ( | void | ) |
-------------------------------------------------------------------- Prototypes Declaration
initializes. This function needs to be called BEFORE any other functions. But default it is already called inside koala_init!
(none) |
Definition at line 98 of file koala_robot.c.
References koala_rs232_open(), KOALA_SERIAL_PORT_BAUDRATE, and KOALA_SERIAL_PORT_NAME.
Referenced by koala_init().
int koala_robot_release | ( | void | ) |
release the robot. This function needs to be called AFTER any other functions.
(none) |
Definition at line 124 of file koala_robot.c.
References koala_rs232_close().
Referenced by koala_exit().
int koala_scan_i2c | ( | int * | nb_devices, |
int * | address | ||
) |
Definition at line 1106 of file koala_robot.c.
References koala_getcommand_line(), KOALA_MAX_BUFFER, koala_sendcommand(), and MAX_I2C_ADDRESS.
Referenced by main().
int koala_send_gps_cmd | ( | char * | gps_cmd | ) |
Send GPS command
gps_cmd | gps command |
Definition at line 1012 of file koala_robot.c.
References koala_getcommand_line(), KOALA_MAX_BUFFER, and koala_sendcommand().
Referenced by main().
int koala_sendcommand | ( | char * | command, |
int | send_len | ||
) |
send a command frame from the robot.
Normally an end user don't want to use these function as they are assumed as "low level functions".
send_len | is the size of the message received |
command | is a pointer to a buffer where the command frame to send |
Definition at line 204 of file koala_robot.c.
References koala_rs232_write().
Referenced by koala_configure_auto_monitoring_mode(), koala_configure_pid(), koala_configure_us_io(), koala_get_battery_data(), koala_get_firmware_version_revision(), koala_get_motor_status(), koala_gps_data(), koala_read_accelerometer(), koala_read_ad(), koala_read_gyroscope(), koala_read_i2c(), koala_read_io(), koala_read_magnetometer(), 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(), and koala_write_i2c().
int koala_set_motor_speed | ( | int | left, |
int | right | ||
) |
Set the motor speed [pulses / KOALA_TIME_BTWN ms]. The PID controller will manage the speed in closed loop.
left | left speed |
right | right speed |
Definition at line 343 of file koala_robot.c.
References koala_getcommand_line(), KOALA_MAX_BUFFER, and koala_sendcommand().
Referenced by braitenbergAvoidance(), drive_robot(), and main().
int koala_set_motor_speed_accel | ( | int | left, |
int | right | ||
) |
Set Motor Speed with acceleration ramp [pulses / KOALA_TIME_BTWN ms].
Set a speed order to reach with acceleration ramp. The parameters used for this mode are the same as the position control.
left | left speed |
right | right speed |
Definition at line 582 of file koala_robot.c.
References koala_getcommand_line(), KOALA_MAX_BUFFER, and koala_sendcommand().
Referenced by braitenbergAvoidance(), drive_robot(), and main().
int koala_set_motor_speed_open_loop | ( | int | left, |
int | right | ||
) |
Set speed in open loop control.
Set a PWM value for each motor. Value can be from -2000 to +2000 (corresponding to -100 to 100% of PWM).
left | left pwm |
right | right pwm |
Definition at line 610 of file koala_robot.c.
References koala_getcommand_line(), KOALA_MAX_BUFFER, and koala_sendcommand().
Referenced by ctrlc_handler(), and main().
int koala_set_motor_target_position | ( | int | left, |
int | right | ||
) |
Set the motor target position [pulses].
left | left target position |
right | right target position |
Definition at line 398 of file koala_robot.c.
References koala_getcommand_line(), KOALA_MAX_BUFFER, and koala_sendcommand().
Referenced by main().
int koala_set_position_encoders | ( | int | left, |
int | right | ||
) |
Set the position encoder value [pulses].
Reset the position encoder value of the motor. If set during a position control move, the motors will be stopped to avoid an incorrect behaviour.
left | left encoder position |
right | right encoder position |
Definition at line 521 of file koala_robot.c.
References koala_getcommand_line(), KOALA_MAX_BUFFER, and koala_sendcommand().
Referenced by main().
int koala_set_pwr_io_output | ( | int | power_out, |
int | IO0, | ||
int | IO1, | ||
int | IO2, | ||
int | IO3 | ||
) |
Set the PWR and IO output value Set the state of the four PWR output and four IO (if set as output, 0 = GND, 1 = +3.3V, if set as PWM servo, define the position of the servo for 0 to 250 ).
power_out | power output binary OR bit mask configuration see koala_robot.h for constant definition of each bit |
IO0 | IO 0 |
IO1 | IO 1 |
IO2 | IO 2 |
IO3 | IO 4 |
Definition at line 851 of file koala_robot.c.
References koala_getcommand_line(), KOALA_MAX_BUFFER, and koala_sendcommand().
Referenced by main().
int koala_set_speed_profile | ( | int | acc_inc, |
int | acc_div, | ||
int | min_speed, | ||
int | cst_speed, | ||
int | pos_margin, | ||
int | max_current | ||
) |
Configure the parameters used for the position control.
acc_inc | Increment of the speed added every “Acc_Div+1” control loop. |
acc_div | Number of control loop before adding the Acc_Inc to the speed order |
min_speed | Minimum speed order used during the position control |
cst_speed | Constant speed used during the position control after acceleration |
pos_margin | Margin of the position control to detect when the robot reach its target. |
max_current | Maximum current for each motor. If above this value, the controller will limit the motor command. (unit is mA, 0 = disable (default)). |
Definition at line 553 of file koala_robot.c.
References koala_getcommand_line(), KOALA_MAX_BUFFER, and koala_sendcommand().
Referenced by main().
int koala_write_i2c | ( | int | i2c_add, |
int | i2c_reg, | ||
int | nb_data, | ||
int * | data | ||
) |
Write on the I2C external bus
i2c_add | i2c address |
i2c_reg | i2c register |
nb_data | number of data to send |
data | bytes to be written |
Definition at line 973 of file koala_robot.c.
References koala_getcommand_line(), KOALA_MAX_BUFFER, and koala_sendcommand().
Referenced by main().
const char* KOALA_US_SENSOR_NAMES[] |
Definition at line 85 of file koala_robot.c.
Referenced by main().