Hi All,
Currently I don't use the FBW B mode on my aircraft, and I wanted to modify it for a custom function. Specifically, I want to make a doublet command, so that when I throw the switch into FBW B, it will do a quick succession of predetermined control-surface movements, and then go back into manual control.
At this stage, I've tried adding some code to move the rudder servo below Arduplane.pde line 1062 (case FLY_BY_WIRE_B), and likewise below line 1102 (case MANUAL) to see if I can just get different modes to toggle the servo, but it doesn't seem to do anything.
Could someone point me in the right direction here? Perhaps there's some detailed code documentation that I could look at. Alternately, if there's a simpler solution, suggestions would be appreciated.
Thanks,
- Lewis
Replies
Hey, I'm taking a look at where you talk about using the APM_RC.InputCh(CH_x) method to get radio input. What's the difference between that and g.channel_xxxx.radio_in? Do they produce the same integer value that can be fed to the outputs?
What code are you substituting in place of the normal FLY_BY_WIRE_B code to toggle the servo?
I've now determined that custom_mode exists in the code. Perhaps I need to take advantage of this feature to implement my custom code without overwriting FBW_B. Can anyone give advise on how to do this?
Thanks!
Well, I've gone through ArduPlane.pde (now changed to ArduPlane.ino by the latest version of Arduino...) and I've managed to figure out that the update_current_flight_mode() function doesn't change the operation of the servos, even if it's disabled completely (by commenting out line 741). But seeing as this function is described as "custom code/exceptions for flight modes", I'm really not sure why. Do I have to activate it somehow in APM_Config.h?
For now, I'm going to delve into the other functions called in ArduPlane.ino and see if I can manually control the servos in there.