Library of Functions

Library of functions in C (specifically KISS C – including functions specific to Botball) [taken from the Manual that comes with KISS-C]

CBC Library Functions (Link controller has a few new functions not listed here, 
                       see on-line manual with KISS IDE 4+)

(alphabetic order)

a_button    [Category: Sensors]
 Format: int a_button();
 Reads the value (0 or 1) of the A button.
alloff   [Category: Motors]
 Format: void  alloff();
 Turns off all motors. ao is a short form for alloff.
analog    [Category: Sensors]
 Format: int analog(int p);
 Returns the value of the sensor installed at the port numbered p. The result is an
 integer between 0 and 255. The function can be used with analog ports 0 through 7.
analog10    [Category: Sensors]
 Format: int analog10(int p);
 10-bit version of the analog function. The returned value is in the range 0 to 1023
 rather than 0 to 255.
ao    [Category: Motors]
 Format: void ao();
 Turns off all motors.
atan    [Category: Math]
 Format: float atan(float angle);
 Returns the arc tangent of the angle. Angle is specified in radians; the result is
 in radians.
b_button    [Category: Sensors]
 Format: int b_button();
 Reads the value (0 or 1) of the B button.
beep    [Category: Output]
 Format: void beep();
 Produces a tone. Returns when the tone is finished.
bk    [Category: Motors]
 Format: void bk(int m);
 Turns motor m on full speed in the backward direction.
 Example: bk(1);
black_button    [Category: Sensors]
 Format: int black_button();
 Reads the value (0 or 1) of the Black button on the CBC (or a period on the
 simulator).
block_motor_done   [Category: Motors]
 Format: void block_motor_done(int m);
 Function does not return until specified motor completes any executing speed or
 position control moves.
 Example: mrp(0,500,20000L);
block_motor_done(1);
bmd   [Category: Motors]
 Format: void bmd(int m);
 Function does not return until specified motor completes any executing speed or
 position control moves.
 Example: mrp(0,500,20000L); bmd(1);
cbc_display_clear    [Category: Output]
 Format: void cbc_display_clear();
 Clear the CBC display.
cbc_printf    [Category: Output]
 Format: void cbc_printf(int col, int row, char s[], . . .);
 Perform a standard printf starting at screen location col, row.
clear_motor_position_counter    [Category: Motors]
 Format: void clear_motor_position_counter(int motor_nbr);
 Reset the position counter for the motor specified to 0.
cos    [Category: Math]
 Format: float cos(float angle);
 Returns cosine of angle. Angle is specified in radians; result is in radians.
defer    [Category: Processes]
 Format: void defer();
 Makes a process swap out immediately after the function is called. Useful if a
 process knows that it will not need to do any work until the next time around 
 the scheduler loop. defer() is implemented as a C built-in function.
digital    [Category: Sensors]
 Format: int digital(int p);
 Returns the value of the sensor in sensor port p, as a true/false value (1 for true
 and 0 for false). Sensors are expected to be active low, meaning that they are
 valued at zero volts in the active, or true, state. Thus the library function
 returns the inverse of the actual reading from the digital hardware: if the reading
 is zero volts or logic zero, the digital() function will return true. Valid for
 digital ports 8-15.
disable_servos    [Category: Servos]
 Format: void disable_servos();
 Disables the servo motor ports (powers down all servo motors).
down_button    [Category: Sensors]
 Format: int down_button();
 Reads the value (0 or 1) of the move down button.
enable_servos    [Category: Servos]
 Format: void enable_servos();
 Enables all servo motor ports.
exp10    [Category: Math]
 Format: float exp10(float num);
 Returns 10 to the num power.
exp    [Category: Math]
 Format: float exp(float num);
 Returns e to the num power.
fd    [Category: Motors]
 Format: void fd(int m);
 Turns motor m on full in the forward direction. Example: fd(3);
freeze    [Category: Motors]
 Format: void freeze(int m);
 Freezes motor m (prevents continued motor rotation, in contrast to off, which 
 allows the motor to "coast").
get_motor_done    [Category: Motors]
 Format: int get_motor_done(int m);
 Returns whether the motor has finished a move with specified position.
get_motor_position_counter    [Category: Motors]
 Format: int get_motor_position_counter(int m);
 Returns the current motor position value for motor m (a value which is continually
 being updated for each motor using back EMF; a typical discrimination for a given
 motor is on the order of 1100 position "ticks" per rotation)
get_servo_position    [Category: Servos]
 Format: int get_servo_position(int srv);
 Returns the position value of the servo in port srv. The value is in the range 
 0 to 2047. There are 4 servo ports (0, 1, 2, 3).
kill_process    [Category: Processes]
 Format: void kill_process(int pid);
 Used to destroy processes. Processes are destroyed by passing their process ID 
 number to kill_process. If the return value is 0, then the process was destroyed.
 If the return value is 1, then the process was not found. The following code 
 shows the main process creating a check_sensor process, and then destroying it 
 one second later: int main() {
    int pid;
    pid = start_process(check_sensor);
    sleep(1.0);
    kill_process(pid);
    }

kissSimEnablePause    [Category: Simulator]
 Format: void kissSimEnablePause();
 Will pause the simulation if the space bar is pressed when this is called.

kissSimPause    [Category: Simulator]
 Format: void kissSimPause();
 Will pause the simulation when this is called. Press the space bar to resume.

left_button    [Category: Sensors]
 Format: int left_button();
 Reads the value (0 or 1) of the move left button.

log10    [Category: Math]
 Format: float log10(float num);
 Returns the logarithm of num to the base 10.
log    [Category: Math]
 Format: float log(float num);
 Returns the natural logarithm of num.

mav    [Category: Motors]
 Format: void mav(int m, int vel);
 This function is the same as move_at_velocity

motor    [Category: Motors]
 Format: void motor(int m, int p);
 Turns on motor m at scaled PWM duty cycle percentage  p. Power levels range 
 from 100 for full on forward to -100 for full on backward.

move_at_velocity    [Category: Motors]
 Format: void move_at_velocity(int m, int vel);
 Moves motor m at velocity vel indefinitely. The velocity range is 
 -1000 to 1000 ticks per second. 

move_relative_position    [Category: Motors]
 Format: void move_relative_position(int m, int speed, int pos);
 Moves motor m at velocity vel from its current position curr_pos to curr_pos + pos. The 
 speed range is 0 to 1000 ticks per second.
 Example:
 move_relative_position(1,275,-1100L);

move_to_position    [Category: Motors]
 Format: void move_to_position(int m, int speed, int pos);
 Moves motor m at velocity vel from its current position curr_pos to pos. The speed range
 is 0 to 1000. Note that if the motor is already at pos, the motor doesn't move.

mrp    [Category: Motors]
 Format: void mrp(int m, int vel, int pos);
 This function is the same as move_relative_position.

mtp   [Category: Motors]
 Format: void mtp(int m, int vel, int pos);
 This function is the same as move_to_position.

msleep    [Category: Time]
 Format: void msleep(int msec);
 Waits for an amount of time equal to or greater than msec milliseconds.
 Example:
 msleep(1500); /*wait for 1.5 seconds */ 

off    [Category: Motors]
Format: void off(int m);
Turns off motor m.
Example:
off(1);

power_level    [Category: Sensor]
 Format: float power_level();
 Returns the current power level in volts.

printf    [Category: Output]
 Format: void printf(char s[], . . .);
 Prints the contents of the string referenced by s to the cursor position on the screen.
 See the manual above for more details.

r_button    [Category: Sensors]
Format: int r_button();
Reads the value (0 or 1) of the R (shoulder) button.

random    [Category: Math]
 Format: int random(int m);
 Returns a random integer between 0 and some very large number.

right_button    [Category: Sensors]
 Format: int right_button();
 Reads the value (0 or 1) of the move right button.

run_for   [Category: Processes]
 Format: void run_for(float sec, void );
This function takes a function and runs it for a certain amount of time in seconds. 
 run_for will return within 1 second of your function exiting, if it exits before the
 specified time. The variable sec denotes how many seconds to run the given function.

seconds    [Category: Time]
 Format: float seconds();
 Returns the count of system time in seconds, as a floating point number. Resolution 
 is one millisecond.

set_analog_floats   [Category: Sensors]
 Format: void set_analog_floats(int mask);
 This function uses a number between 0 and 255 to set which port are to be set floating.

set_each_analog_state   [Category: Sensors]
 Format: void set_each_analog_state(int a0,int a1,int a2,int a3,int a4,int a5,int a6,int a7);
 This function is used to set whether or not the analog ports are set to floating points or
 to pullup resistors. Passing a 1 sets the corresponding port to floating. Please note that
 all sensor ports are set to non-floating when the CBC is rebooted or when a program exits.

set_digital_output_value   [Category: Output]
Format: void set_digital_output_value(int port, int value);
This function is used to set a digital port in output mode and then setting the line high or
 low. port can have the values 8-15 and value may be either 0 (low) or 1 (high). Polling the
 port with the digitial function will return that port to input mode.

set_pid_gains    [Category: Motors]
 Format: int set_pid_gains(int motor, int p, int i, int d, int pd, int id, int dd);
 This function is used to adjust the weights of the PID control for the motors. The p, i and
 d parameters are the numerators for the p, i and d coefficients. The pd, id & dd parameters
 are their respective denominators. Thus all of the parameters are integers, but the actual
 coefficients can be floats. If a motor is jerky, the p & d terms should be reduced in size.
 If a motor lags far behind, they should be increased. 
 The default values are 30,0,-30,70,1,51.

set_servo_position    [Category: Servos]
 Format: int set_servo_position(int srv, int pos);
 Sets the position value of the servo in port srv. The value of pos must be in the range
 0 to 2047.
 There are 4 servo ports (0, 1, 2, 3).

setpwm    [Category: Motors]
Format: int setpwm(int m, int dutycycle);
Runs motor m at duty cycle dutycycle (values -100 to 100)

sin    [Category: Math]
Format: float sin(float angle);
Returns the sine of angle. angle is specified in radians; result is in radians.

sleep    [Category: Time - not defined for the Link, use msleep]
 Format: void sleep(float sec);
 Waits for an amount of time equal to or slightly greater than sec seconds. sec is a
 float. Example:
 /*wait for 2 seconds */ sleep(2.0);

sonar    [Category: Sensors]
 Format: int sonar();
 Returns the approximate distance in mm.

sqrt    [Category: Math]
 Format: float sqrt(float num);
 Returns the square root of num.

start_process    [Category: Processes]
 Format: int start_process();
 The start_process function is used to start a process, which then runs in parallel
 with other active processes. The system keeps track of each running process by assigning
 a process ID number to it. start_process returns the process ID number for each process
 it starts. The process runs until it finishes or until it is terminated by kill_process.
 The following code shows the main process creating a check_sensor() process, and then
 destroying it one second later:
 int main()
 {
     int pid;
     pid=start_process(check_sensor);
     sleep(1.0);
     kill_process(pid);
 }

tan    [Category: Math]
 Format: float tan(float angle);
 Returns the tangent of angle. angle is specified in radians; result is a decimal number.

up_button    [Category: Sensors]
 Format: int up_button();
 Reads the value (0 or 1) of the move up button.

Create Library Functions

The Create library is automatically loaded whenever the CBC2 is chosen as the target.
 The functions which update sensor data, and the connection functions return the
 requested information if they are successful and return a number greater than100,000
 if there is some error. If an error is returned the error message is 100,000 + the
 Create Serial Interface Packet Number. For example a code of 100,007 indicates an
 error when requesting bumper or wheel drop sensor status. The functions starting
 "get_create_" all take a single floating point argument which indicates that the
 sensor data should be updated if it is older than the argument. In other words,
 calling get_create_lbump(0.1) indicates that if the sensor data is less than 1/10th
 of a seconds old, then the cached value will be returned, but if it is older then a
 new value from the Create will be returned and cached. Calling with an argument of 0
 will force a new value to be retrieved from the Create. Note that there is significant
 overhead in talking with the Create and so the lag times passed to these functions
 should not be smaller than needed. Values less than 0.05 should be avoided and larger
 times should be used for the angle and distance functions.

The movement function, with the exception of the script and block functions are all
 non-blocking. Movement functions (with the exception of create_stop()) only are sent
 to the Create if they represent a change from the previous movement command. For this
 reason, movement commands may be placed in tight loops without concern of overwhelming
 the serial connection. The Create's trajectory will continue until a different movement
 command is given. The script commands will execute without blocking and will finish when
 the goal is reached. The blocking spin function will not return until the goal has been
 reached.

The Create may also be used to play MIDI music. Up to sixteen 16 note songs may be loaded
 into the Create from the global variable matrix gc_song_array. 
See the Create Open Interface manual for details on note and duration codes.

create_connect    [Category: Create Function]
Format: int create_connect();
First step for connecting CBC to Create. Returns 0 if successful and a negative number if
not. This function puts the Create in the create_safe mode.

create_disconnect    [Category: Create Function]
Format: void create_disconnect();
Returns Create to proper state and resets XBC baud rate to KISS-C rate

create_start    [Category: Create Function]
Format: void create_start();
Puts Create into active mode (with motors)

create_passive    [Category: Create Function]
Format: void create_passive();
Puts Create into passive mode (no motors)

create_safe    [Category: Create Function]
Format: void create_safe();
Create will execute all commands, but will disconnect and stop if drop or cliff sensors fire.

create_full    [Category: Create Function]
Format: void create_full();
Create will move however you tell it -- even if that is a bad thing. In particular, the 
Create will not stop and disconnect, even if it is picked up or the cliff sensors fire.

create_spot    [Category: Create Function]
Format: void create_spot();
Simulates a Roomba doing a spot clean

create_cover    [Category: Create Function]
Format: void create_cover();
Simulates a Roomba covering a room

create_demo    [Category: Create Function]
Format: void create_demo(int d);
Runs built in demos (see Create OI)

create_cover_dock    [Category: Create Function]
Format: void create_cover_dock();
Create roams around until it sees an IR dock and then attmpts to dock

get_create_mode    [Category: Create Function]
Format: int get_create_mode(float lag);
Returns the Create's mode (0 off; 1 passive; 2 safe; 3 full). Data has been gathered within 
lag seconds.

get_create_lbump    [Category: Create Sensor Function]
Format: int get_create_lbump(float lag);
returns 1 if left bumper is pressed, 0 otherwise. Data has been gathered within lag seconds.

get_create_rbump    [Category: Create Sensor Function]
Format: int get_create_rbump(float lag);
returns 1 if right bumper is pressed, 0 otherwise. Data has been gathered within lag seconds.

get_create_lwdrop    [Category: Create Sensor Function]
Format: int get_create_lwdrop(float lag);
returns 1 if left wheel has dropped, 0 otherwise. Data has been gathered within lag seconds.

get_create_cwdrop    [Category: Create Sensor Function]
Format: int get_create_cwdrop(float lag);
returns 1 if caster wheel has dropped, 0 otherwise. Data has been gathered within lag seconds.

get_create_rwdrop    [Category: Create Sensor Function]
Format: int get_create_rlwdrop(float lag);
returns 1 if right wheel has dropped, 0 otherwise. Data has been gathered within lag seconds.

get_create_wall    [Category: Create Sensor Function]
Format: int get_create_wall(float lag);
returns 1 if wall is detected by right facing sensor, 0 otherwise. Data has been gathered
within lag seconds.

get_create_lcliff    [Category: Create Sensor Function]
Format: int get_create_lcliff(float lag);
returns 1 if left cliff sensor is over black or a cliff, 0 otherwise. Data has been gathered
within lag seconds.

get_create_lfcliff    [Category: Create Sensor Function]
Format: int get_create_lfcliff(float lag);
returns 1 if left front cliff sensor is over black or a cliff, 0 otherwise. Data has been
gathered within lag seconds.

get_create_rfcliff    [Category: Create Sensor Function]
Format: int get_create_rfcliff(float lag);
returns 1 if right frontcliff sensor is over black or a cliff, 0 otherwise. Data has been
gathered within lag seconds.

get_create_rcliff    [Category: Create Sensor Function]
Format: int get_create_rcliff(float lag);
returns 1 if right cliff sensor is over black or a cliff, 0 otherwise. Data has been gathered 
within lag seconds.

get_create_vwall    [Category: Create Sensor Function]
Format: int get_create_vwall(float lag);
returns 1 if a virtual wall beacon is detected, 0 otherwise. Data has been gathered within 
lag seconds.

get_create_overcurrents    [Category: Create Sensor Function]
Format: int get_create_overcurrents(float lag);
returns the overcurrent status byte where 16's bit indicates overcurrent in left wheel; 
8's bit in right wheel, 4's bit is LD2, 2's bit is LD0 and 1's bit is LD1. Data has been 
gathered within lag seconds.

get_create_infrared    [Category: Create Sensor Function]
Format: int get_create_infrared(float lag);
returns the byte detected from the remote control, 255 if no byte has been detected. Data 
has been gathered within lag seconds.

get_create_advance_button    [Category: Create Sensor Function]
Format: int get_create_advance_button(float lag);
returns 1 if advance button is being pressed, 0 otherwise. Data has been gathered within 
lag seconds.

get_create_play_button    [Category: Create Sensor Function]
Format: int get_create_play_button(float lag);
returns 1 if play button is being pressed, 0 otherwise. Data has been gathered within 
lag seconds.

get_create_distance    [Category: Create Sensor Function]
Format: int get_create_distance(float lag);
returns the accumulated distance the Create has traveled since it was turned on or the 
distance was set. Moving backwards reduces this value. The distance is in millimeters. 
The value is truncated to the nearest millimeter every time this function is updated 
so having the lag time be too small will cause an artificially small value. Suggested 
lag values are no smaller than 5/speed where speed is the Create's speed in mm/sec. 
Data has been gathered within lag seconds.

set_create_distance    [Category: Create Sensor Function]
Format: void set_create_distance(int dist);
Sets the current value that will be returned by get_create_distance to the value dist.

get_create_normalized_angle    [Category: Create Sensor Function]
Format: int get_create_normalized_angle(float lag);
returns the accumulated angle the Create has turned since it was turned on or the 
distance was set -- normalized to the range 0 to 359 degrees. Turning CCW increases this 
value and CW decreases the value. The value is truncated to the nearest degree every time 
this function is updated so having the lag time be too small will cause an artificially 
small value. Suggested lag values are no smaller than 10/(difference between left and 
right wheel speeds). Data has been gathered within lag seconds.

get_create_total_angle    [Category: Create Sensor Function]
Format: int get_create_total_angle(float lag);
returns the accumulated angle the Create has turned since it was turned on or the distance 
was set. Turning CCW increases this value and CW decreases the value. The value is truncated 
to the nearest degree every time this function is updated so having the lag time be too 
small will cause an artificially small value. Suggested lag values are no smaller than 
10/(difference between left and right wheel speeds). Data has been gathered within lag 
seconds.

set_create_normalized_angle    [Category: Create Sensor Function]
Format: void set_create_normalized_angle(int angle);
Sets the current value that will be returned by get_create_normalized_angle to the value 
angle.

set_create_total_angle    [Category: Create Sensor Function]
Format: void set_create_total_angle(int angle);
Sets the current value that will be returned by get_create_total_angle to the value angle.

get_create_battery_charging_state    [Category: Create Sensor Function]
Format: int get_create_charging_state(float lag);
Coded return: 0-not charging; 1-recondition charging; 2-full charging; 3-trickle charging; 
4-waiting; 5-charge fault. Data has been gathered within lag seconds.

get_create_battery_voltage    [Category: Create Sensor Function]
Format: int get_create_battery_voltage(float lag);
returns the battery voltage in mV. Data has been gathered within lag seconds.

get_create_battery_current    [Category: Create Sensor Function]
Format: int get_create_battery_current(float lag);
returns the current flow in mA. Data has been gathered within lag seconds.

get_create_battery_temp    [Category: Create Sensor Function]
Format: int get_create_battery_temp(float lag);
returns the battery temperature in degrees C. Data has been gathered within lag seconds.

get_create_battery_charge    [Category: Create Sensor Function]
Format: int get_create_battery_charge(float lag);
returns the battery charge in mAh. Data has been gathered within lag seconds.

get_create_battery_capacity    [Category: Create Sensor Function]
Format: int get_create_battery_capacity(float lag);
returns the battery capacity in mAh. Data has been gathered within lag seconds.

get_create_wall_amt    [Category: Create Sensor Function]
Format: int get_create_wall_amt(float lag);
returns 12 bit analog value from wall sensor. Data has been gathered within lag seconds.

get_create_lcliff_amt    [Category: Create Sensor Function]
Format: int get_create_lcliff_amt(float lag);
returns 12 bit analog value from left cliff sensor. Data has been gathered within 
lag seconds.

get_create_lfcliff_amt    [Category: Create Sensor Function]
Format: int get_create_lfcliff_amt(float lag);
returns 12 bit analog value from left front cliff sensor. Data has been gathered 
within lag seconds.

get_create_rfcliff_amt    [Category: Create Sensor Function]
Format: int get_create_rfcliff_amt(float lag);
returns 12 bit analog value from right frontcliff sensor. Data has been gathered 
within lag seconds.

get_create_rcliff_amt    [Category: Create Sensor Function]
Format: int get_create_rcliff_amt(float lag);
returns 12 bit analog value from right cliff sensor. Data has been gathered within 
lag seconds.

get_create_bay_DI    [Category: Create Sensor Function]
Format: int get_create_bay_DI(float lag);
returns byte containing all digital sensors from the cargo bay: 16'bit for pin 15, 
8's bit for pin 6, 4's bit for pin 18, 2's bit for pin 5 and 1's bit for pin 17. 
Data has been gathered within lag seconds.

get_create_bay_AI    [Category: Create Sensor Function]
Format: int get_create_bay_AI(float lag);
returns 10 bit analog value on pin 4 from the cargo bay. Data has been gathered within 
lag seconds.

get_create_song_number    [Category: Create Sensor Function]
Format: int get_create_song_number(float lag);
returns currently selected song 0-15. Data has been gathered within lag seconds.

get_create_song_playing    [Category: Create Sensor Function]
Format: int get_create_song_playing(float lag);
returns 1 if song is playing, 0 otherwise. Data has been gathered within lag seconds.

get_create_number_of_stream_packets    [Category: Create Sensor Function]
Format: int get_create_number_of_stream_packets(float lag);
if data streaming is being used, it returns the size of the stream. Data has been 
gathered within lag seconds.

get_create_requested_velocity    [Category: Create Sensor Function]
Format: int get_create_requested_velocity(float lag);
asks Create how fast it was told to be moving -500 to 500mm/s and returns that value. 
Data has been gathered within lag seconds.

get_create_requested_radius    [Category: Create Sensor Function]
Format: int get_create_requested_radius(float lag);
asks Create the size of its turning radius and returns that value. Data has been gathered 
within lag seconds.

get_create_requested_right_velocity    [Category: Create Sensor Function]
Format: int get_create_requested_right_velocity(float lag);
asks Create how fast it was told to be moving right wheel and returns that value. Data 
has been gathered within lag seconds.

get_create_requested_left_velocity    [Category: Create Sensor Function]
Format: int get_create_requested_left_velocity(float lag);
asks Create how fast it was told to be moving left wheel and returns that value. 
Data has been gathered within lag seconds.

create_stop    [Category: Create Movement Function]
Format: void create_stop();
Stops the drive wheels

create_drive    [Category: Create Movement Function]
Format: void create_drive(int speed, int radius);
Drives in an arc (see below for point turns and straight). Speed range for all commands 
is 20-500mm/s

create_drive_straight    [Category: Create Movement Function]
Format: void create_drive_straight(int speed);
Drives straight at speed in mm/s

create_spin_CW    [Category: Create Movement Function]
Format: void create_spin_CW(int speed);
spins Clockwise with edge speed of speed in mm/s

create_spin_CCW    [Category: Create Movement Function]
Format: void create_spin_CCW(int speed);
spins Counterclockwise with edge speed of speed in mm/s

create_drive_direct    [Category: Create Movement Function]
Format: void create_drive_direct(int r_speed, int l_speed);
Specifies individual left and right speeds in mm/s

create_advance_led    [Category: Create Function]
Format: void create_advance_led(int on);
Pass 1 to turn on light and 0 to turn it off

create_play_led    [Category: Create Function]
Format: void create_play_led(int on);
Pass 1 to turn on light and 0 to turn it off

create_power_led    [Category: Create Function]
Format: void create_power_led(int color, int brightness);
color 0 is red and 255 green; brightness 0 is off and 255 is full brightness

create_load_song    [Category: Create Function]
Format: void create_load_song(int num);
Picks a song from gc_song_array[16][33]. Each row is a song. First column of each song 
is number of notes (max is 16). Remaining columns alternate between pitch and duration. 
See Create OI for details.

create_play_song    [Category: Create Function]
Format: void create_play_song(int num);
Plays any of the songs that have been loaded

CBC Vision Library Functions

track_update    [Category: Vision API]
Format: void track_update();
Processes tracking data for a new frame and makes it available for retrieval by the 
track_property() calls bellow.

track_get_frame    [Category: Vision API]
Format: int track_get_frame();
Returns the frame number used to generate the tracking data.

track_count    [Category: Vision API]
Format: int track_count(int ch);
Returns the number of blobs available for the channel ch, which is a color channel 
numbered 0 through 3.

track_size    [Category: Vision API]
Format: int track_size(int ch, int i);
Returns the size of blob from channel ch (range 0-3), index i 
(range 0 to track_count(ch)-1) in pixels.

track_x    [Category: Vision API]
Format: int track_x(int ch, int i);
Returns the pixel x coordinate of the centroid for the blob from channel ch (range 0-3), 
index i (range 0 to track_count(ch)-1).

track_y    [Category: Vision API]
Format: int track_y(int ch, int i);
Returns the pixel y coordinate of the centroid for the blob from channel ch (range 0-3), 
index i (range 0 to track_count(ch)-1).

track_confidence    [Category: Vision API]
Format: int track_confidence(int ch, int i);
Returns the confidence for seeing the blob as a percentage of the blob pixel 
area/bounding box area (range 0-100, low numbers bad, high numbers good) for the blob 
from channel ch (range 0-3), index i (range 0 to track_count(ch)-1).

track_bbox_left    [Category: Vision API]
Format: int track_bbox_left(int ch, int i);
Returns the pixel x coordinate of the leftmost pixel for the blob from 
channel ch (range 0-3), index i (range 0 to track_count(ch)-1).

track_bbox_right    [Category: Vision API]
Format: int track_bbox_right(int ch, int i);
Returns the pixel x coordinate of the rightmost pixel for the blob from 
channel ch (range 0-3), index i (range 0 to track_count(ch)-1).

track_bbox_top    [Category: Vision API]
Format: int track_bbox_top(int ch, int i);
Returns the pixel y coordinate of the topmost pixel for the blob from 
channel ch (range 0-3), index i (range 0 to track_count(ch)-1).

track_bbox_bottom    [Category: Vision API]
Format: int track_bbox_bottom(int ch, int i);
Returns the pixel y coordinate of the bottommost pixel for the blob from 
channel ch (range 0-3), index i (range 0 to track_count(ch)-1).

track_bbox_width    [Category: Vision API]
Format: int track_bbox_width(int ch, int i);
Returns the pixel x width of the bounding box for the blob from 
channel ch (range 0-3), index i (range 0 to track_count(ch)-1). This is equivalent 
to track_bbox_right - track_bbox_left.

track_bbox_height    [Category: Vision API]
Format: int track_bbox_height(int ch, int i);
Returns the pixel y height of the bounding box for the blob from 
channel ch (range 0-3), index i (range 0 to track_count(ch)-1). This is equivalent 
to track_bbox_bottom - track_bbox_top.

track_angle    [Category: Vision API]
Format: int track_angle(int ch, int i);
Returns the angle in radians of the major axis for the blob from 
channel ch (range 0-3), index i (range 0 to track_count(ch)-1). Zero is horizontal 
and when the left end is higher than the right end the angle will be positive. 
The range is -PI/2 to +PI/2.

track_major_axis    [Category: Vision API]
Format: int track_major_axis(int ch, int i);
Returns the length in pixels of the major axis of the bounding ellipse for the blob 
from channel ch (range 0-3), index i (range 0 to track_count(ch)-1).

track_minor_axis    [Category: Vision API]
Format: int track_minor_axis(int ch, int i);
Returns the length in pixels of the minor axis of the bounding ellipse for the blob 
from channel ch (range 0-3), index i (range 0 to track_count(ch)-1).
Advertisements

One thought on “Library of Functions

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s