Basic activities with the Boe

Transcription

Basic activities with the Boe
BASIC ACTIVITIES WITH THE BOE-BOT MOBILE ROBOT
Richard Balogh
Institute of Control and Industrial Informatics FEI, Slovak University of Technology in Bratislava,
e-mail: [email protected]
Abstract
Mobilný robot Boe-Bot je komerčne dostupná stavebnica firmy Parallax. Predstavı́me jeho základné
vlastnosti, ktoré umožňujú vel’mi jednoduché a rýchle uvedenie do robotiky. Predvedieme niekol’ko
prı́kladov programovania a použı́vania i jeho jednoduché rozširovanie. Zmienime sa o možnosti náhrady v hobby, či amatérskom prevedenı́. Po prednáške bude nasledovat’ cca dvojhodinový workshop, na
ktorom si účastnı́ci vyskúšajú jeho programovanie, vyriešia jednoduché úlohy a malý projekt.
Keywords: mobile robot, sensors, servo, education.
1
BoeBot mobile robot
The BoeBot mobile robot [1] is a commercially
available robotics kit (see Fig. 1) by the Parallax,
Inc. company. It consists of two geared motors
mounted on an aluminium chassis, batteries and
control electronics. On the motors are mounted
two plastic wheels. The rear wheel is made of
a drilled polyethylene ball. Mounting holes and
slots may be used to add custom robotic equipment.
Figure 2: Board of Education.
This platform is quite intuitive for beginners, but
has enough potential to keep more advanced students and hobbyists interested. The kit includes
everything you need to make a functional, educational and entertaining mobile robot. No previous
robotics, electronics or programming experience
is necessary.
Figure 1: The Boe-Bot mobile robot.
The robot is controlled by the Parallax’s popular microcontroller Basic Stamp II and the Board
of Education (see Fig. 2). It is a simple board
containing a processor, power supply circuits, interfaces, connectors and a small experimental solderless breadboard.
The Basic Stamp II processor can be programmed
with the PBASIC language [2] – simple, but powerfull clone of the Basic language with the support
of many specific peripheral devices. The code is
developed within the free integrated development
environment Basic Stamp Windows Editor, which
contains also the code downloader and the communication terminal (Fig. 3).
Figure 3: Basic stamp Editor and development
tools.
The kit is supplied with a comprehensive textbook Robotics with the Boe-Bot [1]. The textbook includes more than 40 different activities
for the Boe-Bot robot with the PBasic source
code. Each chapter contains the exercises and
challenges with solutions. The activities start
with the basic movements and proceeds to sensorbased projects. Students quickly learn how the
Boe-Bot is expandable for many different robotic
projects.
The Student Guide contains eight chapters concentrated on different topics of robotics:
1.
2.
3.
4.
5.
6.
7.
8.
Your Boe-Bot’s Brain,
Your Boe-Bot’s Servo Motors,
Assemble and Test Your Boe-Bot,
Boe-Bot Navigation,
Tactile Navigation with Whiskers,
Light Sensitive Navigation,
Navigating with Infrared Headlights and
Robot Control with Distance Detection.
They cover all necessary tasks which are required
for each autonomous mobile robot to perform
even the simplest actions:
1.
2.
3.
4.
the ability to control the I/O lines,
reading the values from the sensors,
the data processing,
movement control (based on previously processed data) and
5. the communication and debugging.
Let’s show some simple examples of the previously mentioned tasks.
2
Control of inputs and outputs.
The processor contains 16 general purpose pins,
which can be freely configured as inputs or outputs. Below is a short program for the LED diode
connected to the pin 14 controlled by the switch
connected to the pin 3. The circuit is built on the
solderless breadboard according to the schematics
in the Fig. 4.
Led PIN 14
Switch PIN 3
’ Connected to pin 14
’ Connected to pin 3
OUTPUT Led
INPUT Switch
’ Direction of the I / O
’ Direction of the I / O
Main :
IF Switch = 1 THEN
HIGH Led
’ LED On
ELSE
LOW Led
’ LED Off
ENDIF
GOTO Main
’ Endless loop
Figure 4: Schematic diagram [1].
3
Servo motor control
Servos (shown in the left in the Figure 5) are DC
motors with built-in gears and feedback control
loop circuitry. The motors are small, compact
and rugged. Most of them can rotate and hold
a position between 90 and 180 degrees. Their
precise positioning makes them ideal for radio
controlled planes, cars, puppets, and, of course,
robots.
Modified, or continuous rotation servos receive the
same electronic signals, but instead of holding
certain positions, they turn with certain speeds
and directions.
The servos are connected using two power supply (4,8 – 6 V) and one signal wires, no further
motor drivers are required. The servo electronics
is controlled by a pulse-width modulated (PWM)
signal. Pulses repeats each 20 ms, whilst its width
controls the speed of the servo.
The continuous rotation servo turns with full
speed clockwise when you send it 1,3 ms pulses,
1,7 ms pulses will make the servo turn with
full speed counterclockwise. The servo will be
stopped with 1,5 ms pulses.
Figure 5: The DC servo and its connection diagram.
Below is the PBasic code that shows the basic
use of the servo motor control. Pulsing of the
servo’s signal line with the Basic Stamp processor is done with the PULSOUT command. The
command ’PULSOUT 13, 750’ sends to the pin
13 a pulse that lasts 750 × 2µs, that’s 1500 µs
or 1,5 ms. This value stops the movement of the
shaft. We can control the speed of the motor by
adding or substracting values up to 250 from the
center (750) position. Note that the left motor
should rotate in oposite direction with respect to
the right motor if required direction of the movement is forward, because the motors are mounted
in a mirrored position.
’ ---- [ Subroutine Forward ] -----Forward :
FOR pulseCount = 1
PULSOUT 13 , 650
PULSOUT 12 , 850
PAUSE 17
NEXT
RETURN
TO 50
’ 1.3 ms pulse
’ 1.7 ms pulse
’ Pause 17 ms
’ Return to Main
’ One cycle : 1.3 + 1.7 + 17 = 20 ms .
’ The whole routine will move robot
’
50 x 20 = 1000 ms = 1 second .
4
Sensors reading
Digital sensors are simply connected to some of
the I/O pins and their outputs are directly readable using the IN command. Analog sensors can
be read using an external A/D converter (see an
example). Resistive or capacitive sensors can be
connected directly to the digital I/O pins and
their value is calculated from the measured RC
time constant. Also the sensors with PWM or
time varying outputs can be read directly. The
following program shows an example how to read
the state of the digital sensor (bumper) and the
analog distance sensor using the ADC.
IF ( Bumper = 1) THEN
STOP
ELSE
GOSUB Forward
ENDIF
GOSUB GetDist
Figure 6: The Boe-Bot robot with the bumper and
distance sensor.
5
Simple communication - user interface
Another important issue, especially during the
debugging phase, is a communication with the
user. One possibility is to use the serial communication interface RS-232 and the PC with
the terminal program running. Another approach
uses an added LCD display placed directly on the
robot.
Bidirectional serial communication is also supported in PBasic. The following program uses the
DEBUG command to write some texts and values
of the variables on the communication console.
’ text string
DEBUG "I ’ m running ...
" , CR
’ decimal value
DEBUG " Value : x = " , DEC
x , CR
’ binary value
DEBUG " State P7 : " , BIN1 IN7 , CR
’ delay 3 s
PAUSE 3000
’ the text again
DEBUG " Press button to finish ... "
’ Read ADC value
IF ( Res < 100) THEN
STOP
ELSE
GOSUB Forward
ENDIF
GetDist :
LOW CS
’ activate the ADC0831
SHIFTIN Data , Clk , MSBPOST , [ Res \9]
HIGH CS
’ deactivate ADC0831
RETURN
Figure 7: Output of the program.
6
Alternatives
In this section we briefly mention alternatives for
those who want to change the programming language of the robot, or simply to use another hardware platform.
The hardware
The BoeBot robot in fact consists of two continuous rotation servos (available from any hobby
shop), battery holder and mechanical chassis.
That makes possible to replace each mechanical
part of the robot with own piece of hardware. One
example of it is an omnidrive robot with three
omnidirectional wheels based on the triangular
chassis [7].
Electronics
Also in this area some alternatives exist. It is possible to easily replace the BasicStamp processor
with the previously mentioned Javelin processor.
For those, who don’t like the price of the Basic
Stamp II chip, there are an alternative PicAXE
processors [4], available from many local distributors.
Yet another alternative is to use a completely different electronic control unit, based on the personal preferences. Very popular microcontrollers
are those of the Microchip PIC family, Freescale
HC family or Atmel AVR family. The latest is
also the base for an open source Arduino board
[5], which comes with a built-in serial downloader and an integrated development environment which tries to mimic the BasicStamp’s easy
of use in the C programming language. The Atmel AVR processor is also the base of the educational platform MiniMEXLE [6] created at the
University of Heilbronn, Germany. An example
of using this platform for the robot control is
the robot MexleBoy which participated on the
Robotchallenge championship in Wienna. The
same robot with the BasicStamp controller participated a year ago.
7
Figure 8: Omnidirectional Robot Hugo [7].
Still it is possible to use all of the previous mentioned features, using the standard Board of Education by the Parallax, or simply the BasicStamp
chip itself.
Software
Conclusions
Even with such a simple robot it is possible to do
really impressive amount of work in a robotics introductory course. Students are always impressed
with amount of influencing factors determining
precise movement of the robot. An advanced example of possibilities of the robot is the implementation of the simple genetic algorithm for the
path learning [9].
As previously mentioned, for those who like a
Java programming, there is a special Javelin processor [3] available. This is a BasicStamp pin
compatible processor which can be programmed
in a simple subset of Java language.
Another approach, presented e.g in [8], is a robot
remotely connected using the Bluetooth or another radio connection to a standard PC. The
robot only responds to the commands sent from
the master computer. The control program can
be written in the high-level language of your preferred choice. The robot in [8] is equipped with a
wireless camera and a radio connection with the
computer. A control program in Java perform
all the necessary image processing. After the object localization it sent some move commands to
follow the object - small white ball. All the necessary computations were performed on the standard PC, the robot just received basic movement
commands.
Figure 9: Teaching with robots is fun.
The robot is also very useful platform for different kinds of robot competitions [10] which is very
motivational type of education.
The real robot available for immediate evaluation
of students results is very motivational and such
method of teaching can be only recommended
based on our experiences.
8
Acknowledgements
This work was supported by the project of the
Slovak Research and Development Agency LPP0301-06 Istrobot – Education and Propagation of
the Robotics. Publication and presentation of
this paper has been also supported by the VEGA
Project 1/3089/06 Development and Integration
of Methods of the Nonlinear System Theory.
References
[1] Lindsay, Andy: Robotics with the Boe-Bot.
Student guide. Version 2.2, Parallax, Inc.,
Rocklin, California, 2004. ISBN 1-928982-034. Available on-line: http://www.parallax.
com/
[2] Martin, Jeff et al.: BASIC Stamp Syntax and
Reference Manual, Version 2.2, Parallax, Inc.,
Rocklin, California, 2005. ISBN 1-928982-328. Available on-line: http://www.parallax.
com/
[3] Williams, Al: Javelin Stamp Manual. Version 1.0, Parallax, Inc., Rocklin, California, 2002. Available on-line: http://www.
parallax.com/
[4] PICAXE Dedicated website by Revolution
Education Ltd. Available on-line: http://
www.picaxe.co.uk/
[5] Arduino. Arduino is an open-source electronics prototyping platform based on flexible,
easy-to-use hardware and software. Available
on-line: http://www.arduino.cc/
[6] Pospiech, Thomas, Knot, Juraj and Gruhler,
Gerhard: MiniMEXLE - The microprocessor
development board for eyeryone, Radioelektronika - 16th International Czech-Slovak Scientific Conference, 2006. Website containing
the description, documentation and software
is available on-line: http://www.mexle.net
[7] Nemec, Martin:
Design of the wheeled
service robot based on the omnidirectional
wheel principle. [In Slovak] Košice, technical report KVTaR SjF TU Košice 2003.
Available on-line: http://www.robotika.
sk/contest/2003/RobotHugo.html
[8] Lúčny, Andrej:
Building Control System of Mobile Robots with Agent-Space
Architecture.
CLAWAR/EURON Workshop, Vienna, 2004. Available on-line:
http://www.microstep-mis.com/~andy/
LucnyClawar.pdf
[9] Petrovič, Pavel:
Incremental Evolutionary Methods for Automatic Programming of Robot Controllers.
Doctoral
theses at NTNU Throndheim, Norway,
2007. ISBN 978-82-471-5031-3. Available online: http://urn.ub.uu.se/resolve?urn=
urn:nbn:no:ntnu:diva-1748
[10] Balogh, Richard: I am a robot - competitor: A survey of robotic competitions. International Journal of Advanced Robotic Systems, Vol. 2, No. 2 (2005), pp. 144-160.
Available on-line: http://www.robotika.
sk/~balogh/ARSJournal2005.pdf