I'm looking for recent work on using Tcl to drive Lego Mindstorms NXT
I've found on c.l.t the following item, but it dates back to 2002 and
older hardware (RCX)
What I would like to do is have a Tcl program running on a PC interact
in real-time with the sensors and effectors; the Lego-provided
software is only about editing, compiling, and installing in flash a
tiny program for the embedded microcontroller; then the whole stuff
runs autonomously, with the USB wire removed.
With a realtime bidirectional flow of events and commands to/from a
PC, the range of possibilities obviously expands by several orders of
magnitude (there's a bluetooth link if the USB cable is too rigid and
short). And doing all this in Tcl should be a treat...
Any ideas ? Proof that's impossible ? Experiments outside Tcl ?
TIA,
-Alex
What kind of an API do they provide?
Will events and sensor information flow over the bluetooth link?
--
+--------------------------------+---------------------------------------+
| Gerald W. Lester |
|"The man who fights for his ideals is the man who is alive." - Cervantes|
+------------------------------------------------------------------------+
The NXT stuff seems to be based in National Instruments LabView.
Someone has done Blootooth connect:
http://www.google.com/search?q=Mindstorms+NXT+linux
Some articles on slashdot.
http://slashdot.org/search.pl?query=lego+nxt
Lots of stuff on sourceforge:
http://sourceforge.net/search/?type_of_search=soft&words=nxt
loks like no tcl though.
uwe
OK. Now I know whom to blame for the terrible graphical code
editor :-)
> Someone has done Blootooth connect:http://www.google.com/search?q=Mindstorms+NXT+linux
> Some articles on slashdot.http://slashdot.org/search.pl?query=lego+nxt
> Lots of stuff on sourceforge:http://sourceforge.net/search/?type_of_search=soft&words=nxt
> loks like no tcl though.
Thanks very much Uwe. I believe the closest to Tcl would be NXT
Python. I guess I could extract the needed info from there; but for
the BlueTooth part they say they use PyBluez -- this yields the
obvious question: do we have an equivalent Tcl "glove" for bluetooth ?
-Alex
could one touch this with the tcl magic stick? i.e. accessing python
from tcl via an embedded interp?
>
> -Alex
>
uwe
could one touch this with the tcl magic stick? i.e. accessing python
from tcl via an embedded interp?
just found this:
http://news.hping.org/comp.lang.tcl.archive/7698.html
if this can be handled via "serial" comm one should be
able to handle it with expect?
>
> -Alex
>
uwe
Yup, seen that one too :-)
> if this can be handled via "serial" comm one should be
> able to handle it with expect?
Or even vanilla Tcl (unless somebody has bad news about fileevents on
serial in Windows). My problem with this, is I don't know whether NXT
uses the RFCOMM profile (the one emulating a serial port) or another
one. Have to investigate further into the links you gave.
-Alex
When I google for "tcl legio mindstorms" 173,000 hits return. However,
near the first I notice something about an article by Laurent Demailly
and Tcl. Yes, it does also talk about RCX. However, I wonder if
contacting Laurent might be useful, to see if he's still working with
Mindstorms.
- All advanced documentation from Lego can be found at
http://mindstorms.lego.com/Overview/NXTreme.aspx
- Basically, to control the robot from a PC, one should write a
generic control loop to be embedded, start it, and interact with it
over the data link (bt or usb).
- In there exquisite wisdom, Lego people wrote one such generic
control loop and built it into the bundled firmware ! That's a relief,
because the VM, which is documented in detail, is not the kind of
thing you'll want to spend time on... This built-in control loop
enables a sub-protocol named "Direct Commands" and lightly documented
in Appendix 2 of the Bluetooth SDK.
- Back to your suggestion, Uwe. I think there's no need to harness
Python to access the Bluetooth link. Indeed, all this works in serial
port emulation mode. So you just have to instruct the BT manager on
your PC to allocate a COM[0-9] port, do the necessary manipulations so
that the two devices shake hands, and voila.
Best regards,
-Alex