Koala II

Introduction Specifications Packs Software Manuals / Downloads Distributors


GNU C Environment and KTProject

GNU C Cross Compiler

The GNU C cross-compiler lets you generate code that can be executed directly on-board the Khepera and Koala, freeing you from the constraints of the ASCII protocol and serial cables.

The cross-compiler package provides a library of all the low-level functions available in the K-Team BIOS including motor control, sensor reading, communication, and multi-tasking management.

In addition libraries are provided for all the K-Team extension turrets, letting you control all your favorite turrets like the gripper, radio, etc.

The cross-compiler provides a full C programming environment, and lets you create programs as simple or as powerful as you wish.

Here is a simple example to create a Braitenberg vehicle, by reading the sensors, calculating appropriate speeds, and then issuing the commands to the motors to control the robot:

/* K-Team Braitenberg demo for Khepera   copyright Skye Legon, K-Team SA, 2001 */

int main(){
	int i, sensor[6], delta, speed[2];
	printf("  S0   S1   S2   S3   S4   S5 Delta   L   R  ");
	while (TRUE)  {
	/* read front 6 sensors */
	for (i=0; i<6; i++)    {
	sensor[i] = sens_get_reflected_value(i);
	printf("%4d ", sensor[i]);
	/* calculate speed adjustments based on sensors */
	delta = 0;
	for (i=0; i<3; i++)
	  delta += sensor[i];
	for (i=3; i<6; i++)
	  delta -= sensor[i];
	delta = delta/50;
	printf("%5d ", delta);
	/* set motor speeds (right, left) */
	speed[0] = 20 + delta;
	speed[1] = 20 - delta;
	printf("%3d %3d  ", speed[0], speed[1]);
	mot_new_speed_2m(speed[1], speed[0]);
return 0;

This program can now be compiled for the Khepera or Koala processors, transformed into Motorola S format, downloaded to the robot using a terminal program, and then executed. This approach allows for fast, self-contained code running on-board the robot, but has a slight disadvantage for development in that there is no debugger, and every modification requires repeating this compile and download process. We therefore recommend the cross-compiler for advanced users, while beginners may find the SerCom protocol easier to use and to debug.


To ease use of the GNU C compiler under Windows, we propose KTProject, a graphical C development environment for Windows. With KTProject you can develop C code for Khepera, Koala and Kameleon from a graphical interface instead of a big, scary command prompt.

KTProject includes the GNU C compiler, the Cygwin Environment (copyright RedHat Inc.), Source Navigator (copyright RedHat Inc.) and KTDebug, a serial port terminal written in Java (copyright J-M Koller).

KTProject is still in beta, but can be downloaded for free here (24Mb, Windows 95/98/M/NT/XP, Self Executable). This is the complete package and does not require anything else to run. Any comments you may have to help us improve KTProject are welcome!

Source code for the KTProject launcher is written in Borland C++ Builder 3.0 (click here to download it).

Find your local distributor.

K-Team Serial Protocol for Remote Operation

All K-Team robots can be remotely operated using a standard ASCII Serial Protocol. Using a RS232 cable or a wireless connection, the robots can receive orders formatted as ASCII strings and send back some results if required. The robot can be completely operated using this protocol as commands are available to control the motors, read the sensors, communicate with extensions and setup all the robot parameters.

For instance, to read the robot proximity sensors, the "N" string should be sent and the robot will answer sending: "n,123,124,234,12,34,36" where each number is a sensor reading.

With this mechanism, the robots can be controlled, from a remote computer, using any software able to communicate with a serial port. K-Team provides several libraries and example code to communicate with the robots from a Visual C++ program, from Matlab, from Labview, or from a Linux C program....

Remote Operation Program

A remote operation program can be written using almost any programming language. K-Team provides example code in C/C++ for Linux environement and windows using Visual Studio, these examples are available in the download section. Many other examples and implementation of the protocol are available from various K-Team partners and users, please visit our Freeware section for more details. Please do not hesitate to contact us if you would like your own implementation to be added on the list...

Matlab Plugins

Thanks to the serial protocol operation, all of our products (robots, boards) can be controlled directly from MATLAB® via an RS232 cable or wireless link. MATLAB® is well-known software produced by The MathWorks, Inc. that allows powerful computation and visualisation of scientific data. K-Team provides MATLAB® modules to access the robot functionalities via an RS232 serial cable using K-Team's SerCom communication protocol. These modules are available as a free download for both MAC and PC.

For truly interactive graphics controler K-Team suggests the MATLAB®-inspired program SysQuake. Using a syntax similar to MATLAB®, SysQuake permits real-time interactive graphic manipulation to control and analyse your system.

LabView Plugins

Thanks to the serial protocol operation, all of our products (robots, boards) can be controlled directly from LabVIEW® via an RS232 cable or a wireless link. We provide VIs for all of the functionalities supported by our hardware. They are available as a free download for both MAC and PC.

LabVIEW® is well-known software written by National Instruments. It is designed for use with industrial and research instrumentation and has very powerful visualisation capabilities. Moreover, it is designed to be connected to real-world devices and deal with real time constraints. The graphical user interface makes programming with LabVIEW® easy even for non-engineers. These features make LabVIEW® very useful software for controlling and analysing mobile robots.

LabVIEW® runs on your computer (K-Team supports MAC, Windows and UNIX on SUN) and communicates with the robot or board via an RS232 serial cable using K-Team's SerCom communication protocol.

LabVIEW® is a great tool for creating a nice interface to control the motors in just a couple of minutes:

Similarly, a small graphical representation of the sensor activity of Khepera can be quickly created

LabVIEW® is programmed graphically as shown in this little example of obstacle avoidance behaviour based on direct connections between motors and sensors