Propeller - Radio Control Pulse Capture and ReGen program
Paul_H
Posts: 85
Hi All,
First off - thanks for the help getting this running! I have written a routine that may be useful if you are building a partially autonomous robot. The attached code captures the control pulses from your Radio Control receiver on pins 1-6 and stores them to an array Rx[noparse]/noparse. You can try more than 6 channels, but its all I have.
Then you can choose to forward the pulses to the Servos for realtime/manual control or have the Propeller take over the servos for other purposes (like a Return-to-home-Autopilot, which is my eventual goal). For now, "Propeller control" means setting all servos to their center position value 760.
I use the landing gear switch (my Futaba's channel#5) or variable Rx[noparse][[/noparse] 4] to toggle between the two settings. It uses "4" because arrays start at "0" (thanks Mike!)
It uses the following great objects:
-- TV_TEXT for viewing the variables
-- BS2_Functions for the input and output
and needs 3 Cogs total (I think...)
This is my first project code, so it may not be the most efficient. Please comment or make suggestions to improve. I could not have gotten this far without being on the 'shoulder of giants'!
Thanks and please use this as you wish,
Paul H
First off - thanks for the help getting this running! I have written a routine that may be useful if you are building a partially autonomous robot. The attached code captures the control pulses from your Radio Control receiver on pins 1-6 and stores them to an array Rx[noparse]/noparse. You can try more than 6 channels, but its all I have.
Then you can choose to forward the pulses to the Servos for realtime/manual control or have the Propeller take over the servos for other purposes (like a Return-to-home-Autopilot, which is my eventual goal). For now, "Propeller control" means setting all servos to their center position value 760.
I use the landing gear switch (my Futaba's channel#5) or variable Rx[noparse][[/noparse] 4] to toggle between the two settings. It uses "4" because arrays start at "0" (thanks Mike!)
It uses the following great objects:
-- TV_TEXT for viewing the variables
-- BS2_Functions for the input and output
and needs 3 Cogs total (I think...)
This is my first project code, so it may not be the most efficient. Please comment or make suggestions to improve. I could not have gotten this far without being on the 'shoulder of giants'!
Thanks and please use this as you wish,
Paul H
Comments
One thing to note: please ensure that your code and hardware have some sort of failsafe In code this could be a simple counter or - better still - interrogating a variable that you KNOW what value to expect at various location in your code AND will change if your code's running normally. (Hope that reads OK?!)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheers,
Simon
BTW: I type as I'm thinking, so please don't take any offense at my writing style
www.norfolkhelicopterclub.co.uk
You'll always have as many take-offs as landings, the trick is to be sure you can take-off again ;-)
The way I look at it, this code is a failsafe to my flying!! (rimshot) But seriously....
I do agree and I plan to implement a cog-status interrogator to make sure the hardware is up and running. I had considered making the passthrough external to the Propeller, but for my purposes, this will probably be overkill as I am not doing any long distance flight. Completely "loosing" my foam easystar's video downlink and experiencing the time it takes to reacquire it visually (even with my spotter!) prompted creating a system to bring it back into range autonomously (or until I see it again). Now that I'm started, I have so many more ideas!
As you make progress, post the code if you'd like. I'll keep updating on the forums.
Thanks for the input!
Paul
Post Edited (Paul H) : 3/19/2007 10:05:48 PM GMT