From bfdbf7c5fb74419b72b02420fc148b5f48864de2 Mon Sep 17 00:00:00 2001 From: cs-powell <142438185+cs-powell@users.noreply.github.com> Date: Mon, 31 Mar 2025 23:58:08 -0400 Subject: [PATCH] pre-geopy auto bearing calculation integration --- Python3/src/cognitiveModel.py | 5 +++-- Python3/src/testPlatform.py | 16 ++++++++-------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Python3/src/cognitiveModel.py b/Python3/src/cognitiveModel.py index 2605432..1e98827 100644 --- a/Python3/src/cognitiveModel.py +++ b/Python3/src/cognitiveModel.py @@ -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] diff --git a/Python3/src/testPlatform.py b/Python3/src/testPlatform.py index 0289776..a9b5f3b 100644 --- a/Python3/src/testPlatform.py +++ b/Python3/src/testPlatform.py @@ -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