The kRobot© Class

Robert Harlan

Shelley McClarigan '00

Catherine Mellon '01

Brian Zimmel '02

Copyright 2000, 2001

 

Khepera robot in tethered mode. The tether to the robot can be seen running from the serial port on the right hand side of the Sun workstation.

The kRobot Class is an interface for Khepera robots developed at the Bonaventure Robotics Laboratory. The class encapsulates functions for controlling an autonomous robot. These functions can be used to implement higher level behavior control algorithms for experimentation in different environments.

    The most common mode for working with a Khepera robot is the tethered mode. A program to control the robot is developed on a host computer and run on that computer. The robot runs a program that enables it to read its sensors and send that information back to the host and to execute actuator commands from the host computer.

Communication between the host computer and the robot is done using a serial communications protocol called SerCom. Commands and request for information are issued to the robot as strings; responses are sent back as strings.

Abstract representation of the tethered mode. The control program runs on a workstation. It can query the sensors of the robot and send commands to its effectors.

Our first goal in preparing to use the Khepera platform in a robotics course was to hide this low-level communication and to develop a clean, intuitive interface for the Khepera robot that would enable students to focus on developing behavior control algorithms. We constructed an interface using two logical objects: the robot, with all of the functions needed to monitor and manage its behavior, and the serial communications pipeline through which communication between the robot and the host computer takes place.

The kRobot class provides the interface for a robot object. It supplies all of the functions required to monitor and manage the behavior of a robot. For example, moveForward(),  turnLeft() and stop() functions do what one would expect. getLeftWheelSpeed() obtains the rate of rotation of the robot’s left motor and setWheelSpeed(100, -100) sets the speed of the left and right motors.  verboseOn() and verboseOff() enable developers to monitor low-level communications between the remote computer and the robot.

The kRobot constructor function creates an instance of the serial class, which provides for communication between the robot and its host computer.  The low-level details of opening and closing a serial connection are hidden here and are accessed through the kRobot openConnection() and closeConnection() functions. The Talk() function of the serial class manages communication between the robot and the remote computer.  These functions will also inform the user is communication with the robot failed and return a Boolean value of false so that methods that use these functions may include error prevention. A complete listing of the functions in the Serial class can be found here.

The serial and kRobot classes provide a much better interface for the Khepera robot than the SerCom interface. For example, to get the proximity value of infrared sensor four using the SerCom method, one must:

 

 

      Completing the same task using the kRobot and serial classes is is accomplished by sending three messages to a kRobot object: 

 

A complete list and description of all the methods and data of the kRobot class can be found here.

 

kRobot version 3.2 is the most recent version of the kRobotClass. It is distributed through SourceForge.  Click here  to download all files necessary for using the class.. Details for installation are given in the README file

An article discussing the class and how we use in in our courses was published in the 32nd SIGCSE Technical Symposium on Computer Science Education, February, 200. Click here to download the article (pdf format).

Back to Robotics Page

Back to the Computer Science Home Page

Last update: 9/2004