Instrument panel written in Python.


hey guys,
this might be of use to some of you:
i've scripted a set of basic instruments in Python that might be of use to some of you.
the Youtube clip shows it attached to my UAV project.

for anyone who hasn't used it, Python is a particularly easy to use programming language that is used for all sorts of applications.
there are loads of add on libraries to do much of the hard work for you which makes it particularly useful for this sort of rapid development.

the Python code can be downloaded here under the name "cockpit.zip":
http://sites.google.com/site/mrdunk/Home/downloads

more detail on my UAV work here:
https://sites.google.com/site/mrdunk/Home


dunk.
E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • hey Pete,
    it's the same version of the program.
    yours should look the same as my screenshot.


    the bright yellow you are seeing are part of the raw images.
    pyGame should make the yellow bits transparent, letting the layer beneath show through.

    so, in short, you should not be seeing any yellow.


    as for the green part,
    your talking about the background right?
    hrmm... that should be grey. i had presumed that was just Vimeo messing with the colour pallet.
    the line:
    screen.fill(0x222222)
    sets the background colour.


    so i don't know what to recommend...
    have you considered removing and re-installing Python and pyGame?


    dunk.
  • Developer
    Dunk, Thanks for looking into that in detail and setting up the Windows VM.

    Is that the normal colour scheme for the displays or a later version of the program ? (Mine is yellow and green).

    Best wishes, Pete
  • hi Pete,
    on a windows VM i can't reproduce your findings.
    it's a clean XP install running Python 2.6.6 and pyGame 1.9.1release-svn2575 .
    it works fine for me.


    is there anything unusual about the machine you are running?
    i'm wondering if this is an issue between pyGame and your graphics card...
    the Surface.set_colorkey call inpyGame that handles transparencies does have a flag for non accelerated displays.
    http://www.pygame.org/docs/ref/surface.html#Surface.set_colorkey


    dunk.
  • hmm. that should be similar enough.
    odd.

    it's late here but i'll have a dig about tomorrow and see if i can find any information on transparencies working differently on Linux and windows.
    they *should* work the same but it is possible we've run into a bug.
    http://enough.odd.it/
  • Developer
    Here are my python and pygame revision:-

    Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)] on win32
    IDLE 2.6.2 ==== No Subprocess ====
    >>> import pygame
    >>> pygame.__version__
    '1.9.1release-svn2575'
    >>>
  • hi Pete,
    that appears to be a problem with transparencies.
    the yellow area should be transparent.

    i suspect it's an issue with pyGame...
    any idea what version of pyGame you are using?
    i'm using '1.9.1release' on Linux.

    you can find out by running the python interpreter then entering
    pygame.__version__


    dunk.
  • Developer
    Dunk, here is a link to a screencast in which I test out the program on windows.
  • thanks everyone for the interest.

    hi Rana,
    hehe, that would kind of defeat the purpose of doing it my self though...


    Simon,
    hmm, not a bad idea. i think i have a windows virtual machine somewhere.
    how does py2exe work?
    anyone who uses my code will have to modify it to some extent to calibrate inputs, dial position on screen, etc.
    is it possible to edit the python script in an executable made with py2exe or will it need re-compiled afterwards?
    (i'm guessing not.)


    hey Pete,
    that's disappointing...
    i don't run windows so it will take me a while to dig out a windows virtual machine to test it.

    any chance of a screen shot?


    dunk.
    Forsíða
    Visit the post for more.
  • Developer
    I have run the code under Windows, and although it runs, the instruments are not displaying correctly when run with: "dial.py test". I have installed pygame and serial, and the window displays the instruments, but they do not update correctly and the images overwrite and go wrong. The code reads very nicely.
  • Great work... and GPL'ed. Cool.

    You might want to consider looking at py2exe to bundle up it up into a Windows execute for all those lacking python installs/experience.

    Cheers,
    Simon.
This reply was deleted.