pre-geopy auto bearing calculation integration

This commit is contained in:
cs-powell
2025-03-31 23:58:08 -04:00
parent 89991c248a
commit bfdbf7c5fb
2 changed files with 11 additions and 10 deletions

View File

@@ -2,6 +2,7 @@ import pyactr
# from XPlaneConnect import * # from XPlaneConnect import *
import xpc import xpc
import math import math
import geopy
# Initialize XPlaneConnect client # Initialize XPlaneConnect client
class scaleFactor(): class scaleFactor():
SCALEYOKEPULL = 10 SCALEYOKEPULL = 10
@@ -16,7 +17,6 @@ class AircraftLandingModel(pyactr.ACTRModel):
self.client = client self.client = client
self.inProgress = True self.inProgress = True
self.printControlsFlag = printFlag self.printControlsFlag = printFlag
""" """
Setting DREF variables and loading into drefs array 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") wheelS = self.client.getDREF("sim/flightmodel2/gear/tire_rotation_speed_rad_sec")
wheelW = self.client.getDREF("sim/flightmodel/parts/tire_vrt_def_veh") wheelW = self.client.getDREF("sim/flightmodel/parts/tire_vrt_def_veh")
HARDCODE_HEADING = 179
self.airspeed = airspeed[0] self.airspeed = airspeed[0]
self.roll = roll[0] self.roll = roll[0]
self.heading = heading[0] self.heading = HARDCODE_HEADING
self.descent_rate = descent_rate[0] self.descent_rate = descent_rate[0]
self.altitude = altitude[0] self.altitude = altitude[0]
self.pitch = pitch[0] self.pitch = pitch[0]

View File

@@ -23,9 +23,9 @@ def eulerToQuat(psiInput,thetaInput,phiInput):
return quat return quat
def experimentSetUp(client,altitudeInput): def experimentSetUp(client,altitudeInput,newExperiment):
print("Entered: EXPERIMENTSETUP") print("Entered: EXPERIMENTSETUP")
if(True): if(newExperiment):
#Location: #Location:
groundLevel = 5434 groundLevel = 5434
offset = altitudeInput offset = altitudeInput
@@ -107,8 +107,8 @@ def experimentSetUp(client,altitudeInput):
input("Press Enter to finish setting up Simulation") input("Press Enter to finish setting up Simulation")
client.pauseSim(False) client.pauseSim(False)
print("Setting initial velocity") print("Setting initial velocity")
zInit = "sim/flightmodel/position/local_vx" zInit = "sim/flightmodel/position/local_vz"
client.sendDREF(zInit, 0) client.sendDREF(zInit, 80)
print("setup complete") print("setup complete")
@@ -164,7 +164,7 @@ def runExperiment(title,printFlag,experimentStart):
endTime = 0 endTime = 0
difference = endTime - startTime difference = endTime - startTime
experimentLive = True experimentLive = True
timeoutLimit = 1 timeoutLimit = 10
newExperiment = experimentStart newExperiment = experimentStart
while(difference < timeoutLimit and experimentLive): while(difference < timeoutLimit and experimentLive):
print("Time Elapsed: -----> " + str(difference)) print("Time Elapsed: -----> " + str(difference))
@@ -173,13 +173,13 @@ def runExperiment(title,printFlag,experimentStart):
# Verify connection # Verify connection
client.getDREF("sim/test/test_float") client.getDREF("sim/test/test_float")
cogModel = AircraftLandingModel(client,printFlag) cogModel = AircraftLandingModel(client,printFlag)
experimentSetUp(cogModel.client,3000) experimentSetUp(cogModel.client,3000,newExperiment)
cogModel.client.pauseSim(False) cogModel.client.pauseSim(False)
count = 0 count = 0
innercount = 0 innercount = 0
clockStart = time.time() clockStart = time.time()
retry = 0 retry = 0
newExperment = False newExperiment = False
while(cogModel.simulationStatus()): while(cogModel.simulationStatus()):
clockStart = time.time() #START TIMER clockStart = time.time() #START TIMER
#Run Model #Run Model
@@ -229,7 +229,7 @@ def ex():
input("Press Enter to Start Experiment #" + str(count) + ": ") input("Press Enter to Start Experiment #" + str(count) + ": ")
print("Data File Reset") print("Data File Reset")
f = open("/Users/flyingtopher/X-Plane 11/Data.txt", 'w') f = open("/Users/flyingtopher/X-Plane 11/Data.txt", 'w')
exit = runExperiment(title,False,True) exit = runExperiment(title,True,True)
if(exit): if(exit):
break break
count+=1 count+=1