NXT

Hellow there, fellow Linux enthusiast. Looking for a way to program the NXT robot using your Linux notebook?

Well, turns out you can!

What works

  • Compiling NXC code – exactly as it would on Windows & OSX
  • Downloading the compiled code to the NXT brick through USB

What generally won’t work

  • Actual NXC language code completion
  • Firmware update the NXT thru Linux at ur own risk…

Your NXC IDE in Linux

Not too much choice here:

  • nxcEditor, highly recommended. Written in Gambas. Simply install some dependencies for the `Gambas` runtime, and execute the downloaded nxcEditor file – no further installation steps required! I personally found the UI a bit… well ugly, but other than that it ran without much problems. (Also had no idea how to compile it source!)
  • bricxcc (Windows-only) under WINE. Under WINE it doesn’t seem to be able to communicate with the NXT over USB (Googling reveals some possible workarounds, such as downloading the code by using a native third-party program, see below).
  • For the non-Windows users, the bricxcc project also have ‘NeXT tools’ for Mac and Linux. The Mac implementation is seems to be much more stable than the native ia32-only Linux binaries on their website. Didn’t work for me when I tried it (May 2014) – and even after successfully compiling the latest sources myself. Weird crashing and memory errors, even trying it with sudo.

… or old skool (Without an IDE)

Your distro most likely already has bricxcc‘s NXC compiler (‘nbc‘) in their repo’s already! In native Linux binary form, of course. Yay! Otherwise grab them here (they might even be newer).

This means that you can compile your awesome code right from your terminal.

Downloading your freshly updated code to the NXT thru USB is as simple as:

nbc myRoboSumo.nxc -d

See its help for more commands. (Feeling adventurous? try automating nbc actions with a makefile!)

Simply use your text editor of preference for the coding.

  • Sublime Text also supports some kind of integrated configurable build system. Mapping a hotkey to compile & download the code?
  • gEdit. Follow this to make gEdit synatax highlight NXC just like C.

Communication errors with the NXT brick

  • NBC gives error code 2 when downloading your code to the NXT: Tinker with some Linux device permissions to allow yourself to communicate with the NXT. Either try this, Google, or sudo.

Thanks for reading, hope this helps someone! And remember, if this is in any way related to some kind of group project, try sharing the coding tasks around. Pass that laptop around. Yes you, person reading this post!

 

Below: One of the ‘testing rounds’ for my group project* ** ***

* Increase the YouTube playback speed
** You really don't want to watch the whole thing... somewhere during the middle it does manage to 'rescue' the water bottle...
*** I know, I know...