Posted by Jason Short on September 13, 2009 at 2:30pm
I've been needing a simple RTL for my Easy Star based FPV system, so I bought the ArduPilot. Unfortunately, as Chris pointed out, the ArduPilot code doesn't handle the Fasst's way of setting an out of range PWM signal to be detected by the Ardupilot.So, last weekend I decided to start writing one from scratch specifically for my radio ( 7C 2.4GHz) and I flew it successfully today at Candlestick point in some decent 10mph winds. Things went so well I even had the plane deadstick landing on it's own in decent wind without toughing the controls. Here are some details...version .1 Features:- Auto-calibrate IR sensors, no Z used- Auto-calibrate Stick limits- Stabilization with proportional mixing - no thresholds- Futaba Fasst 2.4 failsafe detect through throttle- Plane will circle when in failsafe and maintain a 40% throttlenext up:- GPS code integrated from Ardupilot- proportional mixing for navigation mode when in autopilotApproach:To start I wanted to have full control at all times with the sticks, full resolution, and no dropped PWMs(@ 50Hz) from the receiver. I hooked up the 3 channels in from the radio to the ardupilot (I had to add a wire for throttle in.) Then I set up an interrupt to watch for ch1 to go high. After that I start timing the cascade of channels with a custom timer function. I also output the throttle while simultaneously watching for a failsafe. This all happens in approximately 3000-6000 µs.Next I read in the IR sensors, scale the input and apply a proportion of about .65 to them. Then I look at the ch1 and ch2 stick position to see how much pitch and roll to apply. Each channel calculates a mix independently and uses that mix to influence the final position. This way I can fly fully stabilized though I'm fully in control.For example:45° to 27° = 100% to 0%< 27° = no stabilizationFor failsafe, I currently just tilt the rudder slightly to the right to do a gentle turn. Next I'll add in the navigation code for RTL capability.Next week I'll hopefully have the RTL functionality in the air for testing. If you try this code out let me know how it works for you.Use:The code is self explanatory, and some wires need to be added to the AruPilot HW.You need to aim each IR sensor window at the ground and sky before each flight (or reset!!! be careful!!!)You need to move the rudder and elevator sticks with each reset to set the servo limits.Download XFPilotJason/
I'm not sure about the Z sensor. If i need it I'll add it, but right now it works without it. I'm trying to do as much as I can with as few sensors as possible.
My strategy for now it to do internal simulations of wind, velocity, turn integration, etc to do as much dead reckoning as possible. I'll add in GPS as soon as I get the simulator running smoothly.
No promises; this is all pretty new to me and I've always got ardupilot code from Jordi to fall back on.
Excellent keep up the good work i still dont understand the implentation but you are working on just what i need for my 7C radio to work with the ardupilot fully . are you going to be doing a Z sensor included program ?
Made a slight mistake when cleaning up the code. I uploaded a new one which should compile. Glad you like it. I'm going for the T3 contest with as much custom code as I can.
Jason
Comments
My strategy for now it to do internal simulations of wind, velocity, turn integration, etc to do as much dead reckoning as possible. I'll add in GPS as soon as I get the simulator running smoothly.
No promises; this is all pretty new to me and I've always got ardupilot code from Jordi to fall back on.
i like it , good work
jeremy
Way to go. This project sounds fantastic. I look forward to trying it out once you have it doing RTL.
-Peter
Jason