Skip to content

Commit b364e85

Browse files
committed
yaw control
1 parent 6bdfe57 commit b364e85

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

controller-attiny85/controller-attiny85.ino

100755100644
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,14 +158,15 @@ void loop() {
158158
float input[3]; filterInputs(input);
159159
float mix1[2]; vmix(mix1, input, GAIN_ROLL_DH, GAIN_PITCH_DH); // differential dihedral
160160
float mix2[2]; vmix(mix2, input,-GAIN_ROLL_FM, GAIN_PITCH_FM); // frequency modulation
161-
162-
float amp1 = positive( input[2] + input[3] );
163-
float amp2 = positive( input[2] - input[3] );
161+
162+
float input_yaw = input[0]*GAIN_YAW; // use roll input as yaw
163+
float amp1 = positive( input[2] + input_yaw );
164+
float amp2 = positive( input[2] - input_yaw );
164165

165166
float wave1 = fwave( input[2], mix2[0] );
166167
float wave2 = fwave( input[2], mix2[1] );
167168

168-
wave1 = wave1*amp1 + mix1[0]; // differential amplitude
169+
wave1 = wave1*amp1 + mix1[0]; // differential amplitude
169170
wave2 = wave2*amp2 + mix1[1];
170171

171172
servo[0].writeMicroseconds( PWM_MID + wave1 + TRIM_LEFT ); // left wing

controller-attiny85/parameters.cpp

100755100644
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// 2. Control inputs [negate to reverse direction]
77
// I. Base inputs:
88
#define GAIN_THRT 0.8 // Flapping amplitude. Increases with more throttle
9-
#define GAIN_YAW 0.4 // Differential amplitude. Controlled by rudder
9+
#define GAIN_YAW 0.2 // Differential amplitude. Controlled by rudder
1010
// II. Differential dihedral:
1111
#define GAIN_PITCH_DH 0.5 // Pitch: symmetric dihedral
1212
#define GAIN_ROLL_DH 0.5 // Roll: asymmetric dihedral
@@ -16,12 +16,12 @@
1616

1717
// 3. Servo trims [ms]
1818
#define TRIM_LEFT 0 // left wing
19-
#define TRIM_RIGHT -60 // right wing
19+
#define TRIM_RIGHT 0 // right wing
2020

2121
// 6. Output PWM signal
2222
#define PWM_MID 1500 // Center/middle servo position
2323
#define PWM_MIN 1100 // Minimum servo position
2424
#define PWM_MAX 1900 // Maximum servo position
2525

26-
// 7. Input deadband filter
26+
// 7. Input deadband filter [ms]
2727
#define INPUT_CHANGE 12 // Change in PWM signal needed to update receiver inputs

controller/parameters.cpp

100755100644
File mode changed.

0 commit comments

Comments
 (0)