This is how I managed to get NQC working for the Robotics Invention System on my laptop, running Ubuntu 7.04 Feisty Fawn, with the USB Lego Infra-red Tower. Anything with a black background should be executed in a terminal.
- Plug in your USB IR Tower
sudo mkdir /dev/usb/sudo ln -s /dev/legousbtower0 /dev/usb/lego0 (Edit: For the latest versions of Ubuntu, the first path may need to be /dev/usb/legousbtower0, according to Scott.)
sudo chmod 666 /dev/usb/lego0echo test > /dev/usb/lego0(Look for a green light to flash on the IR Tower. If you see it, then all is well.)- Download the latest source of NQC from the NQC Website.
- Put it in its own folder, and untar/gzip it:
tar -xvzf nqc-[Hit tab to fill in the rest] - Open the Makefile:
gedit Makefile - Remove the ‘#’ before this line: USBOBJ = rcxlib/RCX_USBTowerPipe_linux.o
- Save and close the Makefile.
mkdir rcxlib/LegoUSB/cd rcxlib/LegoUSB/wget http://legousb.cvs.sourceforge.net/*checkout*/legousb/LegoUSB/drivers/linux/include/legousbtower.hcd ../../sudo makesudo make installexport RCX_PORT=usb(You should also add this line to the bottom of the .bashrc file in your home folder:echo export RCX_PORT=usb >> ~/.bashrc- Try it out:
nqc -msg 7(You should see the green light come on on the IR Tower, and you shouldn’t get any message in the terminal. - If it works, you should be ready to use NQC! If you need to install the RCX Firmare, insert the Robotics Invention System CD, and run this command:
nqc -firmware /media/cdrom/firm/firm0309.lgo - Download the test program:
nqc -d test.nqc(This should put a program in slot 1 of the RCX which will just turn on Motor A.
Edit: Mike has a followup article where he explains how to set up the first three steps so they happen automatically when you plug in the IR Tower.
Kudos to this article for putting me on the right track.
7 Comments
Great tutorial, helped me to fix a seemingly junked RCX.
Top Article.. well done! Its working =)
Hi Trevor
I have a lots of kid that want to learn robotics and we are using the lego system. The computers that the school gave are showing their age, badly. So i’m trying to have the system running in my personal laptop. The laptop is running Ubuntu 7.04 64bits. I follow the steps and I can echo to the tower but I can’t get nqc to send a message to the tower I get ” USB Tower not supported”.
Any ideas where should I look to have this working?
Hi Trevor,
Thank you for your article. It has helped me and my Yr9/10 robotics class (and certainly many others) to use linux with the rcx bricks.
Thanks for including some Tony Campolo quotes. We rarely see him here in Australia. He is a challenging voice for anyone who is seriously trying to follow Jesus. I guess I’ll just have to read more of his books.
God bless,
Glen
Hi, I’m trying t use NQC for my research project and I’m running it in kubuntu 7.04 which I downgraded to from 8.04 and I followed the directions and when I enter “nqc -msg 7″ I get “Could not open serial port or USB device
” Any advice would be greatly appreciated and thank you in advance
-Stew Boling
Hi Stew,
I haven’t used this in a while, but I believe the problem lies in this step:
sudo ln -s /dev/legousbtower0 /dev/usb/lego0
Basically, NQC expects the tower to be at /dev/usb/lego0, but Ubuntu puts it at /dev/legousbtower0. I would assume Kubuntu puts it in the same place, but if you figure out where it is, and edit the above command appropriately, it should work.
Hi Trevor,
Ubuntu recently updated their udev package and the usb tower now mounts at /dev/usb/legotower0. the rest of the tutorial works! Thank you for this great tutorial, it has been a life saver.
-Stew
One Trackback/Pingback
[...] + Robótica http://trevorcreech.com/blog/2007/07/15/lego-robotics-invention-system-on-ubuntu-linux/ http://www.roboticalivre.org/portal/ [...]
Post a Comment