Artificial Horizon in processing 2.0

I found a program written in processing 2.0 that takes mouse movement and displays it in an artificial horizon and a heading indicator.  I added serial and changed the input from mouseX and mouseY to the Euler angles coming from the ArduIMU.  The heading indicator works perfectly.  The problem is pitch and roll movement is limited to about 45 degrees roll and 0 - 90 degrees pitch.  I'm not sure how to fix it and hope somebody will try it out and take a look at it. 

I tried to replace the mapping of the mouse with sin(Euler[1]) and cos(Euler[2]).  The map() in processing takes an input, then it needs the upper and lower range of the input, and then the upper and lower range of the target.  For sin and cos, I used -1 to 1 as the input range. 

To try it out, you need to run FreeIMU on the ArduIMU and you need processing 2.0.  There's a line in the first sketch to select your comport.  Mine was COM4 so just edit that to match yours.

It almost works, just needs something.  Thanks for helping.

ArtificialHorizon_rev2-131219a.zip

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

Join diydrones

Email me when people reply –

Replies


  • float X = (Euler[2]);
    float Y = (-Euler[1]);
    float newX = map(X, -PI/2, PI/2, -150, 150);
    float newY = map(Y,-PI/2,PI/2, -150,150 )+150;


    I changed those 4 lines in the movingHorizon sketch. It's much better, so if you try it with your IMU
    I recommend making that change. I changed the range of the input to -PI/2 to PI/2 and I added 150 to the Y and that brings the indicator to level at start.

    I'd really like some input to improve it. Thanks.

This reply was deleted.

Activity

DIY Robocars via Twitter
RT @chr1sa: Just a week to go before our next @DIYRobocars race at @circuitlaunch, complete with famous Brazilian BBQ. It's free, fun for k…
1 hour ago
DIY Robocars via Twitter
How to use the new @donkey_car graphical UI to edit driving data for better training https://www.youtube.com/watch?v=J5-zHNeNebQ
Monday
DIY Robocars via Twitter
RT @SmallpixelCar: Wrote a program to find the light positions at @circuitlaunch. Here is the hypothesis of the light locations updating ba…
Nov 26
DIY Robocars via Twitter
RT @SmallpixelCar: Broke my @HokuyoUsa Lidar today. Luckily the non-cone localization, based on @a1k0n LightSLAM idea, works. It will help…
Nov 25
DIY Robocars via Twitter
@gclue_akira CC @NVIDIAEmbedded
Nov 23
DIY Robocars via Twitter
RT @luxonis: OAK-D PoE Autonomous Vehicle (Courtesy of zonyl in our Discord: https://discord.gg/EPsZHkg9Nx) https://t.co/PNDewvJdrb
Nov 23
DIY Robocars via Twitter
RT @f1tenth: It is getting dark and rainy on the F1TENTH racetrack in the @LGSVLSimulator. Testing out the new flood lights for the racetra…
Nov 23
DIY Robocars via Twitter
RT @JoeSpeeds: Live Now! Alex of @IndyAChallenge winning @TU_Muenchen team talking about their racing strategy and open source @OpenRobotic…
Nov 20
DIY Robocars via Twitter
RT @DAVGtech: Live NOW! Alexander Wischnewski of Indy Autonomous Challenge winning TUM team talking racing @diyrobocars @Heavy02011 @Ottawa…
Nov 20
DIY Robocars via Twitter
Incredible training performance with Donkeycar https://www.youtube.com/watch?v=9yy7ASttw04
Nov 9
DIY Robocars via Twitter
RT @JoeSpeeds: Sat Nov 6 Virtual DonkeyCar (and other cars, too) Race. So bring any car? @diyrobocars @IndyAChallenge https://t.co/nZQTff5…
Oct 31
DIY Robocars via Twitter
RT @JoeSpeeds: @chr1sa awesomely scary to see in person as our $1M robot almost clipped the walls as it spun at 140mph. But it was also awe…
Oct 29
DIY Robocars via Twitter
RT @chr1sa: Hey, @a1k0n's amazing "localize by the ceiling lights" @diyrobocars made @hackaday! It's consistently been the fastest in our…
Oct 25
DIY Robocars via Twitter
RT @IMS: It’s only fitting that @BostonDynamics Spot is waving the green flag for today’s @IndyAChallenge! Watch LIVE 👉 https://t.co/NtKnO…
Oct 23
DIY Robocars via Twitter
RT @IndyAChallenge: Congratulations to @TU_Muenchen the winners of the historic @IndyAChallenge and $1M. The first autonomous racecar comp…
Oct 23
DIY Robocars via Twitter
RT @JoeSpeeds: 🏎@TU_Muenchen #ROS 2 @EclipseCyclone #DDS #Zenoh 137mph. Saturday 10am EDT @IndyAChallenge @Twitch http://indyautonomouschallenge.com/stream
Oct 23
More…