PeterBLITZ / ardupirates

Automatically exported from code.google.com/p/ardupirates
1 stars 0 forks source link

Transmitter roll/pitch/yaw mid #22

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
The transmitter mid values default to 1500, and cannot be set.
If the transmitter centre values are not exactly 1500 (as mine was), and 
adjustments cannot be made in small enough increments on the transmitter (such 
as my Spektrum DX7), this results in a command roll or pitch when the stick is 
in neutral. This causes a drift of the quad in stable mode, which can be easily 
prevented. 

I added the following to my GCS (around line 156) to enable setting the mid 
values. It took care of a lot of my drift.
    case '6': 
     roll_mid = readFloatSerial();
     pitch_mid = readFloatSerial();    
     yaw_mid = readFloatSerial();

In addition, there is a bit of jitter around the mid value when the control 
stick is in neutral. I added a deadband to help with this. Not a bug, but might 
be useful (more feature request?).

Around line 159 in Radio.pde (and similar idea for the other modes)

// Provide a deadband for transmitter jitter.
if( abs(ch_roll-roll_mid)   < 3 )  command_rx_roll = 0;
if( abs(ch_pitch-pitch_mid) < 3 )  command_rx_pitch = 0;

Original issue reported on code.google.com by Orio...@gmail.com on 14 Feb 2011 at 1:05