Pages

Saturday, July 28, 2012

Wiimote Stellarium Plugin

As i wrote some days ago, I planned on doing some hack so control KStars with a Wiimote.
It turned out KStars isn't the right target, as it seems to have no plug-in support (and I don't want to modify core yet, as i'm still in an experimental phase).
But reading data from wiimote and correctly interpreting was already done some days ago, thought it was a little bit hard, so I switched to Stellarium instead.
This is the result: http://www.youtube.com/watch?v=BhVHJJaQ8Gs

Of course it's just experimental code, it's barely usable.. but it's a start.
Source is here: https://github.com/rockman81/StellariumWiimotePlugin

Now some technical stuff:
The Wiimote gyro sensors aren't easy to read, as they don't send you current angle, but only
It doesn't report current angle, instead it does report angular speed.
But afterall you can deduce current angle just dividing speed by elapsed time between each message report.
I had to do some tries before finding the proper way of "moving view window" on Stellarium.
It's not so well documented, and i'm not exactly happy about current solution, but it works, and i'll ask some help in their mailing list soon.
This solution anyway is easier than i thought, as it only receives as input angles delta, meaning it's also easy to "align" your telescope to stellarium (just point an object with telescope, then manually point stellarium to that object).
What's missing:

  • better calibration (angles "seem" correct, but i'm not entirely sure...)
  • better movement translation (i'm ignoring one axis, they should be all taken into account, and compensate misalignment).
  • Maybe some alternative way of displaying wiimote data in stellarium, such as a "virtual" object in sky. this way you can see how close is your telescope to a desired object.
  • Equatorial mount support (currently if there is an axis rotation it's not detected and properly corrected, and it's interpreted the wrong way).
  • ....many other stuff, but it's too early to get a detailed list :P

7 comments:

  1. Do I understand correctly that your are using the Wiimote as a digital setting circle? (Or at least a half of one - just reporting the current pointing direction of the telescope.) In that case, you may want to try writing an INDI driver, which then can be used by KStars's device support.

    ReplyDelete
  2. Yes, that's more or less the point.
    I was looking at INDI, but as I understood, my wiimote driver should send equatorial coordinates.
    Maybe i'm wrong, of course.
    I already tried to patch KStars by defining a virtual sky object (seems much easier than in Stellarium), but drift seems higher than in stellarium (probably because stellarium does better calculation than me).
    I'll try giving a better reading at INDI anyway :)

    ReplyDelete
  3. Great idea ! Unfortunately, I have some problems to compile it:

    I tried these steps:
    cd StellariumWiimotePlugin (did a git clone)
    mkdir build
    cmake ..
    make all install

    but make just does nothing. I tried to enter into the build directory before typing make, but nothing happens.

    ReplyDelete
  4. Oups, sorry, this is my fault. I deleted CMakeCache.txt and the compilation started. But I have this problem:

    ***/stellarium/plugins/StellariumWiimotePlugin/build$ make
    [ 4%] Generating ui_wiimotePluginDialogWindow.h
    [ 8%] Generating gui/moc_StelDialogWiimotePlugin.cxx
    [ 12%] Generating gui/moc_WiimotePluginWindow.cxx
    [ 16%] Generating moc_WiimotePlugin.cxx
    ***/stellarium/plugins/StellariumWiimotePlugin/src/WiimotePlugin.hpp:90: Error: Undefined interface

    Did I miss something?
    I've exported the STELROOT variable to a fresh stellarium build directory.

    ReplyDelete
  5. Ok, I got it. The STELROOT variable must point to the stellarium directory, not the build subforder used for compilation. It works perfectly, thanks a lot !

    ReplyDelete
  6. Ups... sorry, i just noticed your messages..
    I seriously think blogger is missing some kind of notice when someone comments your posts... or am I missing something? :P

    ReplyDelete
  7. Anyway, try the git branch here: http://gulinux.no-ip.org/gitweb/?p=stellarium-telescopeplugin.git;a=summary
    It's a rework of the default Stellarium Telescope Plugin (you have to substitute it in the stellarium source directory), it works much better than this first prototype, altough i'm still missing lots of stuff...

    ReplyDelete

Note: Only a member of this blog may post a comment.