Loginskip to content

Archive for the 'development' Category

Weather forecasts on your NXT

Tuesday, June 16th, 2009

or communication between an NXT, a computer and the internet.

Quite some time ago I wanted to give a brief tutorial about communication between an embedded program running on the NXT (for example written in NXC) and a computer. The reasons one would want to send data from an NXC program to a PC or vice versa can be divided into two main categories: Either the NXC program wants the computer to do things it can’t (complex calculations, look up information), or a computer program needs to tell an NXC program what to do (or which information to collect or log).

Weather Demo Client Screenshot In the search for a good example I came across this idea: Wouldn’t it be great to show how the NXT could retrieve data from the internet (although the display is to small for a browser ;) )? The first kind of data I could think of were weather forecasts (or current weather conditions). So here we are: This is how it looks if your NXT can show the current temperature and brief conditions of any place around the world (screenshot taken with J. Hansen’s tool NXTScreen).

Short description: The NXC program (client) can request weather conditions by storing a string in one of its mailboxes. The computer program (server, written in MATLAB) constantly looks for messages there via direct commands. If one is found the according weather conditions will be retrieved from the internet using the Yahoo! Weather RSS service. The most important data are extracted and sent back to the NXT (again by storing a string in a mailbox). The NXC program in term waits until a string can be read from the queue, parses it and finally displays city name, current temperature, and condition.

Left and right buttons cycle through multiple locations (i.e. cities); the orange center button toggles between Fahrenheit and Celsius mode! Interested? Read on!

(more…)

Lego Pong with NXTCam

Friday, May 2nd, 2008

Here is an interesting robot from wayneage that plays Pong using a NXTCam camera to track a ball in real time. The NXTCam continuously sends the location (coordinates) of the ball to the NXT brick. The robot keeps adjusting its position to hit the ball when it is close enough. Before the robot starts, the NXTCam is taught the colours to track using another program called NXTCamView (this is not shown in the video). As you can see it works quite well - nice work!


NXT-compatible infrared/ultrasonic beacon system

Monday, March 17th, 2008

We brought our old RCX-beacon system to the NXT level. Please consult

http://www.convict.lu/htm/rob/ir_us.htm

 PC-boards

 

PF Speed control (and more) in NBC/NXC

Tuesday, February 12th, 2008

John Hansen published a test release of NBC/NXC with better interface to HiTecnic IRLink, allowing speed (PWM) contol of PF motors and other stuff.

Check it here:
http://bricxcc.sourceforge.net/

SCARA Robot

Sunday, December 2nd, 2007


Check out this YouTube video of a Lego SCARA robot arm by pishita69. SCARA stands for Selective Compliant Articulated Robot Arm. This type of design is often used in pick-and-place, assembly, and packaging applications. You can find out more about scara robots here. Nice work.

NXTCam Follower

Monday, November 19th, 2007


Check out NXTCam Follower by Mark R. It uses the new mindsensors NXTCam sensor to keep a ball at a set distance from the robot. Mark has posted his programs on the NXTCam Wiki. Nice work!

Comparison of Programming Environments for NXT

Tuesday, November 13th, 2007

The winter issue of Robot magazine contains a comparison of the various programming solutions for the NXT. It’s available online at http://www.botmag.com/articles/10-31-07_NXT.shtml. The comparison includes implementation of a simple line following program using the different programming languages including screenshots from the different environments. [Note: I wrote the article and also helped author ROBOTC].

Another NXT programming language discussion was justed posted on the Wired magazine web site at http://blog.wired.com/geekdad/2007/11/the-best-progra.html. Chris Anderson of Wired has been using his NXT to control his UAV — Unmanned Aerial Vehicle — and has tried many of the programming environments. For more on his airplane, see the videos at http://diydrones.com/video/video/show?id=705844:Video:43 

Conveying NXT state with spoken text

Thursday, August 23rd, 2007

When building NXT models, I like to get feedback on the state of the program or the state of sensors to make sure they are working as intended. The matrix display on the front of the NXT brick is great for some types of output and has some neat features.  These include - showing up to 7 lines of text, drawing shapes and images, and doing simple animations. Some projects have used this to great effect. However, it has its limitations. The display is not very big, so you can’t read it from across the room.  You need to be directly in front of it, so it can’t be covered or facing away.  And finally it only shows black or white pixels.

Your other options for outputing state include; the motors (a precious resource), the red led on the light sensor (only good for binary output), and the speaker. Of these, the speaker is the best suited to fill the gaps where the display is lacking.  It it quite loud, can be heard in any direction and can quicky convey different types of information.

Since the NXT can play sound files, we can use the speaker to play short spoken phrases.  I use these to provide feedback in my models.  So – where do get the spoken phrases from? One option is to record your own voice. For me, I prefer to use one of the text-to-speech web sites that convert written text into wave files you can download. I quite like the voices at the AT&T Text-to-Speech Demo site. You just follow these simple steps –

  1. Choose a voice (mens/womans/regional etc.)
  2. Enter the phrase to speak.  Keep it down to a couple of words.
  3. Download it to your PC

The downloaded phrase is in a wave file that needs to be converted to an RSO file format which the NXT can play. There’s a nifty program written by John Hansen called wav2rso which does this conversion for you.  It can convert a number of files at a time. You can set the quality of the conversion which effects the size of the file produced (higher frequency = better quality = larger files)

Now upload the RSO file into your NXT. You can do this with either; the standard NXT programming environment using the Memory Tab on the connection window, or one of the file managers in either RobotC or the BricxCC development environment.

Finally, you add code to your program to play the file at the appropriate time (e.g. when changing program state, or detecting an object). In NXT-G you use the Sound block to play the file. In RobotC you use the PlaySoundFile function. In either case, you specify the name of the sound file to be played.
And that’s it! With a few simple steps your model is speaking!

Here are some examples of my projects that have speech in them - OneMotorNXT, NXTShot

Coding4Fun: MS Robotics Studio

Tuesday, July 24th, 2007

Last week, Coding4Fun posted an article/tutorial on using MS Robotics Studio with the LEGO Mindstorms NXT.

In this article, Brian Peek will demonstrate how to use Microsoft Robotics Studio to control the Lego Mindstorms NXT kit. A simple remote-controlled robot will be built and controlled using C# and the MSRS Visual Programming Language (VPL).

leJOS NXJ version 0.3 released!

Wednesday, July 18th, 2007

As you all know, there are allready several programming alternatives for the NXT. These include, for example, NXT-G, RobotC, NXC etc. One other option is leJOS, a Java object-oriented language built on top on TinyVM. As you can read in the following email I got from Brian Bagnall, one of leJOS developers, this new release starts taking shape into a mature firmware alternative for the LEGO and RobotC firmwares:

The latest version of leJOS NXJ is finally ready! For those who aren’t familiar with leJOS, it’s a full replacement firmware for the LEGO Mindstorms NXT brick that allows you to run Java programs on the NXT brick. leJOS NXJ works with Windows, Linux and Mac OS X (a dedicated Mac build is coming soon). Version 0.3 now includes some key features:

- A flash file system including implementations of java.io.File,
FileInputStream, and FileOutputStream.
- CompassPilot and CompassNavigator
- A menu system that supports executing and deleting programs, and LCP commands with NXJ extensions over USB and Bluetooth
- Java streams over Bluetooth and USB
- USB support
- Flash native methods
- Working flash build of leJOS NXJ
- Improved LCP support (LEGO Communication Protocol) including file commands
- Improved Bluetooth support including setting the NXT name
- A file explorer that runs on your PC
And much more…

Check out www.lejos.org for more information.

I hope these guys release some tutorials soon, since understanding how to use leJOS from the examples source and the API is somewhat challenging….

Microsoft Robotics Studio 1.5 (CTP May 2007)

Wednesday, May 2nd, 2007

A new (Community Technical Preview) version of Microsoft Robotics Studio was released from microsoft. A short description from the website:

“The Microsoft® Robotics Studio is a Windows-based environment for academic, hobbyist and commercial developers to easily create robotics applications across a wide variety of hardware. This installation package installs the Microsoft Robotics Studio along with samples and tutorials.”

You can download it here.

URBI for Mindstorms NXT

Saturday, March 17th, 2007

A new programming language for NXT was released - URBI. You can find the download, documentation and toturials at http://www.gostai.com/lego.html.

Disk Reader

Sunday, January 28th, 2007

The disk reader is just one of the little tests that I’ve been working on with my NXT. At present the data that the robot reads is rather useless but, with a good imagination I think that you could come up with some interesting applications for this robot. The robot is very easy to put together. The hard bit is getting the data to mean something and get the robot do something with the data.

If you make anything interesting with the disk reader and you want to show people what you have made. Email me and I’ll post it up here for others to see.

Till NXTime.