R/C Radio Control over a Propeller using SPIN
Hi All,
As a new propeller owner and relatively new hobbyist, I posting to ask if there is existing SPIN code to read in pulses from an R/C controller (receiver).
My project is for a basic autopilot for my RC plans and I want to switch from manual-to-Propeller control by reading a servo control channel. (I'll be passing servo control thru for the other channels). I have read several examples under BS2, but nothing specifically for SPIN, and I have searched the forums and have not come across this type of scenario.
I'll be happy to post my results as I make headway.
Thanks for your examples and pointers!
Paul
As a new propeller owner and relatively new hobbyist, I posting to ask if there is existing SPIN code to read in pulses from an R/C controller (receiver).
My project is for a basic autopilot for my RC plans and I want to switch from manual-to-Propeller control by reading a servo control channel. (I'll be passing servo control thru for the other channels). I have read several examples under BS2, but nothing specifically for SPIN, and I have searched the forums and have not come across this type of scenario.
I'll be happy to post my results as I make headway.
Thanks for your examples and pointers!
Paul
Comments
···· Bry.
Good Idea - I had though about that but was concerned that the BS2 library would take more resources than native code. Is this concern founded or Is there a performance hit using PULSIN or RCTIME? And Yes I know I have 8 cogs to pick up any slack
Paul
I have two goals for the project
1. Be at a safe altitude
2. Come Home
I fly my plane from a first person view with a video downlink. I want the the propeller act as a safety in the event that I loose the video downlink, or the R/C control uplink. If I can get the plane to come closer to me after a failure, the theory goes that the control and video should return. Here's the highlevel overview for a system to return the plane to it's takeoff location. It's nowhere near code yet, but its the flowchart:
1. Record the starting location (Lon/Lat/Alt) to a variable, maybe write to a flash card.
2. Plane has onboard GPS which provides HDG (compass heading), ALT(altitude), Log/Lat.
3. By subtracting the two Lat/Lon coordinates the using the Float32Full ATAN2 function on the difference, I can compute the bearing the plane needs to go.
4. Subtract again the current heading from the needed bearing and make the turn decision: 1-180 means turn right, 180-360 (or 0- minus180) turns left - I might have that backwards...
5. Tell the rudder servo to make a gentle turn.
6. When the plane is close to "home", start circling at a a predefined radius, or just let the routine above keep turning the place around.
My plane is very stable, so if I make these "flat turns" I can slowly bring it to the right direction. There are a few special cases for the math, as well as real-world concerns (like going to a preset altitude above the ground first, keeping level, etc) but I think I have a handle on them.
I'll keep posting as I make progress. Be warned - It'll take me a few months at least! You can check out my 2 video pilotage videos on my website at www.hubner.net. There is one early take and one funny, err, "landing". I'll post more as I make them.
Thanks!
Paul
Post Edited (Paul H) : 2/27/2007 2:21:28 PM GMT
There's an insignificant performance hit in using the BS2 routines. The main issue is that the portions of the BS2 library that you don't use are still occupying memory. If you have plenty of memory, who cares? If memory is tight, you can cut and paste the routines you need into your own program and discard the rest. There are a couple of global variables (uS, ms, s) and a global constant (cntMin) that you'd have to include, but that's easy.
· http://www.micropilot.com/autopilots.htm
The micropilot gear is probably (literally) bulletproof and does a heck of a lot more than mine, but I really am not too worried.
And now that I've written that, I'll have something to eat if I'm wrong
Mike - thanks for the info - This will make my first trys that much easier.
Paul
·Bry.