Всем спасибо за советы.
Миссия успешно завершена.
Дрон взлетает с полосы, проходит над заброшенной базой(на острове к Юго-Востоку от КСС), проходит еще через пару точек над морем, берет курс на полосу и успешно садится.
Скрипт нифига не оптимизирован, но с моим крафтом все работает.
сам скрипт и крафт файл прикреплены к сообщению.
версия KSP 22
Версия мода kOS 9.2 - http://kerbalspaceport.com/kos/
Никакие моды кроме kOS не использовались.
Архив с крафтом и скриптом
skydrone-kOS.zip 4.32К
121 Количество загрузок:
Предупреждения(для тех кто будет использовать не мой дрон а свои аппараты) :
- полет продолжается более 10 минут при скорости ~ 130 m/c.
- скрипт нормально работает только на аппаратах с тяговооруженностью > 1.
- при смене курса на 1800 просадка по высоте ~200m (не ставьте точки смены курса в горной и холмистой местности)
- при смене курса более чем на 900
неправильнонекрасиво отрабатывает крен(roll). - полет в режиме следования рельефу не может обработать отвесные склоны гор (крутые холмы с уклоном до 700 вроде берет)
- завершающий участок снижения перед посадкой довольно крутой (используйте агильные аппараты или начинайте снижение на большем удалении от полосы)

clearscreen.
unlock all.
//print "kOS drone v 0.1 by skyfox inspired "Cruise Missile script v 1.0 by check".
Print "Engine on...".
stage.
brakes on.
wait 1.
sas on.
wait 1.
sas off.
Print "SAS check...".
wait 1.
brakes off.
Print "Brakes check...".
set targ to heading(0,90).
lock throttle to 0.7.
lock sspd to surfacespeed.
lock steering to targ.
wait until sspd > 75.
print "Airborne...".
set targ to heading(10,90).
lock steering to targ.
wait until alt:radar > 30.
lock steering to targ + R(0,0,5).
gear off.
wait 2.
lock steering to targ + R(0,0,0-5).
wait 2.
lock steering to targ + R(0,0,0).
print "landing gear off".
wait until altitude > 300.
//-- Взлетели на 300м теперь наводимся на островной аэродром.
set starg to latlng(-1.54,-71.90).
print "NEW target distance:" + starg:distance.
print "NEW target heading:" + starg:heading.
lock mybearing to starg:bearing.
lock skypitch to (cos(mybearing)*7).
//lock skyroll to abs(3.14 * cos(mybearing)) + 3.
until abs(mybearing) < 1 {
set htarg to starg:heading.
set targ to heading(skypitch,htarg).
lock steering to targ.
// + R(0,0,0-skyroll).
print "target bearing :" + mybearing + "degree" at (5,12).
print "sin bearing : " + sin(mybearing) at (5,13).
print "cos bearing : " + cos(mybearing) at (5,14).
print "tan bearing : " + tan(mybearing) at (5,15).
}.
// конец наведения на первую точку
wait 2.
// --- cruise mode --- by check
clearscreen.
set targheight to 400. //Sets desired height of missile.
set targetelev to 1350. //Sets elevation of target.
set pitchcoeff to 90/targheight. //Agressiveness of pitch change.
//set target to "target1". //Target name.
//set targ to target.
//lock targ to latlng(targlat,targlong).
lock targdist to starg:distance. //Below, locates target, spins launcher to point to target, launches missile.
lock targheading to starg:heading.
//flies until target is <500 m away.
until ((starg:distance)^2-(altitude-targetelev)^2)^0.5 < 500 {
print "CRUISE MODE " at (5,5).
print "DISTANCE TO TARGET: "+ starg:distance +" m " at (5,6).
print "ETA: "+ starg:distance/surfacespeed + " s " at (5,7).
print "BEARING TO TARGET: "+ mybearing + "degree" at (5,8).
lock targheading to starg:heading.
//These lines determine if the missile is flying over water. If it is, the missile determins its height based on altitude, not radalt.
set height to alt:radar.
if alt:radar <0 {set height to altitude.}.
if alt:radar > altitude {set height to altitude.}.
set pitch to (pitchcoeff*height*(-1)) +110. //some more aggressiveness of pitch change.
if pitch <-25 {set pitch to -25.}. //Sets limits on max/min pitch.
if pitch >89 {set pitch to 89.}.
set htarg to starg:heading.
set targ to heading(pitch,htarg).
lock steering to targ.
//lock steering to heading targheading by pitch.
}.
// -- end of cruise mode ---
// Приведение 0
lock throttle to 0.65.
// разворот над островом
clearscreen.
set starg to latlng(-3.5409,-70.9099).
print "NEW target distance:" + starg:distance.
print "NEW target heading:" + starg:heading.
lock mybearing to starg:bearing.
lock skypitch to (cos(mybearing)*15).
//lock skypitch to 3.14 * cos(mybearing).
//lock skyroll to abs(3.14 * cos(mybearing)) + 3.
until abs(mybearing) < 1 {
set htarg to starg:heading.
set targ to heading(skypitch,htarg).
lock steering to targ.
// + R(0,0,0-skyroll).
print "target bearing :" + mybearing + "degree" at (5,12).
print "sin bearing : " + sin(mybearing) at (5,13).
print "cos bearing : " + cos(mybearing) at (5,14).
print "tan bearing : " + tan(mybearing) at (5,15).
}.
// конец разворота
// -- end of cruise mode ---
//print "new target KSS".
clearscreen.
set starg to latlng(-3.5409,-70.9099).
print "target distance:" + starg:distance.
print "target heading:" + starg:heading.
set htarg to starg:heading.
set targheight to 400. //Sets desired height of missile.
set targetelev to 1350. //Sets elevation of target.
set pitchcoeff to 90/targheight. //Agressiveness of pitch change.
//set target to "target1". //Target name.
//set targ to target.
//lock targ to latlng(targlat,targlong).
lock targdist to starg:distance. //Below, locates target, spins launcher to point to target, launches missile.
lock targheading to starg:heading.
//set pitch to 20.
//wait 5.
//flies until target is <500 m away.
until ((starg:distance)^2-(altitude-targetelev)^2)^0.5 < 500 {
print "CRUISE MODE " at (5,5).
print "DISTANCE TO TARGET: "+ starg:distance +" m " at (5,8).
print "ETA: "+ starg:distance/surfacespeed + " s " at (5,9).
print "BEARING TO TARGET: "+ mybearing + "degree" at (5,10).
lock targheading to starg:heading.
//These lines determine if the missile is flying over water. If it is, the missile determins its height based on altitude, not radalt.
set height to alt:radar.
if alt:radar <0 {set height to altitude.}.
if alt:radar > altitude {set height to altitude.}.
set pitch to (pitchcoeff*height*(-1)) +110. //some more aggressiveness of pitch change.
if pitch <-25 {set pitch to -25.}. //Sets limits on max/min pitch.
if pitch >89 {set pitch to 89.}.
set htarg to starg:heading.
set targ to heading(pitch,htarg).
lock steering to targ.
//lock steering to heading targheading by pitch.
}.
// конец приведения 0
// Приведение 1
lock throttle to 0.6.
// разворот к точке перед КСС
clearscreen.
set starg to latlng(-0.0481307096779346,-73.8788757324219).
print "NEW target distance:" + starg:distance.
print "NEW target heading:" + starg:heading.
lock mybearing to starg:bearing.
lock skypitch to (cos(mybearing)*15).
//lock skypitch to 3.14 * cos(mybearing).
//lock skyroll to abs(3.14 * cos(mybearing)) + 3.
until abs(mybearing) < 1 {
set htarg to starg:heading.
set targ to heading(skypitch,htarg).
lock steering to targ.
// + R(0,0,0-skyroll).
print "target bearing :" + mybearing + "degree" at (5,12).
print "sin bearing : " + sin(mybearing) at (5,13).
print "cos bearing : " + cos(mybearing) at (5,14).
print "tan bearing : " + tan(mybearing) at (5,15).
}.
// конец разворота
// -- end of cruise mode ---
//print "new target KSS".
clearscreen.
set starg to latlng(-0.0481307096779346,-73.8788757324219).
print "target distance:" + starg:distance.
print "target heading:" + starg:heading.
set htarg to starg:heading.
set targheight to 400. //Sets desired height of missile.
set targetelev to 1350. //Sets elevation of target.
set pitchcoeff to 90/targheight. //Agressiveness of pitch change.
//set target to "target1". //Target name.
//set targ to target.
//lock targ to latlng(targlat,targlong).
lock targdist to starg:distance. //Below, locates target, spins launcher to point to target, launches missile.
lock targheading to starg:heading.
//set pitch to 20.
//wait 5.
//flies until target is <500 m away.
until ((starg:distance)^2-(altitude-targetelev)^2)^0.5 < 500 {
print "CRUISE MODE " at (5,5).
print "DISTANCE TO TARGET: "+ starg:distance +" m " at (5,8).
print "ETA: "+ starg:distance/surfacespeed + " s " at (5,9).
print "BEARING TO TARGET: "+ mybearing + "degree" at (5,10).
lock targheading to starg:heading.
//These lines determine if the missile is flying over water. If it is, the missile determins its height based on altitude, not radalt.
set height to alt:radar.
if alt:radar <0 {set height to altitude.}.
if alt:radar > altitude {set height to altitude.}.
set pitch to (pitchcoeff*height*(-1)) +110. //some more aggressiveness of pitch change.
if pitch <-25 {set pitch to -25.}. //Sets limits on max/min pitch.
if pitch >89 {set pitch to 89.}.
set htarg to starg:heading.
set targ to heading(pitch,htarg).
lock steering to targ.
//lock steering to heading targheading by pitch.
}.
// конец приведения 1
// Приведение 1,5
lock throttle to 0.5.
// подходим к полосе за 5км со стороны моря
clearscreen.
set starg to latlng(-0.048166673630476,-74.156005859375).
print "NEW target distance:" + starg:distance.
print "NEW target heading:" + starg:heading.
lock mybearing to starg:bearing.
lock skypitch to (cos(mybearing)*15).
//lock skypitch to 3.14 * cos(mybearing).
//lock skyroll to abs(3.14 * cos(mybearing)) + 3.
until abs(mybearing) < 1 {
set htarg to starg:heading.
set targ to heading(skypitch,htarg).
lock steering to targ.
// + R(0,0,0-skyroll).
print "target bearing :" + mybearing + "degree" at (5,12).
print "sin bearing : " + sin(mybearing) at (5,13).
print "cos bearing : " + cos(mybearing) at (5,14).
print "tan bearing : " + tan(mybearing) at (5,15).
}.
// конец разворота
// -- end of cruise mode ---
//print "new target KSS".
clearscreen.
set starg to latlng(-0.048166673630476,-74.156005859375).
print "target distance:" + starg:distance.
print "target heading:" + starg:heading.
set htarg to starg:heading.
set targheight to 400. //Sets desired height of missile.
set targetelev to 1350. //Sets elevation of target.
set pitchcoeff to 90/targheight. //Agressiveness of pitch change.
//set target to "target1". //Target name.
//set targ to target.
//lock targ to latlng(targlat,targlong).
lock targdist to starg:distance. //Below, locates target, spins launcher to point to target, launches missile.
lock targheading to starg:heading.
//set pitch to 20.
//wait 5.
//flies until target is <500 m away.
until ((starg:distance)^2-(altitude-targetelev)^2)^0.5 < 500 {
print "CRUISE MODE " at (5,5).
print "DISTANCE TO TARGET: "+ starg:distance +" m " at (5,8).
print "ETA: "+ starg:distance/surfacespeed + " s " at (5,9).
print "BEARING TO TARGET: "+ mybearing + "degree" at (5,10).
lock targheading to starg:heading.
//These lines determine if the missile is flying over water. If it is, the missile determins its height based on altitude, not radalt.
set height to alt:radar.
if alt:radar <0 {set height to altitude.}.
if alt:radar > altitude {set height to altitude.}.
set pitch to (pitchcoeff*height*(-1)) +110. //some more aggressiveness of pitch change.
if pitch <-25 {set pitch to -25.}. //Sets limits on max/min pitch.
if pitch >89 {set pitch to 89.}.
set htarg to starg:heading.
set targ to heading(pitch,htarg).
lock steering to targ.
//lock steering to heading targheading by pitch.
}.
// конец приведения 1,5
// Приведение 2
// Почти на месте подходим на 400 м
clearscreen.
set starg to latlng(-0.0482325814664364,-74.2950744628906).
print "NEW target distance:" + starg:distance.
print "NEW target heading:" + starg:heading.
lock mybearing to starg:bearing.
lock skypitch to (cos(mybearing)*15).
//lock skypitch to 3.14 * cos(mybearing).
//lock skyroll to abs(3.14 * cos(mybearing)) + 3.
until abs(mybearing) < 1 {
set htarg to starg:heading.
set targ to heading(skypitch,htarg).
lock steering to targ.
// + R(0,0,0-skyroll).
print "target bearing :" + mybearing + "degree" at (5,12).
print "sin bearing : " + sin(mybearing) at (5,13).
print "cos bearing : " + cos(mybearing) at (5,14).
print "tan bearing : " + tan(mybearing) at (5,15).
}.
// конец разворота
// -- end of cruise mode ---
//print "new target KSS".
clearscreen.
set starg to latlng(-0.0482325814664364,-74.2950744628906).
print "target distance:" + starg:distance.
print "target heading:" + starg:heading.
set htarg to starg:heading.
set targheight to 400. //Sets desired height of missile.
set targetelev to 1350. //Sets elevation of target.
set pitchcoeff to 90/targheight. //Agressiveness of pitch change.
//set target to "target1". //Target name.
//set targ to target.
//lock targ to latlng(targlat,targlong).
lock targdist to starg:distance. //Below, locates target, spins launcher to point to target, launches missile.
lock targheading to starg:heading.
//set pitch to 20.
//wait 5.
//flies until target is <500 m away.
until ((starg:distance)^2-(altitude-targetelev)^2)^0.5 < 500 {
print "CRUISE MODE " at (5,5).
print "DISTANCE TO TARGET: "+ starg:distance +" m " at (5,8).
print "ETA: "+ starg:distance/surfacespeed + " s " at (5,9).
print "BEARING TO TARGET: "+ mybearing + "degree" at (5,10).
lock targheading to starg:heading.
//These lines determine if the missile is flying over water. If it is, the missile determins its height based on altitude, not radalt.
set height to alt:radar.
if alt:radar <0 {set height to altitude.}.
if alt:radar > altitude {set height to altitude.}.
set pitch to (pitchcoeff*height*(-1)) +110. //some more aggressiveness of pitch change.
if pitch <-25 {set pitch to -25.}. //Sets limits on max/min pitch.
if pitch >89 {set pitch to 89.}.
set htarg to starg:heading.
set targ to heading(pitch,htarg).
lock steering to targ.
//lock steering to heading targheading by pitch.
}.
// конец приведения 2
// Приведение 3
// Снижение до 200м и переход в горизонтальный полет.
clearscreen.
set starg to latlng(-0.0483004078269005,-74.4335327148438).
print "NEW target distance:" + starg:distance.
print "NEW target heading:" + starg:heading.
lock mybearing to starg:bearing.
lock skypitch to (cos(mybearing)*15).
//lock skypitch to 3.14 * cos(mybearing).
//lock skyroll to abs(3.14 * cos(mybearing)) + 3.
until abs(mybearing) < 1 {
set htarg to starg:heading.
set targ to heading(skypitch,htarg).
lock steering to targ.
// + R(0,0,0-skyroll).
print "target bearing :" + mybearing + "degree" at (5,12).
print "sin bearing : " + sin(mybearing) at (5,13).
print "cos bearing : " + cos(mybearing) at (5,14).
print "tan bearing : " + tan(mybearing) at (5,15).
}.
// конец разворота
// -- end of cruise mode ---
print "new target KSS".
clearscreen.
set starg to latlng(-0.0483004078269005,-74.4335327148438).
print "target distance:" + starg:distance.
print "target heading:" + starg:heading.
set htarg to starg:heading.
set targheight to 200. //Sets desired height of missile.
set targetelev to 1350. //Sets elevation of target.
set pitchcoeff to 90/targheight. //Agressiveness of pitch change.
//set target to "target1". //Target name.
//set targ to target.
//lock targ to latlng(targlat,targlong).
lock targdist to starg:distance. //Below, locates target, spins launcher to point to target, launches missile.
lock targheading to starg:heading.
//set pitch to 20.
//wait 5.
//flies until target is <500 m away.
until ((starg:distance)^2-(altitude-targetelev)^2)^0.5 < 300 {
print "CRUISE MODE " at (5,5).
print "DISTANCE TO TARGET: "+ starg:distance +" m " at (5,8).
print "ETA: "+ starg:distance/surfacespeed + " s " at (5,9).
print "BEARING TO TARGET: "+ mybearing + "degree" at (5,10).
lock targheading to starg:heading.
//These lines determine if the missile is flying over water. If it is, the missile determins its height based on altitude, not radalt.
set height to alt:radar.
if alt:radar <0 {set height to altitude.}.
if alt:radar > altitude {set height to altitude.}.
set pitch to (pitchcoeff*height*(-1)) +110. //some more aggressiveness of pitch change.
if pitch <-25 {set pitch to -25.}. //Sets limits on max/min pitch.
if pitch >89 {set pitch to 89.}.
set htarg to starg:heading.
set targ to heading(pitch,htarg).
lock steering to targ.
//lock steering to heading targheading by pitch.
}.
// конец приведения 3
// пробуем сесть.
print "final approach".
set starg to latlng(-0.0485998690128326,-74.7244567871094).
print "target distance:" + starg:distance.
print "target heading:" + starg:heading.
lock mybearing to starg:bearing.
lock htarg to starg:heading.
set targ to heading(0,htarg).
lock steering to targ.
set targ to heading(0,htarg).
set tval to 0.2.
set trt to tval.
lock throttle to trt.
lock sspd to surfacespeed.
lock steering to targ.
lock vspd to verticalspeed.
gear on.
set targ to heading(0,htarg).
lock steering to targ.
set npitch to 0.
//set opitch to npitch.
set targ to heading(npitch,htarg).
lock steering to targ.
wait until alt:radar < 150.
set npitch to 5.
set targ to heading(npitch,htarg).
lock steering to targ.
until alt:radar < 5 {
if (vspd < (0-3)) {
//увеличить питч
set npitch to (npitch + 0.5).
if npitch > 30 { set npitch to 30. }.
set targ to heading(npitch,htarg).
print "npitch : " + npitch + " deg" at (5,8).
lock steering to targ.
}.
if (vspd > (0-3)) {
// уменьшить тягу
set tval to tval - 0.02.
print "tval : " + tval + " %" at (5,9).
set trt to tval.
}.
if (sspd > 75) {
// уменьшить тягу
set tval to tval - 0.02.
if tval < 0 { set tval to 0. }.
print "tval : " + tval + " %" at (5,9).
set trt to tval.
}.
if (sspd < 40) {
// увеличить тягу
set tval to tval - 0.02.
if tval > 1 { set tval to 1. }.
print "tval : " + tval + " %" at (5,9).
set trt to tval.
}.
}.
set tval to 0.
set trt to tval.
wait until sspd < 35.
set npitch to 5.
set targ to heading(npitch,htarg).
print "npitch : " + npitch + " deg" at (5,8).
lock steering to targ.
brakes on.
Wait until sspd < 1.
Print "The END...".
// конец попытки сесть.
unlock all.
//print "kOS drone v 0.1 by skyfox inspired "Cruise Missile script v 1.0 by check".
Print "Engine on...".
stage.
brakes on.
wait 1.
sas on.
wait 1.
sas off.
Print "SAS check...".
wait 1.
brakes off.
Print "Brakes check...".
set targ to heading(0,90).
lock throttle to 0.7.
lock sspd to surfacespeed.
lock steering to targ.
wait until sspd > 75.
print "Airborne...".
set targ to heading(10,90).
lock steering to targ.
wait until alt:radar > 30.
lock steering to targ + R(0,0,5).
gear off.
wait 2.
lock steering to targ + R(0,0,0-5).
wait 2.
lock steering to targ + R(0,0,0).
print "landing gear off".
wait until altitude > 300.
//-- Взлетели на 300м теперь наводимся на островной аэродром.
set starg to latlng(-1.54,-71.90).
print "NEW target distance:" + starg:distance.
print "NEW target heading:" + starg:heading.
lock mybearing to starg:bearing.
lock skypitch to (cos(mybearing)*7).
//lock skyroll to abs(3.14 * cos(mybearing)) + 3.
until abs(mybearing) < 1 {
set htarg to starg:heading.
set targ to heading(skypitch,htarg).
lock steering to targ.
// + R(0,0,0-skyroll).
print "target bearing :" + mybearing + "degree" at (5,12).
print "sin bearing : " + sin(mybearing) at (5,13).
print "cos bearing : " + cos(mybearing) at (5,14).
print "tan bearing : " + tan(mybearing) at (5,15).
}.
// конец наведения на первую точку
wait 2.
// --- cruise mode --- by check
clearscreen.
set targheight to 400. //Sets desired height of missile.
set targetelev to 1350. //Sets elevation of target.
set pitchcoeff to 90/targheight. //Agressiveness of pitch change.
//set target to "target1". //Target name.
//set targ to target.
//lock targ to latlng(targlat,targlong).
lock targdist to starg:distance. //Below, locates target, spins launcher to point to target, launches missile.
lock targheading to starg:heading.
//flies until target is <500 m away.
until ((starg:distance)^2-(altitude-targetelev)^2)^0.5 < 500 {
print "CRUISE MODE " at (5,5).
print "DISTANCE TO TARGET: "+ starg:distance +" m " at (5,6).
print "ETA: "+ starg:distance/surfacespeed + " s " at (5,7).
print "BEARING TO TARGET: "+ mybearing + "degree" at (5,8).
lock targheading to starg:heading.
//These lines determine if the missile is flying over water. If it is, the missile determins its height based on altitude, not radalt.
set height to alt:radar.
if alt:radar <0 {set height to altitude.}.
if alt:radar > altitude {set height to altitude.}.
set pitch to (pitchcoeff*height*(-1)) +110. //some more aggressiveness of pitch change.
if pitch <-25 {set pitch to -25.}. //Sets limits on max/min pitch.
if pitch >89 {set pitch to 89.}.
set htarg to starg:heading.
set targ to heading(pitch,htarg).
lock steering to targ.
//lock steering to heading targheading by pitch.
}.
// -- end of cruise mode ---
// Приведение 0
lock throttle to 0.65.
// разворот над островом
clearscreen.
set starg to latlng(-3.5409,-70.9099).
print "NEW target distance:" + starg:distance.
print "NEW target heading:" + starg:heading.
lock mybearing to starg:bearing.
lock skypitch to (cos(mybearing)*15).
//lock skypitch to 3.14 * cos(mybearing).
//lock skyroll to abs(3.14 * cos(mybearing)) + 3.
until abs(mybearing) < 1 {
set htarg to starg:heading.
set targ to heading(skypitch,htarg).
lock steering to targ.
// + R(0,0,0-skyroll).
print "target bearing :" + mybearing + "degree" at (5,12).
print "sin bearing : " + sin(mybearing) at (5,13).
print "cos bearing : " + cos(mybearing) at (5,14).
print "tan bearing : " + tan(mybearing) at (5,15).
}.
// конец разворота
// -- end of cruise mode ---
//print "new target KSS".
clearscreen.
set starg to latlng(-3.5409,-70.9099).
print "target distance:" + starg:distance.
print "target heading:" + starg:heading.
set htarg to starg:heading.
set targheight to 400. //Sets desired height of missile.
set targetelev to 1350. //Sets elevation of target.
set pitchcoeff to 90/targheight. //Agressiveness of pitch change.
//set target to "target1". //Target name.
//set targ to target.
//lock targ to latlng(targlat,targlong).
lock targdist to starg:distance. //Below, locates target, spins launcher to point to target, launches missile.
lock targheading to starg:heading.
//set pitch to 20.
//wait 5.
//flies until target is <500 m away.
until ((starg:distance)^2-(altitude-targetelev)^2)^0.5 < 500 {
print "CRUISE MODE " at (5,5).
print "DISTANCE TO TARGET: "+ starg:distance +" m " at (5,8).
print "ETA: "+ starg:distance/surfacespeed + " s " at (5,9).
print "BEARING TO TARGET: "+ mybearing + "degree" at (5,10).
lock targheading to starg:heading.
//These lines determine if the missile is flying over water. If it is, the missile determins its height based on altitude, not radalt.
set height to alt:radar.
if alt:radar <0 {set height to altitude.}.
if alt:radar > altitude {set height to altitude.}.
set pitch to (pitchcoeff*height*(-1)) +110. //some more aggressiveness of pitch change.
if pitch <-25 {set pitch to -25.}. //Sets limits on max/min pitch.
if pitch >89 {set pitch to 89.}.
set htarg to starg:heading.
set targ to heading(pitch,htarg).
lock steering to targ.
//lock steering to heading targheading by pitch.
}.
// конец приведения 0
// Приведение 1
lock throttle to 0.6.
// разворот к точке перед КСС
clearscreen.
set starg to latlng(-0.0481307096779346,-73.8788757324219).
print "NEW target distance:" + starg:distance.
print "NEW target heading:" + starg:heading.
lock mybearing to starg:bearing.
lock skypitch to (cos(mybearing)*15).
//lock skypitch to 3.14 * cos(mybearing).
//lock skyroll to abs(3.14 * cos(mybearing)) + 3.
until abs(mybearing) < 1 {
set htarg to starg:heading.
set targ to heading(skypitch,htarg).
lock steering to targ.
// + R(0,0,0-skyroll).
print "target bearing :" + mybearing + "degree" at (5,12).
print "sin bearing : " + sin(mybearing) at (5,13).
print "cos bearing : " + cos(mybearing) at (5,14).
print "tan bearing : " + tan(mybearing) at (5,15).
}.
// конец разворота
// -- end of cruise mode ---
//print "new target KSS".
clearscreen.
set starg to latlng(-0.0481307096779346,-73.8788757324219).
print "target distance:" + starg:distance.
print "target heading:" + starg:heading.
set htarg to starg:heading.
set targheight to 400. //Sets desired height of missile.
set targetelev to 1350. //Sets elevation of target.
set pitchcoeff to 90/targheight. //Agressiveness of pitch change.
//set target to "target1". //Target name.
//set targ to target.
//lock targ to latlng(targlat,targlong).
lock targdist to starg:distance. //Below, locates target, spins launcher to point to target, launches missile.
lock targheading to starg:heading.
//set pitch to 20.
//wait 5.
//flies until target is <500 m away.
until ((starg:distance)^2-(altitude-targetelev)^2)^0.5 < 500 {
print "CRUISE MODE " at (5,5).
print "DISTANCE TO TARGET: "+ starg:distance +" m " at (5,8).
print "ETA: "+ starg:distance/surfacespeed + " s " at (5,9).
print "BEARING TO TARGET: "+ mybearing + "degree" at (5,10).
lock targheading to starg:heading.
//These lines determine if the missile is flying over water. If it is, the missile determins its height based on altitude, not radalt.
set height to alt:radar.
if alt:radar <0 {set height to altitude.}.
if alt:radar > altitude {set height to altitude.}.
set pitch to (pitchcoeff*height*(-1)) +110. //some more aggressiveness of pitch change.
if pitch <-25 {set pitch to -25.}. //Sets limits on max/min pitch.
if pitch >89 {set pitch to 89.}.
set htarg to starg:heading.
set targ to heading(pitch,htarg).
lock steering to targ.
//lock steering to heading targheading by pitch.
}.
// конец приведения 1
// Приведение 1,5
lock throttle to 0.5.
// подходим к полосе за 5км со стороны моря
clearscreen.
set starg to latlng(-0.048166673630476,-74.156005859375).
print "NEW target distance:" + starg:distance.
print "NEW target heading:" + starg:heading.
lock mybearing to starg:bearing.
lock skypitch to (cos(mybearing)*15).
//lock skypitch to 3.14 * cos(mybearing).
//lock skyroll to abs(3.14 * cos(mybearing)) + 3.
until abs(mybearing) < 1 {
set htarg to starg:heading.
set targ to heading(skypitch,htarg).
lock steering to targ.
// + R(0,0,0-skyroll).
print "target bearing :" + mybearing + "degree" at (5,12).
print "sin bearing : " + sin(mybearing) at (5,13).
print "cos bearing : " + cos(mybearing) at (5,14).
print "tan bearing : " + tan(mybearing) at (5,15).
}.
// конец разворота
// -- end of cruise mode ---
//print "new target KSS".
clearscreen.
set starg to latlng(-0.048166673630476,-74.156005859375).
print "target distance:" + starg:distance.
print "target heading:" + starg:heading.
set htarg to starg:heading.
set targheight to 400. //Sets desired height of missile.
set targetelev to 1350. //Sets elevation of target.
set pitchcoeff to 90/targheight. //Agressiveness of pitch change.
//set target to "target1". //Target name.
//set targ to target.
//lock targ to latlng(targlat,targlong).
lock targdist to starg:distance. //Below, locates target, spins launcher to point to target, launches missile.
lock targheading to starg:heading.
//set pitch to 20.
//wait 5.
//flies until target is <500 m away.
until ((starg:distance)^2-(altitude-targetelev)^2)^0.5 < 500 {
print "CRUISE MODE " at (5,5).
print "DISTANCE TO TARGET: "+ starg:distance +" m " at (5,8).
print "ETA: "+ starg:distance/surfacespeed + " s " at (5,9).
print "BEARING TO TARGET: "+ mybearing + "degree" at (5,10).
lock targheading to starg:heading.
//These lines determine if the missile is flying over water. If it is, the missile determins its height based on altitude, not radalt.
set height to alt:radar.
if alt:radar <0 {set height to altitude.}.
if alt:radar > altitude {set height to altitude.}.
set pitch to (pitchcoeff*height*(-1)) +110. //some more aggressiveness of pitch change.
if pitch <-25 {set pitch to -25.}. //Sets limits on max/min pitch.
if pitch >89 {set pitch to 89.}.
set htarg to starg:heading.
set targ to heading(pitch,htarg).
lock steering to targ.
//lock steering to heading targheading by pitch.
}.
// конец приведения 1,5
// Приведение 2
// Почти на месте подходим на 400 м
clearscreen.
set starg to latlng(-0.0482325814664364,-74.2950744628906).
print "NEW target distance:" + starg:distance.
print "NEW target heading:" + starg:heading.
lock mybearing to starg:bearing.
lock skypitch to (cos(mybearing)*15).
//lock skypitch to 3.14 * cos(mybearing).
//lock skyroll to abs(3.14 * cos(mybearing)) + 3.
until abs(mybearing) < 1 {
set htarg to starg:heading.
set targ to heading(skypitch,htarg).
lock steering to targ.
// + R(0,0,0-skyroll).
print "target bearing :" + mybearing + "degree" at (5,12).
print "sin bearing : " + sin(mybearing) at (5,13).
print "cos bearing : " + cos(mybearing) at (5,14).
print "tan bearing : " + tan(mybearing) at (5,15).
}.
// конец разворота
// -- end of cruise mode ---
//print "new target KSS".
clearscreen.
set starg to latlng(-0.0482325814664364,-74.2950744628906).
print "target distance:" + starg:distance.
print "target heading:" + starg:heading.
set htarg to starg:heading.
set targheight to 400. //Sets desired height of missile.
set targetelev to 1350. //Sets elevation of target.
set pitchcoeff to 90/targheight. //Agressiveness of pitch change.
//set target to "target1". //Target name.
//set targ to target.
//lock targ to latlng(targlat,targlong).
lock targdist to starg:distance. //Below, locates target, spins launcher to point to target, launches missile.
lock targheading to starg:heading.
//set pitch to 20.
//wait 5.
//flies until target is <500 m away.
until ((starg:distance)^2-(altitude-targetelev)^2)^0.5 < 500 {
print "CRUISE MODE " at (5,5).
print "DISTANCE TO TARGET: "+ starg:distance +" m " at (5,8).
print "ETA: "+ starg:distance/surfacespeed + " s " at (5,9).
print "BEARING TO TARGET: "+ mybearing + "degree" at (5,10).
lock targheading to starg:heading.
//These lines determine if the missile is flying over water. If it is, the missile determins its height based on altitude, not radalt.
set height to alt:radar.
if alt:radar <0 {set height to altitude.}.
if alt:radar > altitude {set height to altitude.}.
set pitch to (pitchcoeff*height*(-1)) +110. //some more aggressiveness of pitch change.
if pitch <-25 {set pitch to -25.}. //Sets limits on max/min pitch.
if pitch >89 {set pitch to 89.}.
set htarg to starg:heading.
set targ to heading(pitch,htarg).
lock steering to targ.
//lock steering to heading targheading by pitch.
}.
// конец приведения 2
// Приведение 3
// Снижение до 200м и переход в горизонтальный полет.
clearscreen.
set starg to latlng(-0.0483004078269005,-74.4335327148438).
print "NEW target distance:" + starg:distance.
print "NEW target heading:" + starg:heading.
lock mybearing to starg:bearing.
lock skypitch to (cos(mybearing)*15).
//lock skypitch to 3.14 * cos(mybearing).
//lock skyroll to abs(3.14 * cos(mybearing)) + 3.
until abs(mybearing) < 1 {
set htarg to starg:heading.
set targ to heading(skypitch,htarg).
lock steering to targ.
// + R(0,0,0-skyroll).
print "target bearing :" + mybearing + "degree" at (5,12).
print "sin bearing : " + sin(mybearing) at (5,13).
print "cos bearing : " + cos(mybearing) at (5,14).
print "tan bearing : " + tan(mybearing) at (5,15).
}.
// конец разворота
// -- end of cruise mode ---
print "new target KSS".
clearscreen.
set starg to latlng(-0.0483004078269005,-74.4335327148438).
print "target distance:" + starg:distance.
print "target heading:" + starg:heading.
set htarg to starg:heading.
set targheight to 200. //Sets desired height of missile.
set targetelev to 1350. //Sets elevation of target.
set pitchcoeff to 90/targheight. //Agressiveness of pitch change.
//set target to "target1". //Target name.
//set targ to target.
//lock targ to latlng(targlat,targlong).
lock targdist to starg:distance. //Below, locates target, spins launcher to point to target, launches missile.
lock targheading to starg:heading.
//set pitch to 20.
//wait 5.
//flies until target is <500 m away.
until ((starg:distance)^2-(altitude-targetelev)^2)^0.5 < 300 {
print "CRUISE MODE " at (5,5).
print "DISTANCE TO TARGET: "+ starg:distance +" m " at (5,8).
print "ETA: "+ starg:distance/surfacespeed + " s " at (5,9).
print "BEARING TO TARGET: "+ mybearing + "degree" at (5,10).
lock targheading to starg:heading.
//These lines determine if the missile is flying over water. If it is, the missile determins its height based on altitude, not radalt.
set height to alt:radar.
if alt:radar <0 {set height to altitude.}.
if alt:radar > altitude {set height to altitude.}.
set pitch to (pitchcoeff*height*(-1)) +110. //some more aggressiveness of pitch change.
if pitch <-25 {set pitch to -25.}. //Sets limits on max/min pitch.
if pitch >89 {set pitch to 89.}.
set htarg to starg:heading.
set targ to heading(pitch,htarg).
lock steering to targ.
//lock steering to heading targheading by pitch.
}.
// конец приведения 3
// пробуем сесть.
print "final approach".
set starg to latlng(-0.0485998690128326,-74.7244567871094).
print "target distance:" + starg:distance.
print "target heading:" + starg:heading.
lock mybearing to starg:bearing.
lock htarg to starg:heading.
set targ to heading(0,htarg).
lock steering to targ.
set targ to heading(0,htarg).
set tval to 0.2.
set trt to tval.
lock throttle to trt.
lock sspd to surfacespeed.
lock steering to targ.
lock vspd to verticalspeed.
gear on.
set targ to heading(0,htarg).
lock steering to targ.
set npitch to 0.
//set opitch to npitch.
set targ to heading(npitch,htarg).
lock steering to targ.
wait until alt:radar < 150.
set npitch to 5.
set targ to heading(npitch,htarg).
lock steering to targ.
until alt:radar < 5 {
if (vspd < (0-3)) {
//увеличить питч
set npitch to (npitch + 0.5).
if npitch > 30 { set npitch to 30. }.
set targ to heading(npitch,htarg).
print "npitch : " + npitch + " deg" at (5,8).
lock steering to targ.
}.
if (vspd > (0-3)) {
// уменьшить тягу
set tval to tval - 0.02.
print "tval : " + tval + " %" at (5,9).
set trt to tval.
}.
if (sspd > 75) {
// уменьшить тягу
set tval to tval - 0.02.
if tval < 0 { set tval to 0. }.
print "tval : " + tval + " %" at (5,9).
set trt to tval.
}.
if (sspd < 40) {
// увеличить тягу
set tval to tval - 0.02.
if tval > 1 { set tval to 1. }.
print "tval : " + tval + " %" at (5,9).
set trt to tval.
}.
}.
set tval to 0.
set trt to tval.
wait until sspd < 35.
set npitch to 5.
set targ to heading(npitch,htarg).
print "npitch : " + npitch + " deg" at (5,8).
lock steering to targ.
brakes on.
Wait until sspd < 1.
Print "The END...".
// конец попытки сесть.
Сообщение отредактировал SkyFox: 10 November 2013 - 3:52