1
0
Fork 0

Make lead aircraft behavior more uniform/predictable/repeatable.

This commit is contained in:
curt 2006-08-20 00:54:53 +00:00
parent 07f5dd24f3
commit a6ebef1d0a
2 changed files with 75 additions and 8 deletions

View file

@ -148,7 +148,24 @@ do_target_task = func {
tgt_roll = 0;
tgt_alt = base_alt;
} else {
if ( target_task == "turns" or target_task == "both" ) {
if ( target_task == "turns" ) {
next_turn -= dt;
if ( next_turn < 0 ) {
if ( tgt_roll > 0 ) {
# new roll
tgt_roll = -30.0;
} else {
# new roll
tgt_roll = 30.0;
}
# next turn in 15 seconds
next_turn = 15.0;
# roll to zero if tgt_speed < 50 so we don't spin in mid air
if ( tgt_speed < 50 ) { tgt_roll = 0; }
}
tgt_lat_mode = "roll";
} elsif ( target_task == "turns-rand" or target_task == "both-rand" ) {
next_turn -= dt;
if ( next_turn < 0 ) {
if ( tgt_roll > 0 ) {
@ -167,6 +184,25 @@ do_target_task = func {
tgt_lat_mode = "roll";
}
if ( target_task == "pitch" or target_task == "both" ) {
next_pitch -= dt;
if ( next_pitch < 0 ) {
if ( tgt_alt > base_alt ) {
# new alt base - 1000
tgt_alt = base_alt - 1000.0;
} else {
# new alt base + 1000
tgt_alt = base_alt + 1000.0;
}
# next pitch in 15 seconds
next_pitch = 15.0;
# ??? (fixme?)
# pitch to zero if tgt_speed < 50 so we don't porpoise in
# mid air
# if ( tgt_speed < 50 ) { tgt_pitch = 0; }
}
tgt_lon_mode = "alt";
} elsif ( target_task == "pitch-rand" or target_task == "both-rand" ) {
next_pitch -= dt;
if ( next_pitch < 0 ) {
if ( tgt_alt > base_alt ) {
@ -186,14 +222,45 @@ do_target_task = func {
# if ( tgt_speed < 50 ) { tgt_pitch = 0; }
}
tgt_lon_mode = "alt";
}
} elsif ( target_task == "lazy-eights" ) {
tgt_lat_mode = "roll";
tgt_lon_mode = "alt";
next_turn -= dt;
if ( next_turn < 0 ) {
next_turn = 32.0;
}
if ( next_turn > 16.0 ) {
# rolling right
tgt_roll = 30.0;
} else {
# rolling left
tgt_roll = -30.0;
}
# roll to zero if tgt_speed < 50 so we don't spin in mid air
if ( tgt_speed < 50 ) { tgt_roll = 0; }
if ( next_turn > 24.0 ) {
# climbing
tgt_alt = base_alt + 1000.0;
} elsif ( next_turn > 16.0 ) {
# decending to original altitude
tgt_alt = base_alt;
} elsif ( next_turn > 8.0 ) {
# climbing
tgt_alt = base_alt + 1000.0;
} else {
# decending to original altitude
tgt_alt = base_alt;
}
}
# fixed altitude if in turns mode
if ( target_task == "turns" ) {
if ( target_task == "turns" or target_task == "turns-rand" ) {
tgt_lon_mode = "alt";
tgt_alt = base_alt;
}
# zero roll if in pitch mode
if ( target_task == "pitch" ) {
if ( target_task == "pitch" or target_task == "pitch-rand" ) {
tgt_lat_mode = "roll";
tgt_roll = 0;
}

View file

@ -71,7 +71,7 @@
</binding>
</radio>
<text>
<label>Randomized Heading Changes</label>
<label>Level Turns</label>
<halign>left</halign>
<row>1</row><col>1</col>
</text>
@ -86,7 +86,7 @@
</binding>
</radio>
<text>
<label>Randomized Pitch Changes</label>
<label>Straight Pitch Changes</label>
<halign>left</halign>
<row>2</row><col>1</col>
</text>
@ -97,11 +97,11 @@
<live>true</live>
<binding>
<command>nasal</command>
<script>set_radio("both"); setprop("/autopilot/lead-target/task", "both");</script>
<script>set_radio("both"); setprop("/autopilot/lead-target/task", "lazy-eights");</script>
</binding>
</radio>
<text>
<label>Both Heading and Pitch Changes</label>
<label>Lazy Eights</label>
<halign>left</halign>
<row>3</row><col>1</col>
</text>