ruby-nxt 0.8.0 4
We've made quite a lot of progress on ruby-nxt. The new version is a pretty complete implementation of the NXT direct command set. Almost everything is pretty well documented now, too. One of the more interesting things I've been working on is a high level api based on the "blocks" in NXT-G. So if you're familiar with the way NXT-G works, you should be able to pick it up pretty easily with code such as:
t = Commands::TouchSensor.new(@nxt)
t.port = 1
t.action = :pressed
while t.logic == false
puts "Hold down the button..."
sleep(0.5)
endNow that it's pretty complete and usable, I think I'll finally get around to making a Ruby on Rails plugin, which was the original reason I started all this! :)
ruby-nxt 6
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
endOnce I get it a little more polished, I plan on also creating a Ruby On Rails plugin. Forget Microsoft Robotics Studio. ;)
mod_fcgid Slow Startup on Ubuntu Fix 1
I recently switched to using modfcgid instead of modfastcgi. So far its nice and fast... except for the first hit after a period of inactivity. This is because fcgid kills off idle processes and it takes an annoyingly long time to start one up on this server. It turns out there is an option to set a minimum number of processes, however the version of mod_fcgid on Ubuntu Breezy doesn't have it. Here's how I installed it:
sudo apt-get install apache2-dev
Download mod_fcgid 1.09 or greater
Edit it's Makefile and change top_dir = /usr/share/apache2
make
cp .libs/mod_fcgid.so /usr/lib/apache2/modules
Edit /etc/apache2/mods-available/fcgid.conf and add a line that says DefaultMinClassProcessCount 3 and restart apache.
The first hit after a restart will be slow, but from then on it will maintain at least DefaultMinClassProcessCount processes.
Juju