ruby-nxt 6

Posted by Tony Buser Mon, 07 Aug 2006 03:11:00 GMT

I made a lot of progress this weekend on ruby-nxt. I got most of the Direct Commands completed. Update: ruby-nxt can now be found at rubyforge.

It makes programming the NXT as simple as:

require 'nxt.rb'

NXT.exec("/dev/tty.NXT-B") do |cmd|

  puts "Battery Level: #{cmd.GetBatteryLevel[0]/1000.0} V"

  cmd.PlaySoundFile(true,"Good Job.rso")
  sleep(3)
  cmd.StopSoundPlayback

end

Once I get it a little more polished, I plan on also creating a Ruby On Rails plugin. Forget Microsoft Robotics Studio. ;)

Trackbacks

Use the following link to trackback from your own site:
http://www.juju.org/articles/trackback/410

Comments

Leave a response, Track co.mments

  1. Avatar
    DannyStaple Tue, 08 Aug 2006 06:11:39 GMT

    Tony, this is seriously nice. I am going to have to try this out on my linux box at some point when I have the tuits.

    Until then, I have blogged this at orionrobots: http://orionrobots.co.uk/tiki-viewblogpost.php?blogId=1&postId=113

    Unfortunately, I have not got trackback pings coming out of my CMS at the moment, but rest assured I have linked to you from there.

    Have you thought about how this, and the phone AT command menu setups, could be used together? Having a ruby script to setup a series of commands, try them out, then send them to a mobile to attach to a button?

    Danny

  2. Avatar
    Tony Buser Tue, 08 Aug 2006 13:08:11 GMT

    Hi and thanks. If only there was a ruby interpreter that ran on a cell phone. :) If you use ruby-nxt and set $DEBUG = true, it will print out the bytes that it's sending and recieving so it could be used to figure out what commands need to be sent to do what you want.

    As for getting it working in linux, check out this page for how to pair the NXT. I haven't tested it yet, but I will when I get a chance. If you get it working let me know. Also, the ruby-serialport module says it works in windows also. Instead of passing a "/dev/ttyS0", you'd pass it "COMx" where x is the port number.

    You had asked about licensing on your blog, consider it GPL. :) I'll stick it in the comments when I get a chance.

  3. Avatar
    Tony Buser Tue, 08 Aug 2006 13:13:21 GMT

    Apparently it's not quite that easy on windows, you need a compiler. For more info check here. I probably won't be testing it on windows.

  4. Avatar
    Tony Thu, 17 Aug 2006 03:05:53 GMT

    I got it working in windows under cygwin!

  5. Avatar
    Tony Tue, 22 Aug 2006 01:34:16 GMT

    Check out someone created an nxt direct commands module for perl.

  6. Avatar
    Seriously awesome Thu, 31 Aug 2006 05:10:31 GMT

    This is awesome. Exactly what I've been looking for. Please do keep working on this. I'm hooked up to your svn repository.

Comments