0% found this document useful (0 votes)
121 views6 pages

VIPALC - Controlling A Mobile Robot With Visual Prolog

This document summarizes a project to control a mobile robot using Visual Prolog. The robot has sensors to detect its environment and effectors to move and signal. It can operate independently using reflexes, or take commands from a Prolog program on a computer. The system divides control into low-level reflexes run on the robot, and high-level planning on the computer. Communication uses a simple protocol over RS-232. Example rules and interactions are provided to demonstrate how the robot can explore and respond to its environment under computer guidance or on its own.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
121 views6 pages

VIPALC - Controlling A Mobile Robot With Visual Prolog

This document summarizes a project to control a mobile robot using Visual Prolog. The robot has sensors to detect its environment and effectors to move and signal. It can operate independently using reflexes, or take commands from a Prolog program on a computer. The system divides control into low-level reflexes run on the robot, and high-level planning on the computer. Communication uses a simple protocol over RS-232. Example rules and interactions are provided to demonstrate how the robot can explore and respond to its environment under computer guidance or on its own.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 6

Controlling a Mobile Robot with Visual Prolog

Tatyana Volkova
Russian State University for the Humanities, Intelligent Systems Department, and
Robotics and Artificial Intelligence Laboratory of the State Polytechnic Museum,
Moscow
Abstract. This work describes one simple model of mobile robot behavior. It
demonstrates one of possible ways of using a communication RS-232 program
written by Ben Hooijenga. This robot was created at the Robotics and Artificial
Intelligence Laboratory of the State Polytechnic Museum.
Introduction

Architecture of the system

This paper describes a practical realization


of a simple declarative model for
controlling a technical object a mobile
robot, which was built at the Robotics and
Artificial Intelligence Laboratory of the
State Polytechnic Museum under Technics
PhD Valery Karpov and Technics PhD
Dmitry
Dobrynin.
Students
and
schoolchildren develop and program their
own robots there. As an AI student I
participate in this laboratory and would like
to present my first robot (see Fig.1)

The model of the robots behavior is similar


to the behavior of a living creature.
The system can be divided into the lowlevel actions, which are processed by the
robot himself, and the high-level actions,
which are suggested by a Prolog program
on a stationary computer.

Figure 1. Robots receptors and effectors

Low-level actions include: unconditional


reflexes (evading an obstacle, getting
frightened by a sudden light, following the
path on the floor, following an IR emitter,
defining whether he is at home (home is a
grey spot on the floor)), simple actions
(lighting a LED, crying), decomposition of
high-level commands to low-level ones. All
low-level actions are programmed into the
robots microcomputer on C language.
High-level commands are planning,
guiding, database maintaining and the
world map building. See Fig.2.

randomly,
only
reacting
to
the
environmental exposure with his reflexes.
When the computer takes control, robot
becomes passive and obeys the computer.
The advantage of such system is that even
in the case of a mistake or a controversial
command from computer, robot can still
evade dangerous situations because of
unconditional reflexes.
Combination of simple low-level reflexes
and
complex
high-level
command
sequences gives us the model of a living
organism. The idea of hierarchy in control
systems is quite old, but not widely spread
in
robotics.
Among
the
latest
implementations, [Karpov, 2007] must be
noted.
The structure of the robot

Figure 2. Two levels of robots control


If robot doesnt receive any message from
the computer during several seconds, he
considers himself lost and wanders

The robot is an autonomous mobile device,


driven by a microcontroller, which has
clock rate 7 MHz and flash memory of 8
Kb, which is not enough for a complex
program.
See the overall scheme of the system on
Fig.3

Figure 3. The model of the system (adopted from [Gaaze-Rapoport 1987])

Robot has different sensors (receptors):


environment illumination sensor, infrared
receivers (eyes), infrared obstacles
sensors, line photo sensors; effectors, which
influence the environment: motors, lightemitting diode, sound dynamic.

next, and answers with a command,


typically, of one byte. See the scheme on
Fig. 4

Robot sends information about his


movements, obtained by encoders on both
driving wheels, so we can know the length
of movement vector and its angle relatively
to the robots starting position. Changing
polar coordinates to Cartesian, computer
tries to draw robots position on the map
and assert the coordinates of all significant
objects to the database to use them later for
navigation.
Communication program

Figure 4. Example of communication

To establish a connection with robot, a


terminal program on Visual Prolog is
required. Ben Hooijenga wrote such
program under VIP 7.1 CE, its available on
PDC forum and on Visual Prolog Wiki.

A fragment of the protocol on computers


side

The program is easy to apply and has a


convenient GUI for setting all the
parameters. The program makes it possible
to send and receive bytes via RS-232
interface and process communicstion
events. A declarative system for the robot
was added to this program.
To make a communications channel
between robot and computer, a protocol was
developed.
Description of the protocol
To avoid synchronization problems, a firm
scheme involving timer was specified.
Each 100 milliseconds a communication act
takes place. Computer sends a command of
sensors polling, encoded with one byte.
Robot receives it and answers with two
bytes, first of which is the robots state and
information about his movements. Second
byte represents signals on robots sensors.
Computer decides what robot should do

Here is the code of timer interruption, in


which communication between robot and
computer takes place.
% timer routine on each 100 milliseconds
predicates
onTimer : window::timerListener.
clauses
onTimer(_Source, _timer):% start communication
send("TELL_ME_YOUR_STATE"),
% get an answer from the robot about his
state and movements
readStateAndMovements(),
% get signals on sensors
readSensors(),
% If autocontrol (base of rules)
is on
if auto_control=true() then
% get a command using a rule from base
(rule(CommandToRobot),
% send the command
send(CommandToRobot),
fail; % backtrack to try all the rules
succeed())
end if,
% repaint the map on the screen
refresh_map().

All the read predicates have similar


structure. For example, below is a predicate
which receives the 2nd byte from the robot
(a Boolean vector of signals on sensors) and
decodes it, making a map.
predicates
readSensors: ().
clauses
readSensors():-%Create a binary massive
1 byte length
BinaryRead = binary::create(1),
% Read 1 byte (predicate for comdevice,
written by Ben Hooijenga)
BytesRead =
comdevice:readfile_overlapped(
BinaryRead,
binary::getSize(BinaryRead)),
%convert binary to a list of bits
SensorsList = bit::bitSplit(
binary::getIndexed_unsigned8(
BinaryRead, 0)),
foreach
Bit = list::getMember_nd(
SensorsList)
do
% decode the signals and assert the info
into database
if decodeSensorsSignals(Bit,
Object), ! then
% add an object, detected by sensors, to
the world model
placeOnTheMap(Object)
end if
end foreach.
Decoding the sensor signals simply means
interpretation according to the bases of
facts which are written in both robots and
computers memory.
Here is a fragment of such a base of facts.
class facts
decodeSensorsSignals: (unsigned8, string
ObjectType).
clauses
decodeSensorsSignals(128, "home").
decodeSensorsSignals(64, "line").
decodeSensorsSignals(32, "light").
And heres a fragment of base, from which
commands to the robot are encoded:
% Base of facts - commands to the robot

class facts
command: (unsigned8, string).
clauses
command(0x10, "STOP ").
command(0x20,
"TELL_ME_YOUR_STATE ").
command(0x30, "GO_FORWARD ").
The base of rules
The base contains rules such as:

predicates
rule: (string Command)
nondeterm (o).
clauses
% If you are frightened and see an
obstacle, turn the LED on to frighten a
possible enemy
rule("SWITCH_LED_ON_TEMP "):state("Frightened"),
obstacle_sensor_active("FarIRSensor").
% If you are at home, turn your LED on
(rejoice) and wait one second (have a rest)
rule("SWITCH_LED_ON_TEMP "):state("AtHome").
rule("WAIT_ONE_SECOND"):state("AtHome").
%
If you are still at home - go and look for lin
e
rule("LOOK_FOR_LINE "):state("AtHome").
An example of interaction between robot
and computer (see Fig. 5)
After being turned on, robot is moving
around for some time to adjust his sensors.
In the initial state robot moves randomly,
until the computer tells him to look for the
line. Having found the line, robot starts to
follow it.
If a bright flash of light frightens robot, he
cries and panics, moving around
randomly, till the computer orders him to
turn LED on and follow towards the
lighthouse (the lighthouse stands in the
middle of home).
Robot looks for the lighthouse and goes
towards it, checking if he is already at
home. If robot reaches home, a command
from computer tells him to return to the
line.

% from the computer

Figure 5. The model of robots behavior. Red transitions can only be made after a
computers command and they do not contain in robots memory.
Plans
Now we are working on next projects.
Among our projects are continuation of
work on museum robot-excursion guide and
building more complicated robots. My
second robot will be a robot-navigator.
References
[Gaaze-Rapoport, 1987] Gaaze-Rapoport M.G., Pospelov D.A. From ameba to robot: models of
behavior. M.: Nauka, 1987 [In Russian]
[Karpov, 2007] Karpov V.E.. Imprinting and central motoric programs in robotics //IV
International theoretical and practical conference "Integrated models and soft computing in
artificial intelligence (28-30 may 2007). Conference proceedings. M.: Fizmatlit, 2007, 1, p.322332 [In Russian]
Dobrynin D.A., Karpov V.E. Modeling some adaptive behavior forms of intellectual robots.
//Information technologies and computing systems 2, 2006, p.45-56 [In Russian]

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy