To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.pbforthOpen lugnet.robotics.rcx.pbforth in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / pbFORTH / 120
119  |  121
Subject: 
RE: Mindstorms/reinforcement learning
Newsgroups: 
lugnet.robotics, lugnet.robotics.rcx.pbforth
Date: 
Wed, 13 Oct 1999 13:23:31 GMT
Viewed: 
18 times
  
Please let the rest of us know as well, Ralph- I'm very interested in any
type of AI stuff on the Mindstorms. As a "quick" note, our
projects (using
something called Q learning if anyone out there knows the terminology)
involve doing roughly 6*6*7*8*50 calculations in each learning loop. This
can take a substantial amount of time (3-5 seconds) on the bot, and I
really don't think that too much can be optimized, unfortunately.
Furthermore, because the calculation involves a matrix of 6*6*7 doubles,
transferring it to a PC repeatedly would probably take as long, if not
longer. If you take *that* off of the RCX, you might as well just run the
whole thing in simulation. oh well... it is still really, really cool
when you have realized that your bot has learned something, even if it
has happened in painfully slow 3-5 second intervals. More details later...
-Luis

Declaring variables (almost any number of them) in pbFORTH is like this:

VARIABLE FOO

Fetching and storing is like this:

23 FOO ! ( this stores the value )

FOO @    ( this fetches the value )

Values are 16 bit integers - 32 bit doubles use a slightly different
syntax, but you can usually scale to 16 bits, and it's faster...

To make an array named BAR with 48 16-bit entries...,

CREATE BAR
48 CELLS ALLOT

Now to fetch the FOOth value out of the array...

BAR FOO @ CELLS + @

BAR puts the address of the array on the stack, FOO @ gets the value
of FOO, CELLS figures out the offset in the array, + adds the offset
to the address of BAR, and the last @ gets the FOOth entry...

If you want to send your value out the IR port, just do this...

DECIMAL
FOO @ U. ( prints as an unsigned decimal integer )
FOO @ .  ( Print as a signed decimal integer )

HEX
FOO @ U. ( prints as an unsigned hex integer )
FOO @ .  ( Print as a signed hex integer )

There's formatted output too....

Yes, the syntax is UGLY, but this is what a typical C compiler
generates, and this is one of the reasons why so many CS grads
are useless at embedded systems - they don't REALLY understand
what the micro is doing!

I will post the AI guy's stuff as soon as I get permission, and I'll get
some kind of better tutorial out soon too.

I hope this has sparked a bit of interest in pbFORTH, but it will
take someone doing a cool app to cement things. Watch this space
for my upcoming maze walker...

Cheers,

Ralph Hempel - P.Eng

--------------------------------------------------------
Check out pbFORTH for LEGO Mindstorms at:
<http://www.hempeldesigngroup.com/lego/pbFORTH>
--------------------------------------------------------
Reply to:      rhempel at bmts dot com
--------------------------------------------------------



Message is in Reply To:
  RE: Mindstorms/reinforcement learning
 
Please let the rest of us know as well, Ralph- I'm very interested in any type of AI stuff on the Mindstorms. As a "quick" note, our projects (using something called Q learning if anyone out there knows the terminology) involve doing roughly (...) (25 years ago, 13-Oct-99, to lugnet.robotics)

9 Messages in This Thread:


Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    
Active threads in Robotics

 
Verified and Trusted Team of Hackers
12 hours ago
Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR