Surveyor Robotics Journal
   



email:
support@surveyor.com

web:
Surveyor Corporation

rss:
Subscribe

Archives
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
December 2008
November 2008
October 2008
September 2008
August 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
Februray 2006
January 2006

       
Thu, 13 Nov 2008

Robot Lisp for Surveyor SRV-1/SVS

A new version of Lisp has been added to the latest test version of Surveyor SRV-1/SVS firmware, as discussed on the Surveyor Robotics Forum. The code is based on "Scheme In One Defun" (SIOD) by George J. Carrette.

Lisp can be run interactively or loaded with a program from the flash buffer. There is a rich set of built-in functions, based on the Scheme dialect - cons, car, cdr, set-car!, set-cdr!, +, -, *, /, <, >, =, eq?, eqv?, assq, read, print, eval, define, lambda, if, while, begin, set!, or, and, quote, oblist, copy-list, gc-status, pair?, symbol?, number?, quit, not, null?, reverse.

We have extended this with some SRV-1/SVS specific functions -
  • (rand x) - return a number ranging from 0 to x
  • (time) - return current RTC value (milliseconds since last reboot)
  • (delay x) - delay x milliseconds
  • (input) - take input from console - currently limited to single digit 0-9
  • (lasers x) - any non-zero value of x turns them on, 0 turns them off
  • (robot x) - move SRV-1 - 8=fwd, 2=back, 4=left, 6=right, 5=stop
  • (compass) - return reading from optional HMC6352 compass
  • (ping x) - get value from optional Maxbotics modules 1-4
Lisp can be run interactively, or loaded with a program from the flash buffer. The next code release will combine these features - you will be able to load a program from the buffer and then continue interactively. To run interactively via terminal , send '!'. To run from the buffer, send 'P'.

So the command
    (robot 8)
will move the robot forward, and
    (robot 5)
will stop it

You could define the commands -

(define fwd 8)
(define back 2)
(define stop 5)
(define left 4)
(define right 6)

Then the command
    (robot fwd)
would have the same effect as
    (robot 8)

Here is a very simple program to control the robot from the keyboard, using the digits 8, 5, 2, 4, and 6 as defined above, and 0 to exit the program ...

(while
   (> (set! x (input)) 0)
       (robot x))

This is just the beginning. It is very easy to extend the language, and the next step is to add some image processing functions to enable search for objects(colors), avoidance of colors, etc.

Posted Thu, 13 Nov 2008 21:06 | HTML Link | see additional stories ...