Trying to adapt Jean-Louis' tricopter code to IMU V3

'm having some trouble adapting the new IMU v3 to Jean-Louis' code written for tricopters.  His code used the APM_Compass library and for some reason, it wont compile with any reference to that library.  The new IMU doesnt use that library, so I havent let that stop me from trying.  It compiles and gives me output, but something is still wrong.  The debug wont print GPS and the attitude values although stable seem way off.  I'm hoping some experts can look at my code and tell me what's wrong or even what is right.

I've included the code I have now.  Please help if you


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

Join diydrones

Email me when people reply –


  • Harry, little update. I looked through my stuff and have come up with a few options, the best two are; the arduIMU with the CERB40 (STM32F4 processor), or the STM32F1 IMU (same sensors as the APM 2.5)...

    Wife just left for Texas for 10 days so I will be getting on this ASAP along with some range time to get my marksmanship back on par...
    • Jeff, I hope youre out there.  I got this working on a $15.00 board running FreeIMU for attitude and Jean Louis' Ardimupter code.  It's running at 100Hz. 

      • Hey Harry, I'm still around :-) Haven't been playing much, but summer is on the way....

        I'd love to see what you came up with. I've been eyeballing the new 32 bit flight controllers but still haven't found one in the 28mm width I need for the little Align copters.

        I have been fairly consumed with a CNC machine I'm putting together, it's rough communicating with companies that are 18 hours ahead. Lots of late nights on the PC. Cashed out part of my IRA and borrowed a little, I'm going to be about $32K into it by the time I can make a $1 part LoL.

        Good to hear from you.

        • Glad to hear it Jeff.  I know your projects are heavy duty.

          I put the props on and tried it and was disappointed again.  Something must be backwards because it kept trying to flip and finally broke something.  I'll try it again. 

  • Well, I ended up "volunteering" my weekend to the wife, we camped, hiked, and bird watched :-) It was a good break but kept me away from the computer LoL.

    The multiWii thing does interest me as far as similar bits and pieces. I've also been eyeing some micro quads that also use all the same components.

    Too much to do and never enough time :-) I'm still working on the mill rebuild too, and it needs some shopping time as well. I will be in the hobby room with my evenings all this week so I'll keep you up to speed on the progress.
  • Sweet! That means your getting some flying in :-)

    I have my APM's solid mounted, it seems to me that vibration issues stem from props, motors, and rotors being improperly balanced, together with the damage they do to the supporting bearings...
    If there is no vibration issues to begin with the isolation is just attitude error vs. the airframe.

    I didn't get the heli out last weekend, wife wanted to do some shopping in Denver (I relented, happy mom= happy world LoL). Memorial weekend is dedicated to mill repairs/upgrades. If I get hung up on something I'm going straight for the copter :-)
  • No worries with the APM, if you can't get it working I can likely sort it out if its not a dead processor. Lemme know if we need to send it back and forth.

    I got my end mills and the CF showed up early so I hope for a productive weekend.
  • Harry, I'm Ok :-) Actually been waiting with baited breath to hear how your test flight went, but didn't want to rush you LoL

    I didn't get a notive for the last two post's you made though, maybe because I didn't visit the forum since the notice? The last one I saw was when you had corrected the servo direction and were loc-titing some hardware, so I figured you weren't far from a test flight.

    Re the binary output I looked at this a little bit for linking the IMU to a daughter board for doing the heavy math (Floating point unit in the STM32F4), but couldn't wrap my head around it :-)

    Now that I'm looking back in the thread a bit I don't see my last post??? Wonder if my computer was acting odd...

  • Yah, but your is flying and mine is still being built LoL

    P.s. I put my IMU/misc flight controller bread board on the wall in front of my work station to be a constant reminder of the goal here :-)
  • Harry, if I didn't know better I'd say the tail servo is reversed :-)

    Try arming the APM (props off or esc unplugged) throttle it up as though it would be hovering, then rotate the tricopter clockwise looking down on the top. The tail servo should rotate clockwise (leaning the top towards the right facing the back i.e. tail to you) that's what it would need to do to counter the rotation... bet it's reversed and leans left helping the rotation :-)

    I spent all weekend sorting out the SmoothStepper and getting all my parts machined, it's all done aside from enlarging the motor shaft holes on the motor mount brackets. Once I disassemble it all and finish the motor mounts it will just be down to the wiring and possibly re-thinking the ESC mountings. Right now I have them shrink wrapped to the arms, but I might fab up some actual brackets to hard mount them... dunno, haven't thought it through yet.

    I'll post up some pic's of the progress soon, but it's off to bed for now, got work tomorrow :-)

This reply was deleted.


DIY Robocars via Twitter
How to use the new @donkey_car graphical UI to edit driving data for better training
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…
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…
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:
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
Nov 9
DIY Robocars via Twitter
RT @JoeSpeeds: Sat Nov 6 Virtual DonkeyCar (and other cars, too) Race. So bring any car? @diyrobocars @IndyAChallenge…
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 👉…
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
Oct 23
DIY Robocars via Twitter
RT @DAVGtech: Another incident:
Oct 23