I just got my Mindstorms robot and obviously had to start working on controlling the robot remotely. This is just some notes and a "hole in the wall" test.
Setting up bluetooth devices sucks - "setting up" anything does - but here's the mnemonic route for a sequence of actions that work.
Use the configuration program to update the serial port configuration for your system. COM7, the default setting, should work unless you have a ton of devices. Look for the "outgoing" Com port for the NXT.
wrt to the perl scripts above, add the line
$data = "\x00\x09\x00\x02a\x00";
to send a single letter 'a' to the NXT mailbox no 1 (zero based here, third byte is mailbox). Reading messages from a mailbox is how the visual programming environment can interact with the mindstorms robot.
I had limited success with the preset commands included in the perl script. Of all the commands in the Bluetooth SDK I only got the "PLAYTONE" direct command to work and then the more important one, which is the messagewrite above.
Note: Speed is not a feature of this communication channel.
I wrote a simple program to test: It checks the BT mailbox for a string 'a' - if it finds one it takes a quick roll back and forth. It's worth mentioning that you can't send messages to a mailbox unless a program is running - it's not enough that the NXT is turned on.
I then added a CGI wrapper around the perl script, exposed it temporarily on this webserver and had a world controllable robot. Next project: Sensor output back on the web.
Visual programming environment alert: The Labview derived visual programming environment seems buggy to me. I had to do 2 tries in generating a test program, because the first program just wasn't picking up the scanner input. I tested with the ultrasonic sensor that it wasn't buggy Bluetooth. I then reassembled the exact same program - and that worked. I got a clue when I shut down the editor and got an error message that my program had an "insane object " something or other. Very kid-friendly, that.
My test robot is here (286kb). (dig that filezise btw, that's completely insane for what the program does).Posted by Claus at August 17, 2006 1:50 AM