NTNU Norges teknisk-naturvitenskapelige universitet
  Fakultet for informasjonsteknologi, matematikk og elektroteknikk > Institutt for datateknikk og informasjonsvitenskap

How to use the Khepera robot

Installing

  • First of all you should read the manual (in pdf).
  • If you are using Solaris, here is what you should do to "talk" to the Khepera:
  • If you would like to program it in C, you should read this instruction
  • For more information see: Khepera FAQ
  • The home page of K-Team
  • Khepera on the Web
  • The m68331 processor
  • The specification of the light sensors (in pdf)
  • The specification of the m683xx processor (in pdf LARGE!!)

  • Using tip on Solaris

    First of all you should read the man file on tip!

    In the /etc/remote file you should write the following:

    For the 9600 baud: khepera-mode5:dv=/dev/cua/a:br#9600

    For the 38400 baud: khepera-mode6:dv=/dev/cua/a:br#38400

    The /dev/cua/a if the ttya (or com1 in DOS). If you are using the ttyb (or com2 in DOS), you should write /dev/cua/b.

    You should the be able to write tip khepera-mode5 (remember to set the jumpers on the Khepera correctly), and then press the reset button on the Khepera and it should answer something like this:

    ROM of minirobot KHEPERA, Edoardo Franzi K-Team October 31, 1995 Rev. 4.06


    Programming the Khepera in C (on Solaris)


    Getting gcc to work
    First of all you should read this instruction (in PostScript)

    First of all you should make sure that you have a proper make, and gcc, you can get a precomplied version at Sun's freeware. They work perfect.

    You should the install these using pkgadd.

    Then you should get binutils and gcc (at GNU), and the right package for the Khepera. Get the bios version on your Khepera (ver 4 in this example), go to ftp://lamiftp.epfl.ch/pub/khepera/gnuc/, and download the right package.

    You should the read the INSTALL file and follow that, and there should be no problems.


    This should be in your C file
    #include This is int include file for the Khepera

    int32 processID[i] This array keeps track of your functions

    void main() {

    bios_reset();
    tim_reset();
    mot_reset();
    sens_reset();
    msg_reset();
    var_reset();
    ser_reset();
    str_reset();
    You must reset all modules before they can be used

    processID[0]=tim_new_task(task1);
    processID[1]=tim_new_task(task2);
    This is for running your processes

    }

    Running your C program on the robot
    Now you should be able to run a program on your Khepera. type in your program, do a make, and if all goes well you should end up with a file called myprogram.s28 (if you have the version 4 of the ROM, if not it will possible be called myprogram.s"something else"

    Now type tip khepera-mode6, make sure that the jumpers are set correctly.

    Reset the robot, it should then say:

    ROM of minirobot KHEPERA, Edoardo Franzi K-Team October 31, 1995 Rev. 4.06
    S format Motorola loader mode

    Type ~>, and tip will say:

    ~>Local file name?

    Type in the name of your s file and hit return. Tip will then count upwards until the whole file is down loaded, and answer:

    514 lines transferred in 12 seconds
    !
    S: download terminated

    And something should happen!

    When you are finished playing type ~. and you will leave tip.


    Examples of C code

    Getting the LEDs to flash (download) #include <bios.h>

    int32 processID[1];

    void flash() {
    for(;;)
    {
    var_change_led(1);
    tim_suspend_task(1000);
    var_change_led(0);
    }
    }

    void main()
    {
    bios_reset();
    var_reset();
    processID[1]=tim_new_task(flash);
    }


    Getting the robot to move forward (download) #include <bios.h>

    int32 processID[1];

    void start() {
    mot_config_speed_1m(0,3500,800,100);
    mot_config_speed_1m(1,3500,800,100);
    mot_new_speed_1m(0,10);
    mot_new_speed_1m(1,10);
    exit(0);
    }

    void main()
    {
    bios_reset();
    var_reset();
    tim_reset();

    processID[1]=tim_new_task(start);
    }

    RedaktÝr: Kontorsjef: Eivind Voldhagen  Kontaktadresse: Anders Kofod-Petersen  Sist oppdatert: 01.01.1970