Robot Mission Scripting
How many times have you had to recompile and reload your
robot control software because you want your robot to perform another task
or mission. For example, your robot is programmed to act a a waiter
now but you need it to perform roaming guard duty. While the code is
similar, it is not the same. The mission is different. MaxBasic
is an interpreted scripting language designed to feel like old-school basic.
It is designed for people the grew up in the 80s and miss the command line.
This is a very very early version - release just for fun!
MaxBasic is a simple scripting language for use with the
Zagros Robotics MAX/REX/AL mobile robot bases with the Microcore HC11 or the
iRobot Create.
Max Robot Basic Mission Commands
4/3/2009
MaxBasic <robot object>
AL100 - Sets target robot to Zagros Robotics MAX/REX/AL100 running CORE
software
create - Set target robot to iRobot Create (default)
load(command line only)
Prompts for a mission file to load
run(command line only)
Executes current mission file
connect
Opens serial connection to robot
baud
sets current robot comm port BAUD rate
comm
sets current robot comm serial port
disconnect
Closes serial connection to robot
robot (command line only)
Displays current robot type selected
gosub <:sub>
Jumps to a subroutine marked with a label.
return
Returns from current subroutine.
if
Allows program to make a decision
Example - if $morecrap = 13 then gosub :crap
goto <:label>
Jumps to label in program
print
Displays information, strings or variable values
Example - print "$crap + $morecrap"
Example - print $crap * ($morecrap + 5) + 1 + 10
input <"string prompt">, <$var>
Prompts user to enter a value and store it in a variable
rem
Remark line - everything on the line after rem is ignored by the interpreter
forward
sends FORWARD command to the robot
backward
sends BACKWARD command to the robot
left
sends rotate LEFT command to the robot
right
sends rotate RIGHT command to the robot
stop
sends STOP command to the robot
advance <DIRECTION> <DISTANCE>
sends the advance command to the robot.
example - advance backward 100
Labels:
Labels must have a colon (:) as the first character and cannot contain
spaces
Example - :mainloop
Variables:
Variables must have a dollar sign ($) as the first character and cannot
contain spaces
Example - $range
end
Marks the end of a program - interpreter will stop running the mission
exit (command line only)
exits program
Example Mission:
This simple program sends basic commands to a create each
time enter is pressed:
create
:start
rem this is a create test program
connect
input "press a key to init", $next
stop
input "press a key to go forward", $next
forward
input "press a key to go left", $next
left
input "press a key to go right", $next
right
input "press a key to go backward", $next
backward
input "press a key to stop", $next
stop
advance forward 500
disconnect
end
Here is a more complicated test program:
:start
rem this is a test program
forward
print "hello world"
input "Enter $value:",$value
print "$value="+$value
print "sensor test"
$direction = sensor("compass")
print "direction :"+$direction
gosub :gosubtest
print "return"
goto :NextMessage
:PrintVars
$crap = 10
$morecrap = 12
print "variables..."
print $crap
print $morecrap
print "$crap+$morecrap"
print $crap+$morecrap
goto :Third
:NextMessage
print "Next Message"
goto :PrintVars
:Third
print "second jump point"
end
:gosubtest
print "running subroutine"
return
Copyright 2009 - Zagros Robotics, All Rights Reserved
- Please send webpage comments or corrections to webmaster@zagrosrobotics.com
- Zagros Robotics, PO Box 460342, St. Louis, MO 63146-7342, (314)341-1836
info@zagrosrobotics.com for answers to any
questions.
Home | What's New | Lab Notes |
Handy Files | Cool Links | Contact Us | Webmaster