For the robotics project, a number of robot control rules and functions have been integrated into CLIPS to permit to remotely control a Lego Mindstorms robot.
A number of programs are provided in the /home/public/Project directory of the computers in the course laboratory.
xclips: the extended version of the graphical interface to CLIPS. You will have to use this version to use the robots.
lnpd: a communications deamon that establishes the connection between the PC and the robot. This has to be run from this directory using lnpd -d
firmdl3: a utility to download the operating system to the robot. lnpd must not be running when using firmdl3
legOS.srec: the operating system for the robot. This has to be loaded onto the robot using firmdl3 legOS.srec
dll: a utility to download programs to the robot. This permits to download programs to the robot. lnpd must not be running when using dll
remote_robot.lx: the program for remote control of the robot from CLIPS. This has to be loaded onto the robot using dll remote_robot.lx
To run the robot, the software has to be loaded onto the robot first using firmdl3 legOS.srec followed by dll remote_robot.lx . Loading of software as well as communication happens using infrared communications between the IR tower connected to the PC and the robot. It is importand that throughout the IR tower has to face the robot's IR port to facilitate the exchange of information. This might require moving the IR tower while the robot is running. The robot and the CLIPS simulation will not operate when there is no IR connection between the PC and the robot.
Once the robot software is loaded, it will stay on the robot until the batteries are replaced. Turning off the robot will not remove the software. To start the program on the robot, turn it on and press the Start button. To stop the program, press the Prgrm button on the robot. While the program is running it will always display the type of the last remote control command that it received (data, move, turn). To complete the the communication between the PC and the robot, the lnpd deamon has to be run on the PC using lnpd -d . You have to make sure that only one instance of lnpd is running on the computer at any time.
The remote control functionality integrated into CLIPS provides three basic functions and three rules to control the robot.
Functions:
get_robot_data n: this queries for the status of the nth sensor on the robot. E.g. (get_robot_data 0) returns the encoder count of the left encoder. The sensors are: 0 = left encoder, 1 = right encoder, 2 = light sensor
send_robot_turn d: this sends a turn command to the robot causing it to turn for |d*10| milliseconds. d is an integer between -255 and 255, where the sign indicates the direction of the turn.
send_robot_move d: this sends a move command to the robot causing it to move for |d*10| milliseconds. d is an integer between -255 and 255, where the sign indicates the direction of the move.
Rules:
move-robot: this rule fires if a fact (move-robot d) exists and moves the robot by |d*10| milliseconds in the direction sign(d).
turn-robot: this rule fires if the fact (turn-robot d) exists and turns the robot by |d*10| milliseconds in the direction sign(d).
read-robot-sensors: this rule fires if the fact (read-robot) exists and reads the three sensors from the robot and stores them in the fact (robot-sens s0 s1 s2)
These provide the ability to set up CLIPS rules that track and control the robot.