This is a distribution of software that comes with the book Programming Cognitive Robots by Hector Levesque. It comes with absolutely no guaranties or support. It was first released March 2018 (version 1.5, which conforms with the book).
This directory contains all the files and directions for running the ERGO system as well as a number of ERGO programs. It contains the following:
ergo-sheet.pdf
: A one page summary of the ERGO systemSystem/
: All the system filesExamples/
: Some example ERGO programsProjects/
: Three larger ERGO programsServers/
: Programs to be run in conjunction with ERGO
Each subdirectory will contain its own explanatory README
file.
The original collection of files was put together on March 17, 2019.
This describes how to setup and run the ERGO system.
This describes how to setup and run the ERGO system.
See http://racket-lang.org/. You can test that things are working with
> racket -e '(+ 3 4)'
7
-
First, put all the files in the
Ergo/System/
directory somewhere convenient, away from user ERGO programs. On a Mac, a reasonable choice is to create~/Library/Application Support/Ergo/
and put them there. -
Then find out where Racket keeps user-defined collections. It's the first element of "
(current-library-collection-paths)
".In Mac:
> racket -e '(car (current-library-collection-paths))' #<path:/Users/hector/Library/Racket/7.2/collects>
In Linux:
$ racket -e '(car (current-library-collection-paths))' #<path:/home/ssardina/.racket/7.2/collects>
Note: if Racket is updated, the version folder (
7.2/
above) will change, so it needs to be updated manually. -
Create the user
/path/to/collects/
directory from (2) if needed, and a new subdirectory inside it called "ergo
". -
Put a file called
main.ss
in theergo/
directory from step (3). It should contain just the following three lines:(module main racket (require (file "/path/to/implementation/full-system.scm")) (provide (all-from-out (file "/path/to/implementation/full-system.scm"))))
where the
/path/to/implementation/
is the directory from step (1) above. -
Test that ERGO is correctly installed:
> racket -l ergo -e '(ergo-do :nil)' Loading ERGO v1.5 (Feb 2021) in Racket 7.2 ... '()
(and do see Chapter 2 of the book)
-
To access ERGO interactively:
$ racket -l ergo -i
From there, the primitive functions like
define-fluents
andergo-do
can be used. Files containing other definitions can be loaded withinclude
. -
To run interactively after loading an ERGO file
myfile.scm
:$ racket -l ergo -i -f myfile.scm
Other files can be loaded using "include" within myfile.scm.
-
To load an ERGO file
Examples/lift-table.scm
and then evaluate(main)
$ racket -l ergo -f Examples/lift-table.scm -m Loading ERGO v1.5 (Mar 2018) in Racket v6.11 ... Loading on demand /home/ssardina/git/soft/agents/ERGO.git/System/ergo-do.scm '((grab! r1 e1) (lift! r1 1) (grab! r2 e2) (lift! r2 1) (lift! r2 1) (lift! r1 1) (lift! r1 1) (lift! r2 1) (lift! r2 1) (lift! r1 1) (lift! r1 1) (lift! r2 1) (lift! r2 1) (lift! r1 1))
-
To load an ERGO file
myfile.scm
and then evaluate an expressionexpr
:$ racket -l ergo -f myfile.scm -e 'expr'
-
To load an ERGO file
reactive-elevator-run.scm
and run the programcontrol
:$ racket -l ergo -f Examples/reactive-elevator-run.scm -e "(ergo-do control)" Loading ERGO v1.5 (Mar 2018) in Racket v6.11 ... Loading on demand /home/ssardina/git/soft/agents/ERGO.git/System/ergo-do.scm '(down! down! down! down! turnoff! up! up! turnoff! down! down! down! down!)