Go to the source code of this file.
Functions | |
char * | koa_get_nextValue (char *current, char *value) |
int | koa_getOSVersion (knet_dev_t *dev, unsigned char *version, unsigned char *revision, unsigned char *pversion, unsigned char *prevision) |
int | koa_setPidPosition (knet_dev_t *dev, int Kp, int Ki, int Kd) |
int | koa_setPositionCounter (knet_dev_t *dev, long pos_left, long pos_right) |
int | koa_setPidSpeed (knet_dev_t *dev, int Kp, int Ki, int Kd) |
int | koa_setPosition (knet_dev_t *dev, long pos_left, long pos_right) |
int | koa_readSpeed (knet_dev_t *dev, int *speedtable) |
int | koa_readPosition (knet_dev_t *dev, int *postable) |
int | koa_readInput (knet_dev_t *dev, int channel) |
int | koa_readAD (knet_dev_t *dev, int channel) |
int | koa_setProfile (knet_dev_t *dev, int max_speed_left, int acc_left, int max_speed_right, int acc_right) |
int | koa_readStatus (knet_dev_t *dev, int *statustable) |
int | koa_changeLed (knet_dev_t *dev, short int led, short int action) |
int | koa_readSensor (knet_dev_t *dev, int sensor) |
int | koa_setSpeed (knet_dev_t *dev, short int left, short int right) |
int | koa_readBattery (knet_dev_t *dev) |
int | koa_readAmbient (knet_dev_t *dev, int *senstable) |
int | koa_setPWM (knet_dev_t *dev, int left, int right) |
int | koa_setOutput (knet_dev_t *dev, int output, int action) |
int | koa_readProximity (knet_dev_t *dev, int *senstable) |
Koala Robot Support for KoreBot.
Definition in file koala.c.
int koa_changeLed | ( | knet_dev_t * | dev, | |
short int | led, | |||
short int | action | |||
) |
Perform an action on one of the two LEDs of the robot. Possible actions are: 0: turn OFF, 1: turn ON, 2: change status. The LED number 0 is the lateral one, the LED number 1 is the frontal one.
dev | K-Net Device Descriptor | |
led | The led number to change | |
action | to be done |
Definition at line 451 of file koala.c.
References buf, knet_printf(), and knet_read_string().
char* koa_get_nextValue | ( | char * | current, | |
char * | value | |||
) |
Definition at line 28 of file koala.c.
Referenced by koa_readAD(), koa_readAmbient(), koa_readBattery(), koa_readInput(), koa_readPosition(), koa_readProximity(), koa_readSensor(), koa_readSpeed(), and koa_readStatus().
int koa_getOSVersion | ( | knet_dev_t * | dev, | |
unsigned char * | version, | |||
unsigned char * | revision, | |||
unsigned char * | pversion, | |||
unsigned char * | prevision | |||
) |
This function returns the version of the Koala OS and the protocol revision .
dev | K-Net Device Descriptor |
Definition at line 51 of file koala.c.
References buf, knet_printf(), and knet_read_string().
Referenced by main().
int koa_readAD | ( | knet_dev_t * | dev, | |
int | channel | |||
) |
Read the 10 bit value corresponding to the channel_number analog input. The value 1024 corresponds to an analog value of 4,09 Volts.
dev | K-Net Device Descriptor | |
channel | The channel number to read |
Definition at line 346 of file koala.c.
References buf, knet_printf(), knet_read_string(), and koa_get_nextValue().
int koa_readAmbient | ( | knet_dev_t * | dev, | |
int * | senstable | |||
) |
Read the koala ambient liht sensor value. The 16 values are returned within the senstable, which must be allocated by the caller.
dev | K-Net Device Descriptor | |
senstable | An array of 16 integer to store the sensor values |
Definition at line 575 of file koala.c.
References buf, knet_printf(), knet_read_string(), and koa_get_nextValue().
int koa_readBattery | ( | knet_dev_t * | dev | ) |
Read the charge level of the battery. The number returned is the charge expressed in mAh.
dev | K-Net Device Descriptor |
Definition at line 543 of file koala.c.
References buf, knet_printf(), knet_read_string(), and koa_get_nextValue().
int koa_readInput | ( | knet_dev_t * | dev, | |
int | channel | |||
) |
Read the status of the general input lines.
dev | K-Net Device Descriptor | |
channel | The channel number to read |
Definition at line 315 of file koala.c.
References buf, knet_printf(), knet_read_string(), and koa_get_nextValue().
int koa_readPosition | ( | knet_dev_t * | dev, | |
int * | postable | |||
) |
Read the 32 bit position counter of the two motors. The unit is the pulse.
dev | K-Net Device Descriptor | |
postable | Array of 2 integer to store the position readings |
postable[1] is right motor speed
Definition at line 280 of file koala.c.
References buf, knet_printf(), knet_read_string(), and koa_get_nextValue().
Referenced by thread().
int koa_readProximity | ( | knet_dev_t * | dev, | |
int * | senstable | |||
) |
Read the koala proximity sensor value. The 16 values are returned within the senstable, which must be allocated by the caller.
dev | K-Net Device Descriptor | |
senstable | An array of 16 integer to store the sensor values |
Definition at line 673 of file koala.c.
References buf, knet_printf(), knet_read_string(), and koa_get_nextValue().
Referenced by koa_sensor_task(), and thread().
int koa_readSensor | ( | knet_dev_t * | dev, | |
int | sensor | |||
) |
Read the value measured on one of the management sensors. Available sensors are: 0:BATTERY VOLTAGE (measure unit: 20 mV). 1: GENERAL CONSUMPTION CURRENT (measure unit: 8 mA). 2: AMBIENT TEMPERATURE (measure unit: 0.1° C). 3: LEFT MOTOR CURRENT (measure unit: 4 mA). 4: RIGHT MOTOR CURRENT (measure unit: 4 mA). 5: BATTERY TEMPERATURE (measure unit: 0.1° C).
dev | K-Net Device Descriptor | |
sensor | The sensor number to read |
Definition at line 482 of file koala.c.
References buf, knet_printf(), knet_read_string(), and koa_get_nextValue().
int koa_readSpeed | ( | knet_dev_t * | dev, | |
int * | speedtable | |||
) |
Read the instantaneous speed of the two motors. The unit is the pulse/10 ms that corresponds to 4.5 millimetres per second.
dev | K-Net Device Descriptor | |
speedtable | Array of 2 integer to store the speed readings |
speedtable[1] is right motor speed
Definition at line 242 of file koala.c.
References buf, knet_printf(), knet_read_string(), and koa_get_nextValue().
int koa_readStatus | ( | knet_dev_t * | dev, | |
int * | statustable | |||
) |
Read the status of the motion controller. The status is given by three numbers for every motor: T (target), M (mode) and E (error). T=0 means that the robot is still on movement. T=1 means that the robot is on the target position. M=0 means that the current displacement is controlled in the position mode. M=1 means that the current displacement is controlled in the speed mode. E indicates controller position or speed error.
dev | K-Net Device Descriptor | |
statustable | Array of 6 short unsigned to store the status flags |
Definition at line 414 of file koala.c.
References buf, knet_printf(), knet_read_string(), and koa_get_nextValue().
int koa_setOutput | ( | knet_dev_t * | dev, | |
int | output, | |||
int | action | |||
) |
Perform an action on one of the general output lines of the robot. Possible actions are: 0: turn OFF, 1: turn ON, 2: change status. Outputs 0 to 7 are the open drain outputs. The ON status correspond to the transistor closed.Outputs 8 to 11 are the digital ones.
dev | K-Net Device Descriptor | |
output | output number to change | |
action | action to perform |
Definition at line 645 of file koala.c.
References buf, knet_printf(), and knet_read_string().
int koa_setPidPosition | ( | knet_dev_t * | dev, | |
int | Kp, | |||
int | Ki, | |||
int | Kd | |||
) |
Configure the position PID controller. On robot reset the values are set to default of Kp to 400, Ki to 4, Kd to 400.
dev | K-Net Device Descriptor | |
Kp | Proportional Gain | |
Ki | Integral Gain | |
Kd | Derivative Gain |
Definition at line 118 of file koala.c.
References buf, knet_printf(), and knet_read_string().
int koa_setPidSpeed | ( | knet_dev_t * | dev, | |
int | Kp, | |||
int | Ki, | |||
int | Kd | |||
) |
Configure the speed PID controller. On robot reset the values are set to default of Kp to 1000, Ki to 800, Kd to 100.
dev | K-Net Device Descriptor | |
Kp | Proportional Gain | |
Ki | Integral Gain | |
Kd | Derivative Gain |
Definition at line 175 of file koala.c.
References buf, knet_printf(), and knet_read_string().
int koa_setPosition | ( | knet_dev_t * | dev, | |
long | pos_left, | |||
long | pos_right | |||
) |
Indicate to the wheel position controller an absolute position to be reached. The motion control perform the movement using the three control phases of a trapezoidal speed shape: an acceleration, a constant speed and a deceleration period. These phases are performed according to the parameters selected for the trapezoidal speed controller (command J). The maximum distance that can be given by this command is (2**23)-2 pulses that correspond to 318m. The unit is the pulse that corresponds to 0.045mm. The movement is done immediately after the command is sent. In the case another command is under execution (speed or position control) the last command replaces the precedent one. Any replacement transition follows acceleration and maximal speed constraints.
dev | K-Net Device Descriptor | |
pos_left | Target position for the left motor | |
pos_right | Target position for the right motor |
Definition at line 212 of file koala.c.
References buf, knet_printf(), and knet_read_string().
int koa_setPositionCounter | ( | knet_dev_t * | dev, | |
long | pos_left, | |||
long | pos_right | |||
) |
Set the 32 bit position counter of the two motors. The unit is the pulse, that corresponds to 0,045 mm.
dev | K-Net Device Descriptor | |
left_pos | Value to set left position counter | |
right_pos | Value to set right position counter |
Definition at line 146 of file koala.c.
References buf, knet_printf(), and knet_read_string().
Referenced by init(), reset(), and thread().
int koa_setProfile | ( | knet_dev_t * | dev, | |
int | max_speed_left, | |||
int | acc_left, | |||
int | max_speed_right, | |||
int | acc_right | |||
) |
Set the Speed and the acceleration for the trapezoidal speed shape of the position controller. The max_speed parameter indicates the maximal speed reached during the displacement. The unit for the speed is the pulse/10ms that corresponds to 4.5 mm/s. The unit for the acceleration is the ((pulse/256)/10 ms)/10 ms, that correspond to 1.758 mm/s2. At the reset, these parameters are set to standard values: max_speed to 20, acc to 64.
dev | K-Net Device Descriptor | |
max_speed_left | Maximum speed for the left motor | |
acc_left | Acceleration for the left motor | |
max_speed_right | Maximum speed for the right motor | |
acc_right | Acceleration for the right motor |
Definition at line 384 of file koala.c.
References buf, knet_printf(), and knet_read_string().
int koa_setPWM | ( | knet_dev_t * | dev, | |
int | left, | |||
int | right | |||
) |
Set the desired PWM amplitude (see Motors and motor control on page 9 for more details) on the two motors. The minimum PWM ratio is 0 (0%). The maximal forward ratio (100%) correspond to a value of 255. The maximal backwards ratio (100%) correspond to a value of -255.
dev | K-Net Device Descriptor | |
left | Left Motor PWM. (range [-255..255]) | |
right | Right Motor PWM. (range [-255..255]) |
Definition at line 614 of file koala.c.
References buf, knet_printf(), and knet_read_string().
int koa_setSpeed | ( | knet_dev_t * | dev, | |
short int | left, | |||
short int | right | |||
) |
This function changes the speed of the left & right motor of the Koala robot. Set the speed of the two motors. The unit is the pulse/10 ms that corres-ponds to 4.5 millimetres per second.
dev | K-Net Device Descriptor | |
left | Left Motor Speed. (range [-127..127]) | |
right | Right Motor Speed. (range [-127..127]) |
Definition at line 516 of file koala.c.
References buf, knet_printf(), and knet_read_string().
Referenced by handle_kill(), koa_lrf_task(), koa_net_setspeed(), koa_net_stop(), koa_sensor_task(), main(), quit(), and thread().