Run Inclinometer from Desktop Icon

Home Forums Forums Technical Support for BerryIMU Run Inclinometer from Desktop Icon

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #4023

    Hi, I have been trying to get the Inclinometer to run from a desktop icon, but have not had much success. Was hoping you might be able to help with this.

    I created a folder /home/pi/inclinometer which I have placed the 3 image files and the compiled c script called inclinometer1.

    If I run sudo ./inclinometer from with in the home/pi/inclinometer directory it works fine

    If I run it from anywhere else I get an error cant load images and stops execution.

    I created a and put
    sudo /home/pi/inclinometer/./inclinometer1
    Then made it executable
    Sudo chmod 755

    if I double click this .sh file it opens the inclinometer no problems but I cant close the window. (Would like to know how to allow closing of the window).
    If I run this file from anywhere but the folder that contains inclinometer files I get the failed to find images again.

    Any assistance would be appreciated. Thanks

    P.S. I have made a few changes to the script I posted with the Kalman Filter applied. I changed to not disable the mouse and set the size of the window to 480 x 320. This way I can open the app from with in a Remote Desktop Connection and use the inclinometer remotely. (As im using it as a spirit level for my caravan, I can go to each corner and jack the van with my mobile phone RDPed into the Pi with the inclinometer on it.


    For those that are interested I did work out how to make it work full screen and without a title bar.

    if you just want no title bar add |SDL_NOFRAME to the end of
    screen = SDL_SetVideoMode(480, 320, 0, SDL_SWSURFACE); (note I’ve change the first bit of this to hard define the size of the window the same size as the back ground image. Should look like this now
    screen = SDL_SetVideoMode(480, 320, 0, SDL_SWSURFACE|SDL_NOFRAME); if you want to run full screen you only need to add |SDL_FULLSCREEN instead of SDL_NOFRAME the full screen command removes the boarders automatically.

    If you remove the title bar you wont be able to move the window around the screen.
    If you cant get to the terminal window you used to start the inclinometer you wont be able to kill it easily. (Need to work out how to enable the close button on the title bar, and how to move window when no frame.)
    Also would be nice to be able to get it to run from a shortcut on the desktop….

    Mark Williams

    What about starting and stopping it from the start menu?

    This is what we do for matchbox keyboard.

    To stop, we look for the process and then kill it.

    Mark --


    Hi Jawood (or Mark),

    I’ve found the complimentary filter in the inclinometer script still has a big drift in it (which I think is coming from my gyro readings). From your comment above, it seems like you’ve modified the script to work with a kalman filter. Do you still have that code? Or is there another way I can get a better reading for use in this inclinometer example?

    I’ve never coded in C and tried to modify the script to use KFangleX and KFangleY but I must have made some errors as it wont compile.

    Thanks guys.

    Mark Williams

    The gyro reading will drift over time. This is okay as we only need to trust once every loop.

    The output from the complementary filter(CFangleX)Shouldn’t drift as it trusts the accelerometer a lot more than it trusts the gyro.
    Try playing around with this value to see if it improves

    #define AA 0.97 // complementary filter constant

    Mark --

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

Blip, blop, bloop…