New data collection trial tracking w/ extra file corresponding to experiment run data
This commit is contained in:
@@ -1,11 +1,61 @@
|
||||
Turbulence Experiments,Starting Altitude (AGL),Wind Layer Altitude,Wind Direction,Wind Speed,Turbulence,Thermal Rate,Thermal Percent,Thermal Altitude
|
||||
0,2900,0,179,0,1,500,0.9,15000
|
||||
1,2900,0,179,0,2,500,0.9,15000
|
||||
2,2900,0,179,0,3,500,0.9,15000
|
||||
3,2900,0,179,0,4,500,0.9,15000
|
||||
4,2900,0,179,0,5,500,0.9,15000
|
||||
5,2900,0,179,0,6,500,0.9,15000
|
||||
6,2900,0,179,0,7,500,0.9,15000
|
||||
7,2900,0,179,0,8,500,0.9,15000
|
||||
8,2900,0,179,0,9,500,0.9,15000
|
||||
9,2900,0,179,0,10,500,0.9,15000
|
||||
Turbulence Experiments,Starting Altitude (AGL),Wind Layer Altitude,Wind Direction,Wind Speed,Turbulence,Thermal Rate,Thermal Percent,Thermal Altitude,Cognitive Delay
|
||||
0,2900,0,179,0,1,500,0.9,15000,0.05
|
||||
1,2900,0,179,0,1,500,0.9,15000,0.15
|
||||
2,2900,0,179,0,1,500,0.9,15000,0.25
|
||||
3,2900,0,179,0,1,500,0.9,15000,0.35
|
||||
4,2900,0,179,0,1,500,0.9,15000,0.45
|
||||
5,2900,0,179,0,1,500,0.9,15000,0.55
|
||||
6,2900,0,179,0,2,500,0.9,15000,0.05
|
||||
7,2900,0,179,0,2,500,0.9,15000,0.15
|
||||
8,2900,0,179,0,2,500,0.9,15000,0.25
|
||||
9,2900,0,179,0,2,500,0.9,15000,0.35
|
||||
10,2900,0,179,0,2,500,0.9,15000,0.45
|
||||
11,2900,0,179,0,2,500,0.9,15000,0.55
|
||||
12,2900,0,179,0,3,500,0.9,15000,0.05
|
||||
13,2900,0,179,0,3,500,0.9,15000,0.15
|
||||
14,2900,0,179,0,3,500,0.9,15000,0.25
|
||||
15,2900,0,179,0,3,500,0.9,15000,0.35
|
||||
16,2900,0,179,0,3,500,0.9,15000,0.45
|
||||
17,2900,0,179,0,3,500,0.9,15000,0.55
|
||||
18,2900,0,179,0,4,500,0.9,15000,0.05
|
||||
19,2900,0,179,0,4,500,0.9,15000,0.15
|
||||
20,2900,0,179,0,4,500,0.9,15000,0.25
|
||||
21,2900,0,179,0,4,500,0.9,15000,0.35
|
||||
22,2900,0,179,0,4,500,0.9,15000,0.45
|
||||
23,2900,0,179,0,4,500,0.9,15000,0.55
|
||||
24,2900,0,179,0,5,500,0.9,15000,0.05
|
||||
25,2900,0,179,0,5,500,0.9,15000,0.15
|
||||
26,2900,0,179,0,5,500,0.9,15000,0.25
|
||||
27,2900,0,179,0,5,500,0.9,15000,0.35
|
||||
28,2900,0,179,0,5,500,0.9,15000,0.45
|
||||
29,2900,0,179,0,5,500,0.9,15000,0.55
|
||||
30,2900,0,179,0,6,500,0.9,15000,0.05
|
||||
31,2900,0,179,0,6,500,0.9,15000,0.15
|
||||
32,2900,0,179,0,6,500,0.9,15000,0.25
|
||||
33,2900,0,179,0,6,500,0.9,15000,0.35
|
||||
34,2900,0,179,0,6,500,0.9,15000,0.45
|
||||
35,2900,0,179,0,6,500,0.9,15000,0.55
|
||||
36,2900,0,179,0,7,500,0.9,15000,0.05
|
||||
37,2900,0,179,0,7,500,0.9,15000,0.15
|
||||
38,2900,0,179,0,7,500,0.9,15000,0.25
|
||||
39,2900,0,179,0,7,500,0.9,15000,0.35
|
||||
40,2900,0,179,0,7,500,0.9,15000,0.45
|
||||
41,2900,0,179,0,7,500,0.9,15000,0.55
|
||||
42,2900,0,179,0,8,500,0.9,15000,0.05
|
||||
43,2900,0,179,0,8,500,0.9,15000,0.15
|
||||
44,2900,0,179,0,8,500,0.9,15000,0.25
|
||||
45,2900,0,179,0,8,500,0.9,15000,0.35
|
||||
46,2900,0,179,0,8,500,0.9,15000,0.45
|
||||
47,2900,0,179,0,8,500,0.9,15000,0.55
|
||||
48,2900,0,179,0,9,500,0.9,15000,0.05
|
||||
49,2900,0,179,0,9,500,0.9,15000,0.15
|
||||
50,2900,0,179,0,9,500,0.9,15000,0.25
|
||||
51,2900,0,179,0,9,500,0.9,15000,0.35
|
||||
52,2900,0,179,0,9,500,0.9,15000,0.45
|
||||
53,2900,0,179,0,9,500,0.9,15000,0.55
|
||||
54,2900,0,179,0,10,500,0.9,15000,0.05
|
||||
55,2900,0,179,0,10,500,0.9,15000,0.15
|
||||
56,2900,0,179,0,10,500,0.9,15000,0.25
|
||||
57,2900,0,179,0,10,500,0.9,15000,0.35
|
||||
58,2900,0,179,0,10,500,0.9,15000,0.45
|
||||
59,2900,0,179,0,10,500,0.9,15000,0.55
|
||||
|
||||
|
@@ -46,7 +46,7 @@ def loadFile():
|
||||
def selectWeather(matrix,experimentNumber):
|
||||
return matrix[experimentNumber]
|
||||
|
||||
def experimentSetUp(client,currentConditions,newExperiment):
|
||||
def experimentSetUp(client,currentConditions,newExperiment,file):
|
||||
# input("Check The Loaded File Now")
|
||||
print("Entered: EXPERIMENTSETUP")
|
||||
if(newExperiment):
|
||||
@@ -146,10 +146,16 @@ def experimentSetUp(client,currentConditions,newExperiment):
|
||||
print("Setting initial velocity")
|
||||
zInit = "sim/flightmodel/position/local_vz"
|
||||
client.sendDREF(zInit, 50)
|
||||
|
||||
|
||||
|
||||
print("Setting Fuel to Experiment Level")
|
||||
# fuel = "sim/aircraft/weight/acf_m_fuel_tot"
|
||||
fuel = "sim/flightmodel/weight/m_fuel"
|
||||
fuelLevels = [20,20]
|
||||
client.sendDREF(fuel, fuelLevels)
|
||||
print("setup complete")
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Set orientation and Position
|
||||
1 - Time
|
||||
@@ -168,12 +174,13 @@ def experimentSetUp(client,currentConditions,newExperiment):
|
||||
"Turbulence: {} \n" \
|
||||
"Thermal Rate: {} \n" \
|
||||
"Thermal Percent: {}\n" \
|
||||
"Thermal Altitude: {}\n".format(currentConditions[0],currentConditions[1],currentConditions[2],currentConditions[3],currentConditions[4],
|
||||
currentConditions[5],currentConditions[6],currentConditions[7],currentConditions[8])
|
||||
"Thermal Altitude: {}\n" \
|
||||
"Cognitive Delay: {}\n".format(currentConditions[0],currentConditions[1],currentConditions[2],currentConditions[3],currentConditions[4],
|
||||
currentConditions[5],currentConditions[6],currentConditions[7],currentConditions[8],currentConditions[9])
|
||||
specialPrint(message,False,messageType.REGULAR)
|
||||
# file.write("[[[" + message + "]]]")
|
||||
|
||||
|
||||
|
||||
specialPrint(message,False,messageType.REGULAR)
|
||||
|
||||
else:
|
||||
print("Experiment currently in progress, not resetting position and environmental conditions")
|
||||
|
||||
@@ -223,7 +230,7 @@ def runExperiment(title,currentConditions,allowPrinting,isNewExperiment,experime
|
||||
while(timeElapsed <= timeoutLimit and experimentInProgress):
|
||||
try:
|
||||
with xpc.XPlaneConnect() as client:
|
||||
"""
|
||||
"""
|
||||
Test Connection
|
||||
"""
|
||||
client.getDREF("sim/test/test_float")
|
||||
@@ -235,13 +242,13 @@ def runExperiment(title,currentConditions,allowPrinting,isNewExperiment,experime
|
||||
"""
|
||||
Set Simulator Conditions
|
||||
"""
|
||||
experimentSetUp(cogModel.client,currentConditions,newExperiment)
|
||||
experimentSetUp(cogModel.client,currentConditions,newExperiment,file)
|
||||
|
||||
currentDelay = float(currentConditions[9])
|
||||
"""
|
||||
"""
|
||||
cogModel.client.pauseSim(False)
|
||||
newExperiment = False
|
||||
|
||||
|
||||
"""
|
||||
SETUP DATA THREAD
|
||||
"""
|
||||
@@ -255,7 +262,7 @@ def runExperiment(title,currentConditions,allowPrinting,isNewExperiment,experime
|
||||
elapsed = endTime - startTime
|
||||
while(experimentInProgress):
|
||||
elapsed = endTime - startTime
|
||||
if(elapsed > 0.05):
|
||||
if(elapsed > currentDelay):
|
||||
cogModel.update_aircraft_state()
|
||||
cogModel.update_controls_simultaneously()
|
||||
client.pauseSim(False) #Unpause Simulator
|
||||
@@ -340,38 +347,39 @@ def ex():
|
||||
"""
|
||||
One Time experimental setup
|
||||
"""
|
||||
title = specialPrint("Please Enter Experiment Set Title, leave blank for trial runs", False, messageType.REGULAR)
|
||||
startAt = input("Start At Experiment #")
|
||||
prefix = specialPrint("Please Enter Experiment Set Title, leave blank for trial runs", True, messageType.REGULAR)
|
||||
experimentConditionMatrix = loadFile()
|
||||
title = str(experimentConditionMatrix[0][0])
|
||||
startAt = input("Start At Experiment # 1 to " + str(len(experimentConditionMatrix)-1))
|
||||
|
||||
title = str(prefix + "--" + experimentConditionMatrix[0][0])
|
||||
specialPrint("Title is: " + title, False, messageType.REGULAR)
|
||||
allowPrinting = False
|
||||
isNewExperiment = True
|
||||
experimentCount = int(startAt)
|
||||
header = "Cycle Time,Latitude, Longitude, Altitude, Pitch, Roll\n"
|
||||
file2 = open("/Users/flyingtopher/Desktop/Test Destination/Current Experiment/CurrentExperimentList.txt", 'w')
|
||||
"""
|
||||
Experiment Loop
|
||||
"""
|
||||
while(experimentCount<len(experimentConditionMatrix)):
|
||||
setUp()
|
||||
file = open("/Users/flyingtopher/X-Plane 11/Data.txt", 'a')
|
||||
file.write(str(header)) #Write Header to File
|
||||
file.write(str(header)) #Write Header to File$
|
||||
currentConditions = experimentConditionMatrix[experimentCount]
|
||||
exitExperimentLoop = runExperiment(title,currentConditions,allowPrinting,isNewExperiment,(experimentCount+1),file)
|
||||
file2.write(str(experimentCount) +" // " + str(currentConditions) + "\n")
|
||||
exitExperimentLoop = runExperiment(title,currentConditions,allowPrinting,isNewExperiment,experimentCount,file)
|
||||
if(exitExperimentLoop):
|
||||
break
|
||||
cleanUp(experimentCount,title)
|
||||
experimentCount+=1
|
||||
cleanUp((experimentCount),title)
|
||||
# pag.alert(text="Experiment " + str(experimentCount+1) + " complete. Starting new Experiment", title="EXPERIMENT STATUS UPDATE")
|
||||
"""
|
||||
End of Experiments
|
||||
"""
|
||||
now = datetime.datetime
|
||||
##Adding something to copy all the battery files into a safe folder so they don't get overwritten
|
||||
shutil.copytree("/Users/flyingtopher/Desktop/Test Destination/Current Experiment", ("/Users/flyingtopher/Desktop/Test Destination/Data Storage/" + str(now.now())), dirs_exist_ok=True)
|
||||
shutil.copytree("/Users/flyingtopher/Desktop/Test Destination/Current Experiment", ("/Users/flyingtopher/Desktop/Test Destination/Data Storage/" + title + " " + str(now.now())), dirs_exist_ok=True)
|
||||
specialPrint("Experiment Battery Complete", False,messageType.REGULAR)
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
ex()
|
||||
Reference in New Issue
Block a user