Ruby in FlightGear gets a GUI!

Boring old black and white text scrolling down a screen isn’t very attractive, right? (Refer to my previous post). So with this on my conscience I set out to give my ruby program, which gets data from FlightGear, a nice pretty interface… well sort of pretty.

So… here it is!

Now when dealing with constant processing of input or output data and in my case it is data being received, as well as a graphical user interface you are asking ruby to do two things at once. In the general scheme of things it is not what simple old ruby does, all it knows is to run through a series of instructions and then either loop back over those instructions or terminate, that being said with exceptions. So let me now introduce threads.

Ruby threads, without going into to much detail, allow multiple processes to run parallel to each other. So I needed ruby to not only be managing the GUI but also receiving and processing I/O data and thus the use of threads.

Setting up a thread is quite simple:

And you can find more information about them in the ruby core libraries documentation, see here.

Like the rest of my programs featuring GUI’s I have a soft spot for FXRuby, and I really don’t know why but I think it is mainly because it works, strangely enough. To allow me to update each piece of information (speed, altitude, etc.) I used FXRuby’s Data Targets which I setup to be updated from within the threaded receiving process.

All in all it is a pretty straight forward program but there are still plenty of loose ends needing to be tied up before I can call it a completely finished. It doesn’t even fulfill its intended purpose yet so there is plenty more to do.

If anyone is interested in the complete ruby code post a comment (with your email address) or send me an email and I will forward it on to you.

Stay tuned for more!


Ruby, IronRuby and FlightGear – The Perfect Trio… maybe

Ruby, IronRuby and FlightGear; Three big subjects in their own rights but here I am mixing them all together and perhaps getting into things a little to much over my head.

The idea of using these three programs is to get real time data from a flight simulator program and then process and output it through ruby. Also a future goal is to be able to send data  to control different systems while in flight through external components.

The following post contains information on FlightGears .xml protocols and configuring the simulator to output data through a socket. Also two scripts in Ruby and IronRuby which gets data from FlightGear and displays it.

Please also note that you will find that some information I give is similar to what is given at http://linkslink.wordpress.com/takeoff/ as I used the information as a guide when I was learning about the .xml Protocol files and has led me to some handy .Net libraries when using IronRuby.

Read the rest of this entry »


QANTAS and its shiny new toy

It just so happens that the glide slope on the approach to Brisbane’s Airport is directly over where I do my training for avionics so I caught the QANTAS A380 on its final approach. Unfortunately I didn’t have my trusty point and shoot camera so I had to use the one on my phone. I apologize for the bad images.


The Bench-top Power Supply

So here is yet again another infrequent post in this mess called a blog. If I was a reader of it I would have lost interest long ago and forgot the address to this site but then again I am just one of those impatient sort of people. Yet with this in mind I do endeavour to be a little more constant with my posts. I have tried to make things a little bit more interesting by adding a new section which has got some of my photography of aircraft and aviation in general which I hope you enjoy.

Anyway by now you are asking why I named this post The Bench-top Power supply so I’ll get straight to the point: I needed something to do… so I made a Bench-top Power Supply. There are plenty of other things I could of made which would have been much more stimulating and interesting but the fact is having a variable power supply is so handy and I would add a few small features which I find come in handy.

I have used a standard step down transformer (240 VAC to 15 VAC), a bridge rectifier kit and a voltage regulator kit from Jaycar (www.jaycar.com.au). So thats the basic idea to a power supply, I then added terminals to plug in a dc supply to be regulated (i.e. Car battery) and a toggle switch to select between the ac and dc sources. I then added a tie switch which allows the power supply to be either floating, positive tied to earth or negative tied to earth. Call me lazy but it saves the extra wire to do the tying for you.

I hope to be a little more frequent now with this blog but no guarantees as I’m coming to the end of my avionics course so I’m a little busy. Anyways, Enjoy.


Follow

Get every new post delivered to your Inbox.