- May 22, 2015 at 9:47 am #4023jawoodParticipant
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 inclinometer.sh and put
Then made it executable
Sudo chmod 755 inclinometer1.sh
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.May 22, 2015 at 12:07 pm #4025jawoodParticipant
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….May 22, 2015 at 1:01 pm #4026Mark WilliamsKeymaster
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 --OzzMaker.com --July 2, 2019 at 10:44 pm #8185LCParticipant
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.July 2, 2019 at 11:22 pm #8186Mark WilliamsKeymaster
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 --OzzMaker.com --
- You must be logged in to reply to this topic.