next up previous contents index
Next: The Robot Up: Programming a Robot Controller Previous: Programming a Robot Controller

The User-Defined Controller Structure

     

A robot controller consist in a set of functions that are compiled and linked with the rest of the simulator objects. The most important of these functions is the usr_step that, when the robot is running, is called at each time slice. This function should implement the control rule for the robot, or what is the same, give a set of low level commands to be executed next. Observe that the effects of these low level commands are not observable until they are actually executed and this happens just after the usr_step routine concludes.

Each robot controller is contained in a private directory. This directory must contain a header file (user.h), a program file (user.c), and a compilation rule file named dependencies that enumerates the modules used by user.c. The program file user.c must define at least the following set of functions:

All these function receive as a parameter a robot object (the one to be controlled) and a   user definable type t_user that can be useful to store parameters or the state of the controller in a given time slice. This type is defined in user.h and   the functions to manipulate it should be provided by the user in the program file user.c.  The functions to manipulate the robot object are detailed in section 3.2.

The user_skel directory provides an empty controller that can be useful as a base to fill in when a new controller wants to be defined. 

To compile a new controller you can use:

compile directory_name 
where directory_name is the name of the directory containing the controller to be compiled.

To run the simulator with the currently included controller just type

sim 

next up previous contents index
Next: The Robot Up: Programming a Robot Controller Previous: Programming a Robot Controller
Josep M. Porta Pleite
8/2/2000