pre-geopy auto bearing calculation integration
This commit is contained in:
@@ -2,6 +2,7 @@ import pyactr
|
||||
# from XPlaneConnect import *
|
||||
import xpc
|
||||
import math
|
||||
import geopy
|
||||
# Initialize XPlaneConnect client
|
||||
class scaleFactor():
|
||||
SCALEYOKEPULL = 10
|
||||
@@ -16,7 +17,6 @@ class AircraftLandingModel(pyactr.ACTRModel):
|
||||
self.client = client
|
||||
self.inProgress = True
|
||||
self.printControlsFlag = printFlag
|
||||
|
||||
"""
|
||||
Setting DREF variables and loading into drefs array
|
||||
"""
|
||||
@@ -56,10 +56,11 @@ class AircraftLandingModel(pyactr.ACTRModel):
|
||||
wheelS = self.client.getDREF("sim/flightmodel2/gear/tire_rotation_speed_rad_sec")
|
||||
wheelW = self.client.getDREF("sim/flightmodel/parts/tire_vrt_def_veh")
|
||||
|
||||
HARDCODE_HEADING = 179
|
||||
|
||||
self.airspeed = airspeed[0]
|
||||
self.roll = roll[0]
|
||||
self.heading = heading[0]
|
||||
self.heading = HARDCODE_HEADING
|
||||
self.descent_rate = descent_rate[0]
|
||||
self.altitude = altitude[0]
|
||||
self.pitch = pitch[0]
|
||||
|
||||
@@ -23,9 +23,9 @@ def eulerToQuat(psiInput,thetaInput,phiInput):
|
||||
return quat
|
||||
|
||||
|
||||
def experimentSetUp(client,altitudeInput):
|
||||
def experimentSetUp(client,altitudeInput,newExperiment):
|
||||
print("Entered: EXPERIMENTSETUP")
|
||||
if(True):
|
||||
if(newExperiment):
|
||||
#Location:
|
||||
groundLevel = 5434
|
||||
offset = altitudeInput
|
||||
@@ -107,8 +107,8 @@ def experimentSetUp(client,altitudeInput):
|
||||
input("Press Enter to finish setting up Simulation")
|
||||
client.pauseSim(False)
|
||||
print("Setting initial velocity")
|
||||
zInit = "sim/flightmodel/position/local_vx"
|
||||
client.sendDREF(zInit, 0)
|
||||
zInit = "sim/flightmodel/position/local_vz"
|
||||
client.sendDREF(zInit, 80)
|
||||
print("setup complete")
|
||||
|
||||
|
||||
@@ -164,7 +164,7 @@ def runExperiment(title,printFlag,experimentStart):
|
||||
endTime = 0
|
||||
difference = endTime - startTime
|
||||
experimentLive = True
|
||||
timeoutLimit = 1
|
||||
timeoutLimit = 10
|
||||
newExperiment = experimentStart
|
||||
while(difference < timeoutLimit and experimentLive):
|
||||
print("Time Elapsed: -----> " + str(difference))
|
||||
@@ -173,13 +173,13 @@ def runExperiment(title,printFlag,experimentStart):
|
||||
# Verify connection
|
||||
client.getDREF("sim/test/test_float")
|
||||
cogModel = AircraftLandingModel(client,printFlag)
|
||||
experimentSetUp(cogModel.client,3000)
|
||||
experimentSetUp(cogModel.client,3000,newExperiment)
|
||||
cogModel.client.pauseSim(False)
|
||||
count = 0
|
||||
innercount = 0
|
||||
clockStart = time.time()
|
||||
retry = 0
|
||||
newExperment = False
|
||||
newExperiment = False
|
||||
while(cogModel.simulationStatus()):
|
||||
clockStart = time.time() #START TIMER
|
||||
#Run Model
|
||||
@@ -229,7 +229,7 @@ def ex():
|
||||
input("Press Enter to Start Experiment #" + str(count) + ": ")
|
||||
print("Data File Reset")
|
||||
f = open("/Users/flyingtopher/X-Plane 11/Data.txt", 'w')
|
||||
exit = runExperiment(title,False,True)
|
||||
exit = runExperiment(title,True,True)
|
||||
if(exit):
|
||||
break
|
||||
count+=1
|
||||
|
||||
Reference in New Issue
Block a user