Download Spherly User Manual Spherly is a visual programming editor

Transcript
Spherly User Manual
Spherly is a visual programming editor application built upon Blockly, which supports the
creation of new block languages (https://code.google.com/p/blockly/). Spherly was designed to
allow programmatic command of the Sphero Robot Ball (http://www.gosphero.com/) through
intuitive visual “block” commands that can be arranged sequentially in a program.
Spherly has two components: the front-end web application that runs from a browser, and the
local server that runs on your computer and communicates with Sphero via Bluetooth. The web
application
and
the
server
are
both
required,
and
can
be
found
at:
http://outreach.cs.ua.edu/spherly/.
I. Starting the Server
From the website listed above, clicking the “Download Server” link will download a zip file
containing the necessary files to run the server application on your computer. After unzipping
the file, simply run the SpherlyServer.exe application inside of it, and the server should begin to
execute. The server needs to be running on your computer whenever you want to use Spherly.
The server currently only works on Windows machines with Bluetooth communication (tested on
Windows 7 and Windows 8), but we are working on installations for tablets and other operating
system. The front-end web interface will work with any computer, but the back-end local server
needs to be customized for each platform.
II. Conne
ecting to Sp
phero
After starting the loc
cal server, yo
ou must con
nnect to the Sphero thro
ough the Wiindows Blue
etooth
managerr.
After you
ur Server an
nd Bluetooth are set up, navigate to
o the Spherlyy Application (available from
the main
n Spherly we
eb page, orr directly at http://outrea
ach.cs.ua.ed
du/spherly/ru
un/) and perform
the follow
wing steps:
1. Click the Select
S
Addres
ss Button
2. Select the appropriate Sphero you
u want to con
nnect to thro
ough the pop
pup window
nect
3. Click Conn
y have to try
y connecting
g more than once if the Server just started. Sph
hero can on
nly be
You may
connecte
ed to one co
omputer or application
a
at
a a time, bu
ut the app sh
hould notify you when yyou’re
connecte
ed to a Sphe
ero successffully. A conne
ected Spherro should light up with a blue color.
III. Layou
ut of Spherly Web App
plication
After con
nnecting to the Sphero, the majority
y of the workk will be don
ne with the B
Blockly Butttons,
Scripting
g Area, and the Block Tabs.
T
You can
c drag com
mmand Bloccks over from
m the Block Tabs
to the Sc
cripting Area
a into a sequence of co
ommands to be execute
ed by Spherro. All blockss that
you wan
nt Sphero to
o execute must
m
be con
ntained eithe
er in the “W
When run b
button pres
ssed”
container block or the
e “When sp
phero detectts collision”” container b
block.
ou have you
ur blocks sett up in the program
p
you
u want, simply press th
he Run button to
When yo
send the instructions
s from the we
eb client to the
t server, a
and from there to the Sphero ball.
IV. Sphe
erly Specific
c Blocks
h all of the bllocks availab
ble for creat ing your Sph
herly applica
ation.
Now we’lll go through
A. Blocks under th
he “Sphero Control” Ta
ab
This is one of
o the two b
blocks that are presentt in the Scripting
Area
A
when Sp
pherly startss. This conta
ainer block w
will hold all b
blocks
th
hat you wantt to execute on the Sphero when th
he Run Buttton is
pressed.
Any bloc
cks that are outside
o
of th
he “When run button” blo
ock will not have any direct effect o
on the
Sphero. (NOTE: an exception is
s any functiion created outside of tthe run blocck. These wiill not
be execu
uted directly
y, but can be referenc
ced from insside of the run block a
and will fun
nction
properly)).
he other blo
ock that is p
present in th
he Scripting Area
This is th
when Sp
pherly startss. Similarly to the “W
When run bu
utton”
block, thiis container block will h
hold all blocks that you want
to comm
mand the Sp
phero when it detects a collision (e.g.,
running into a wall orr being lightly hit).
n this versio
on of Spherrly is somew
what sensitivve, and so it is commo
on for
Collision detection in
t detect a collision wh
hen it begins rolling or turning on its own. Th
his is a lot more
Sphero to
present on
o certain flo
oor surfaces
s than others
s. If you don
n’t put any b
blocks in thiss wrapping b
block,
or delete
e this wrappin
ng block, Sp
phero will no
ot do anythin g when it co
ollides with ssomething.
B. Blocks under th
he “Sphero”
” Tab
ck will make
e Sphero’s L
LED light up
p to the specified
This bloc
color. Th
he color porttion on the right can be
e changed using
ker (click on the color re
ectangle to b
bring up the picker), or sswitched outt with
the built in color pick
k from the Colour
C
tab.
any block
k will instruc
ct Sphero to begin rolling forward. S
Sphero calib
brates
This block
its positio
oning upon starting,
s
so it may be h
helpful to usse this comm
mand
when you
u first start the applica
ation to find
d out what direction Sp
phero
thinks forw
ward is.
he direction Sphero
S
think
ks is “forward
d” will be ch anged by ussing the “turrn” command
d
(Note: th
below)
This
T
block will
w instruct S
Sphero to ro
oll in the sp
pecified direcction.
The
T
directio
on is in unitts of degree
es, and corrresponds to
o the
classic
c
0 to 359 degreess of a circle. Rolling in tthe direction
n of 0
s to “roll forw
ward” if you have
h
not yett used the “tturn” comma
and.
degrees corresponds
This bloc
ck instructs Sphero to cchange its fforward dire
ection
by the set
s amountt. If Sphero
o is instructed to turn 180
degrees, it will be facing the
e opposite direction it was
nd any furthe
ward” comm
mands
previouslly facing, an
er “roll forw
will use this new facing.
ntage of its max
Changes the speed of Sphero to a percen
hen executed
d. Sphero’s initial speed
d is set at 100%.
speed wh
Max spee
ed varies dep
ou are
pending on which Spher version yo
using (Sphero 1.0 and
d Sphero 2.0
0).
If Sphero is currently rolling, this w
will make it stop at its ccurrent locatiion. If
t
comman
nd does noth
hing.
Sphero is not rolling, this
t
will not send
s
a speccific comman
nd to Sphero, it can be used
While this
to paus
se before yo
ou send the next comma
and to Sphe
ero. For insta
ance,
becaus
se Sphero ta
akes half a ssecond to turrn, it could b
be helpful to put a
“wait” command
c
after a “turn”” command, in order to give the Sp
phero
t
to posiition itself co
orrectly. If this is not do
o may not rroll in the co
orrect
enough time
one, Sphero
direction immediately
y.
V. Code Examples
W
working
g with Sphe
ero, the robo
ot can some
etimes become confuse
ed when trying to
Note: When
“right itse
elf upward.” Therefore, it is not guarranteed thatt every execcution of the code will ru
un the
same ev
very time. Allowing
A
Sp
phero more time to exxecute turn
n commandss by using wait
commands is sugges
sted, but ma
ay have varia
ations of acccuracy.
A. About Face
on
B. About Face: Colllision Editio
C. Colorr Cycling
ng in a Squa
are
D. Rollin
E. Rollin
ng in a Spira
aling Squarre
VI. Sphe
erly User’s Forum
F
ents, please visit the Sph
herly user fo
orum at:
To ask questions or post comme
com/spherly--forum
http://tinyurl.c