What libraries exist for what languages to set up some way for the computer to send messages during runtime of a NXT program? How can I get the robot to send messages to the PC while running a program? The Bluetooth sample is very confusing, can anyone explain what it's doing?

So what I'm trying to do with the robot is to make it roam around as usual, just doing the regular sorts of things in its code, but when a touch sensor tells it that it's run into a wall, it will relay that information to the user at a computer. The user could then tell it to go right, left, or back up. I know that Bluetooth should allow this to work, but I don't know how to send the signals, or even what language would be best to write the computer side in. Help please?

_________________-Mandy

Fri Jun 08, 2007 3:18 pm

SuntzuMaster

Rookie

Joined: Sun Apr 15, 2007 8:33 amPosts: 40Location: USA

If you have a Windows system then you could give a try to Visual Studio Robotics? It is free and the computer is in relationship with the robot all the time.

The tutorial is a great start, I made a remote and expanded upon it and posted it on my website. Also download the Bluetooth Developer Kit from Lego and it will give you all the bluetooth commands to communicate with the NXT:

The tutorial gives a really good overview of sending the messages from the computer, but how can we read the mailbox from RobotC (rather than using NXT-G)? It seems possible but I can't find any documentation/examples for how to do this in RobotC.

Thanks.

Thu Jun 14, 2007 2:40 pm

Dick Swan

Creator

Joined: Fri Feb 09, 2007 9:21 amPosts: 615

Of course RobotC is optimized for autonomous self-contained robots.

However, it uses an "extended" version of the Fantom communication device drivers that are part of the NXT-G system. In particular, it supports all of the messages documented in the Bluetooth SDK except for the two related to send and receive user generated messages -- and yes, I know these are highly desirable.

There are significant problems with bandwidth on the Bluetooth link. I believe the Bt module on the NXT is a significant bottleneck. It takes 20 to 30 milliseconds to send a message from the PC to the NXT and receive a reply. So if you wanted to poll the values of all four sensors and three motor encoders the elapsed time is around 200 milliseconds. This is a little slow for good real time performance! And then add additional time to send messages to control the motors based on the sensor/encoder input.

The ROBOTC extensions to Fantom are designed to minimize this bottleneck. For example, ROBOTC has a new message to poll all the sensors+encoders with a single message to reduce the delay mentioned above. There are many other enhanced single message commands in the ROBOTC interface -- e.g. poll the 800-byte LCD pixel map in a single message as part of the "remote desktop" feature.

The 30-msec polling delay is partially due how Fantom uses the bluetooth link in a half-duplex fashion. BT defines a master - slave relationship on a connection where the master generates the clock signal for the RF transmission. Fantom also uses the master-slave so that all communications is directed by the master. The slave only generate BT traffic in response to a command from the master.

Work is underway to improve the Bluetooth messaging for use in both NXT-NXT traffic and PC-NXT for user generated messages. It relies on some new Fantom functionality that is part of the VISTA upgrade for NXT-G which I think is scheduled for availability later this summer. Hopefully the ROBOTC VISTA upgrade will utilize this capability for NXT-NXT (and NXT-PC) messaging. The new Fantom functionality provides a framework that allows the BT link to be used in full-duplex mode -- at least when there is only a single BT connection present.

Fri Jun 22, 2007 5:54 am

KrepNatas

Rookie

Joined: Thu Jun 14, 2007 2:35 pmPosts: 3

thanks

Thanks. I'll start looking for another compiler then, as I need to send coordinates to the NXT indicating its current position and the positions of three other robots.

I've started working with NXT Python and I have been able to get the Bluetooth to work and control the robot. The only really bad thing about NXT Python is it's complete lack of anything that might help to figure out the commands. You'll have to read through their modules to know how to do anything. The up side is that it's an interpreted language, so you can eventually sit at your desk and just type in the command that turns on a motor and it'll go. It makes the defect finding process much easier.

It does work on Windows, so don't let the site's "has been reported to" description of that capability scare you away.

It would be nice if RobotC could make the user generated messages more workable for machines that may never be able to get Vista. It was hard enough to talk IT into giving me the password just to update Windows to SP2, they'll never spend money on Vista.

_________________-Mandy

Fri Jun 22, 2007 12:56 pm

dtrotzjr

Rookie

Joined: Sat Jun 16, 2007 6:24 pmPosts: 14

What is the status of Bluetooth messaging? I really need some means to have two way communication between my PC and the NXT. Is it possible to use raw serial IO using IOMap? I am growing desperate here. My next step in development needs messaging from the NXT to PC and PC to NXT. Example, I want the robot to send sensor data to the PC, I want the PC to do mapping and send commands for movement to the robot based upon the sensor data.
What are my options?

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum