[Gcblue-commits] gcb_wx/scripts AI.py,1.18,1.19
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2005-03-08 00:42:31
|
Update of /cvsroot/gcblue/gcb_wx/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10870/scripts Modified Files: AI.py Log Message: Index: AI.py =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/scripts/AI.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** AI.py 2 Mar 2005 22:28:41 -0000 1.18 --- AI.py 8 Mar 2005 00:41:48 -0000 1.19 *************** *** 567,577 **** # modified this to adjust altitude based on altitude of landing # site ! def LandHelo(UI,dest_id): if (not UI.IsHelo()): UI.DisplayMessage('LandHelo called with non-helo unit') return ! # 0 - init, 1 - distant, 2 - init approach, 3 - final approach ! land_state = UI.GetVar(0) track_info = UI.GetTrackById(dest_id) --- 567,597 ---- # modified this to adjust altitude based on altitude of landing # site ! def LandHelo(TI): ! UI = TI.GetPlatformInterface() ! BB = TI.GetBlackboardInterface() ! ! if (not GetConnControl(BB)): ! return ! ! iteration = TI.GetMemoryValue(1) # will return 0 first time ! if (iteration == 0): # do initialization ! TI.SetMemoryText('Description', 'Land at designated airbase') ! TI.SetMemoryValue(2, 0) # 0 - init, 1 - distant, 2 - init approach, 3 - final approach ! dest_name = BB.ReadMessage('LandingTarget') ! dest_id = UI.LookupFriendlyId(dest_name) ! TI.SetMemoryValue(3, dest_id) ! ! iteration = iteration + 1 ! TI.SetMemoryValue(1, iteration) ! ! if (not UI.IsHelo()): UI.DisplayMessage('LandHelo called with non-helo unit') + TI.EndTask() return ! # 0 - init, 1 - distant, 2 - init approach, 3 - final approach ! land_state = TI.GetMemoryValue(2) ! dest_id = long(TI.GetMemoryValue(3)) track_info = UI.GetTrackById(dest_id) *************** *** 579,583 **** if (track_info.ID == -1): UI.DisplayMessage('Bad track ID for landing') ! UI.CompletedOrder() return # invalid id --- 599,603 ---- if (track_info.ID == -1): UI.DisplayMessage('Bad track ID for landing') ! TI.EndTask() return # invalid id *************** *** 585,589 **** if (landing_data.ID == -1): UI.DisplayMessage('Invalid landing platform') ! UI.CompletedOrder() return # invalid id --- 605,609 ---- if (landing_data.ID == -1): UI.DisplayMessage('Invalid landing platform') ! TI.EndTask() return # invalid id *************** *** 592,595 **** --- 612,618 ---- track_info.Alt = landing_data.Alt + + alt_m = track_info.Alt + # adjust track location based on approach state if (land_state <= 1): *************** *** 599,603 **** UI.SetAlt(300 + alt_m) SetFractionalSpeed(UI, 0.7) ! UI.SetVar(0, 1) elif (land_state == 2): UI.SetSpeed(track_info.Speed + 5) --- 622,626 ---- UI.SetAlt(300 + alt_m) SetFractionalSpeed(UI, 0.7) ! TI.SetMemoryValue(2, 1) elif (land_state == 2): UI.SetSpeed(track_info.Speed + 5) *************** *** 617,626 **** elif (land_state == 2) and (TTI <= 1): land_state = 3 ! UI.SetVar(0, land_state) ! UI.SetUpdate(3) elif (TTI <= 20): ! UI.SetUpdate(3) else: ! UI.SetUpdate(10) # this version iterates through all tracks --- 640,655 ---- elif (land_state == 2) and (TTI <= 1): land_state = 3 ! TI.SetMemoryValue(2, land_state) ! TI.SetUpdateInterval(3) elif (TTI <= 20): ! TI.SetUpdateInterval(3) else: ! TI.SetUpdateInterval(10) ! ! ! ! ! ! # this version iterates through all tracks |