Monday, February 27, 2012

Monterey 2.0 - Preliminary Information

I have many big changes in mind for Monterey 2.0 (my FOSS ROV controller)!  How does having an ROV controller that works on OSX, Linux, Windows AND Android sound?  How does a simplified UX (user experience) sound?  Does a revamped UI sound like a good idea?  Finally, how does having a clean, simple example Arduino sketch for the bottomside (ROV firmware) sound?  Well, I've started designing these aspects of the controller.  I have learned quite a bit about OOP and Qt since I started working on Monterey v1.0 (my first decent sized Qt project), and I plan on applying what I have learned to Monterey v2.0.  

Preliminary Feature Set
  • A cleaner, neater code base! (also more focused on OOP than before)
  • Multiple motor configurations (4 horizontal/2 vertical, 2 horizontal/2 vertical and 2 horizontal/1 vertical)
  • Relay support (probably 3)
  • Servo support (probably 2)
  • Depth, heading and voltage sensor support
  • Fully functional (and well commented) example sketch for the Arduino Ethernet
  • USB joystick support
  • Easy debugging
  • Simplicity of use
  • A revamped UI with nicer widgets that get the job done better (graphs, compass, LEDs, etc) than their old counterparts in Monterey v1.0
And of course, if you want to add more features or use another bottomside microprocessor, you can change whatever you need to!  The topside code will be completely open sourced (I just need to find a license that I like and that I can use... it'll most likely be GPL'ed or LGPL'ed, although I would like a freer license), so you can tweak it how you'd like.  And since the topside talks to the bottomside over UDP, it'll be easy to use any bottomside architecture you'd like (Arduino, Propeller, BASIC Stamp, Raspberry Pi, etc).

I will also be simplifying the packet layouts.  There really is no need for the bottomside to echo up packets to the topside, so I'll get rid of that "feature."  I also plan on making the bottomside firmware respond to changes in settings in the topside firmware (i.e. the firmware will automatically detect changes in the motor layout if that change is made in the topside).  

I'll be posting more information, diagrams, flowcharts and screenshots as this unfolds.  I will still wait until June of 2012 to release the source, though (whether completed or not).

Thanks for stopping by!

Chris K

Sunday, February 26, 2012

Qt + SDL on OSX Tutorial

I know that I promised a tutorial on using SDL with Qt on OSX, and here it is (complete with screenshots)!

To download the example application that I used (Joypick), go here.  You will obviously want to get the source code, not the executable.  It is under the "Source" tab.

Step 1:  Download the SDL Library


Go to the SDL download page to download the OSX runtime library.  It'll download as a *.dmg file.

Step 2: Copy Files
Open up the *.dmg and select the "devel-lite" folder.  Next, copy the "SDLMain.h" and "SDLMain.m" files to a place of your choosing.  I like to copy this kind of files to ...QtSDK/ExternalLibs/ on my hard drive.  It's just a nice place to keep them organized, although you can put them wherever you want.

Step 3: Install Framework
Next, copy the "SDL.framework" folder from the *.dmg to /System/Library/Frameworks/.  That is all there is to installing the framework.

Step 4:  Modify the *.pro File


Here is how my *.pro file looks.  I've modified it slightly from the original to get rid of the Windows related information.  Then, right-click (control-click) on Joypick (under Projects) and click on "Add Existing Files."
Next, locate the "SDLMain.h" and "SDLMain.m" files on your hard drive and select those.  Then click on "Open."  Qt Creator will automatically modify your *.pro file to include these files.

Step 5:  Link to the Framework
Now it is time to link to the SDL.framework that you installed earlier.  Go ahead and add the two lines that you see in the picture above (lines 17 and 18) exactly as they are shown (working on Snow Leopard).  I'll show them below.

QMAKE_LFLAGS += -F/Library/Frameworks/
LIBS += -framework SDL

Step 6: Undefine main
Because of SDL, you'll need to undefine main in your "main.cpp" file.  See picture above for more information.

Step 7: Fix the Crash
Open up "qjoystick.cpp" and go to where
void QJoystick::setJoystick(int js)
{
     Q_ASSERT(js < availableJoysticks());
     Q_ASSERT(js >= 0);
     
     SDL_JoystickClose(m_joystick);
     m_joystick = SDL_JoystickOpen(js);
}
is.  Go ahead and comment out the line that says
SDL_JoystickClose(m_joystick);
.  This line causes the application to crash almost each time it is run when not using an XBox 360 wired joystick (bug confirmed on Windows but not tested on OSX).

Step 8: Build and Run!
Go ahead and run Joypick.  It should work like a charm!  I tested this out using a Logitech Extreme 3D Pro joystick on Snow Leopard.  Enjoy being able to run SDL applications on OSX!

I hope this helps out!

Chris K

P.S.  If you have any questions, feel free to ask them in the comments.

Tuesday, February 21, 2012

Serial COM Between Arduino and Android

If you're looking for a serial monitor application for Android that lets your tablet (or phone) talk to an Arduino, check out Slick USB 2 Serial.  It can mimic the Arduino IDE's serial monitor, which is helpful for debugging projects that aren't on the benchtop!


Here is it working on my Acer A500 with Honeylicious 3.2.1.  The output you see is from my Arduino Duemilanove running the serial ASCII table example sketch.  I have also confirmed that this application works on Thor's ICS build v96 for the Acer A500.

Happy serial monitoring!

Chris

Friday, February 17, 2012

Qt + SDL on OSX

First things first:  I spend way more time in Windows 7 on my MacBook Pro than I do in OSX SL.  So when I finally learned a little about OSX's frameworks and *.dylibs I thought I'd give Qt and SDL on OSX another try.  After about 30 minutes of research, I have successfully used SDL on OSX to read joysticks using a Qt application!  Now, I can configure Monterey to compile on OSX and rov-suite will be another step closer to it's full cross-platform distribution that I set out to create when I first started it.

Here's the photographic proof:



I got the original Joypick source code from http://code.google.com/p/joypick/.  By the way, the developer of Joypick is the same guy that I got the QJoystick class from... which I use in Monterey.  It's the best class that I've found out there for reading USB joysticks.  If you are looking to use USB joysticks in Qt, check it out!

I'm pretty busy right now with things other than programming, but I'll post a tutorial about how to use Qt and SDL on OSX here soon (within the next week).  

Thanks for stopping by!

Chris K

Tuesday, February 14, 2012

rov-suite

I've been getting most of my traffic recently from my rov-suite project pages at Sourceforge and Google Code.  I'd just like to say to those of you who are looking into rov-suite that I am still working on the project and that I still am going to re-release it with new features and bug-fixes in June of this year.

I repeat:  I am still working on rov-suite and I am going to re-release it with new features and bug fixes in June 2012.

I will post to the OpenROV and HomeBuiltROVs forums when I release it, so if you browse there then you will know when it's out.  I apologize for any issues this may cause you.  If you would like to get more information about it or if you would like to get the older version of the code, you can contact me and I can email it to you.

For those of you who don't know, I took down the rov-suite code because I am on an underwater robotics team and I don't want to aide my team's competition this year.  I have also been using my team's topside application (a branch of Monterey) as a testing ground for new features to add, as well as a revamped interface. Also, I have been getting more proficient in Qt, so plan on seeing better source code, a better UI and more custom widgets (graphing, etc).

Again, I apologize for the delays, but I hope that you understand why I've had to temporarily take down rov-suite.  I honestly cannot wait to open it back up!

Thanks for reading,

Chris

P.S.  Thanks to Android's USB/BT Joystick Center, the Android based ROV controller is under development.  And if I can get my hands on a Raspberry Pi, you may even see completely Raspberry Pi based ROV (both topside and bottomside) control system.

Sunday, February 12, 2012

Android ROV Spy

I've been doing some playing around recently with Necessitas to do Android development using Qt.  It's been quite enjoyable!  I am able to write an application that runs on a desktop environment AND an Android device with the exact same code.  While the results aren't that pretty (I haven't bothered to make it look nice yet), they work like a champ!  Here, I'm able to use all of the standard Qt libraries that I usually use while also using two custom classes that I found online (QLedIndicator and QCustomPlot).

This little application that you see above is my second Qt + Android application.  This one is made to sit on the same network as a ROV and its control system and spy on them.  This displays software versions, communication statuses, motor values, relay statuses, voltages, servo values, packets per second for each controller, leak state, depth, vertical motor values and the joystick positioning.  In the box on the bottom right, the blue line with the box shows the joystick position (and therefore how the ROV is responding).  The horizontal blue line above it shows rotation.  In the upper right hand corner, the depth is graphed (that blue line is actually Photoshopped in, but the real line looks just like that).

It's been a pretty fun project, and I plan on using the experience and knowledge gained in making this when I make an Android tablet application that can drive a ROV.  That is one of my next major projects.  My only hurdle which is preventing me from doing that at the moment is getting Qt to read USB joysticks (using SDL on the desktop).  My current thought is using Java and the Android SDK to write a service that reads the joystick and sends its values over UDP.  That way, with one service, I can make multiple joystick reading applications.  Also, if I write that service, then other people can use it to give their applications USB joystick support.

I really need to create a public SVN repo which I can upload all of my code of this nature to.... I'm thinking either Google Code or Sourceforge, but I'm not sure which.  I know that Sourceforge has fancier features and more capabilities, but I'm really only looking for a simple way to share my latest code with whomever wants to access it.  If you have any suggestions, feel free to let me know.

Thanks for reading!

Chris

Thursday, February 9, 2012

Qt 4.7.4 and Widget Promotion

For those of you who don't know, QtCreator's "widget promotion" feature is a handy way to use custom widgets in QtCreator without having to compile a plugin.  The problem on Windows is that QtCreator is compiled with MSVC, but it ships with the mingw compiler.  Well, QtCreator's plugins must be compiled by the same compiler as QtCreator.  In short, if you want to compile a QtCreator plugin, you must either recompile QtCreator from source, or just use widget promotion.  I've done both, and let me tell you, widget promotion is easier, quicker and simpler.

If you'd like to see an exhilarating tutorial video, I've uploaded one to YouTube.



Happy promoting!

Chris K

Hello, World!

So I've just started doing this blogging thing to document my travels through technology.  I'll be using this blog to share my projects (code included, for those of you who like to see the C++ behind everything) and hopeful help out others in theirs.

A little bit about my tech background:

  • I dual booted my computer (XP and Ubuntu) when I was in 6th grade.  The triple-boots came soon afterwards.
  • I taught myself basic HTML when I was in the 6th grade, although I've forgotten it by now. ;)
  • I built my own desktop in 8th grade.
  • In my freshman year of high school, I started to program calculators in TI-BASIC.  That is really when I developed my love of programming.  
  • Halfway through my freshman year, I picked up an Arduino and started learning C++.  I became a programmer for my underwater robotics team, too.  The Arduino ROV firmware that I wrote helped my team win first place in the collegiate division of an international robotics competition.
  • After 1.5 years of only Arduino programming, I found out about Qt and decided to take it for a spin.  Less than 6 months later, I had already developed a few Qt applications, one of which is a FOSS ROV controller (Monterey).
  • As of December 25, 2011, I have started to use Qt to write Android apps (albeit not very many).
I currently have a fair amount of projects going on.  Most of these projects are related to underwater robotics and my robotics team, although some are not.  As these projects progress, I plan on updating this blog with information regarding them (so stay tuned!).

For those of you who found this blog because of my FOSS ROV controller (codenamed: Monterey), please understand that I am waiting until June 2012 to re-release it.  I apologize for any issues this causes, but I promise that it'll have a bunch of new features (and cleaner code)!

Thanks for stopping by,

Chris K