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
|
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,2900,0,179,0,1,500,0.9,15000,0.05
|
||||||
1,2900,0,179,0,2,500,0.9,15000
|
1,2900,0,179,0,1,500,0.9,15000,0.15
|
||||||
2,2900,0,179,0,3,500,0.9,15000
|
2,2900,0,179,0,1,500,0.9,15000,0.25
|
||||||
3,2900,0,179,0,4,500,0.9,15000
|
3,2900,0,179,0,1,500,0.9,15000,0.35
|
||||||
4,2900,0,179,0,5,500,0.9,15000
|
4,2900,0,179,0,1,500,0.9,15000,0.45
|
||||||
5,2900,0,179,0,6,500,0.9,15000
|
5,2900,0,179,0,1,500,0.9,15000,0.55
|
||||||
6,2900,0,179,0,7,500,0.9,15000
|
6,2900,0,179,0,2,500,0.9,15000,0.05
|
||||||
7,2900,0,179,0,8,500,0.9,15000
|
7,2900,0,179,0,2,500,0.9,15000,0.15
|
||||||
8,2900,0,179,0,9,500,0.9,15000
|
8,2900,0,179,0,2,500,0.9,15000,0.25
|
||||||
9,2900,0,179,0,10,500,0.9,15000
|
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):
|
def selectWeather(matrix,experimentNumber):
|
||||||
return matrix[experimentNumber]
|
return matrix[experimentNumber]
|
||||||
|
|
||||||
def experimentSetUp(client,currentConditions,newExperiment):
|
def experimentSetUp(client,currentConditions,newExperiment,file):
|
||||||
# input("Check The Loaded File Now")
|
# input("Check The Loaded File Now")
|
||||||
print("Entered: EXPERIMENTSETUP")
|
print("Entered: EXPERIMENTSETUP")
|
||||||
if(newExperiment):
|
if(newExperiment):
|
||||||
@@ -146,10 +146,16 @@ def experimentSetUp(client,currentConditions,newExperiment):
|
|||||||
print("Setting initial velocity")
|
print("Setting initial velocity")
|
||||||
zInit = "sim/flightmodel/position/local_vz"
|
zInit = "sim/flightmodel/position/local_vz"
|
||||||
client.sendDREF(zInit, 50)
|
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")
|
print("setup complete")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Set orientation and Position
|
Set orientation and Position
|
||||||
1 - Time
|
1 - Time
|
||||||
@@ -168,12 +174,13 @@ def experimentSetUp(client,currentConditions,newExperiment):
|
|||||||
"Turbulence: {} \n" \
|
"Turbulence: {} \n" \
|
||||||
"Thermal Rate: {} \n" \
|
"Thermal Rate: {} \n" \
|
||||||
"Thermal Percent: {}\n" \
|
"Thermal Percent: {}\n" \
|
||||||
"Thermal Altitude: {}\n".format(currentConditions[0],currentConditions[1],currentConditions[2],currentConditions[3],currentConditions[4],
|
"Thermal Altitude: {}\n" \
|
||||||
currentConditions[5],currentConditions[6],currentConditions[7],currentConditions[8])
|
"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:
|
else:
|
||||||
print("Experiment currently in progress, not resetting position and environmental conditions")
|
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):
|
while(timeElapsed <= timeoutLimit and experimentInProgress):
|
||||||
try:
|
try:
|
||||||
with xpc.XPlaneConnect() as client:
|
with xpc.XPlaneConnect() as client:
|
||||||
"""
|
"""
|
||||||
Test Connection
|
Test Connection
|
||||||
"""
|
"""
|
||||||
client.getDREF("sim/test/test_float")
|
client.getDREF("sim/test/test_float")
|
||||||
@@ -235,13 +242,13 @@ def runExperiment(title,currentConditions,allowPrinting,isNewExperiment,experime
|
|||||||
"""
|
"""
|
||||||
Set Simulator Conditions
|
Set Simulator Conditions
|
||||||
"""
|
"""
|
||||||
experimentSetUp(cogModel.client,currentConditions,newExperiment)
|
experimentSetUp(cogModel.client,currentConditions,newExperiment,file)
|
||||||
|
|
||||||
|
currentDelay = float(currentConditions[9])
|
||||||
"""
|
"""
|
||||||
"""
|
"""
|
||||||
cogModel.client.pauseSim(False)
|
cogModel.client.pauseSim(False)
|
||||||
newExperiment = False
|
newExperiment = False
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
SETUP DATA THREAD
|
SETUP DATA THREAD
|
||||||
"""
|
"""
|
||||||
@@ -255,7 +262,7 @@ def runExperiment(title,currentConditions,allowPrinting,isNewExperiment,experime
|
|||||||
elapsed = endTime - startTime
|
elapsed = endTime - startTime
|
||||||
while(experimentInProgress):
|
while(experimentInProgress):
|
||||||
elapsed = endTime - startTime
|
elapsed = endTime - startTime
|
||||||
if(elapsed > 0.05):
|
if(elapsed > currentDelay):
|
||||||
cogModel.update_aircraft_state()
|
cogModel.update_aircraft_state()
|
||||||
cogModel.update_controls_simultaneously()
|
cogModel.update_controls_simultaneously()
|
||||||
client.pauseSim(False) #Unpause Simulator
|
client.pauseSim(False) #Unpause Simulator
|
||||||
@@ -340,38 +347,39 @@ def ex():
|
|||||||
"""
|
"""
|
||||||
One Time experimental setup
|
One Time experimental setup
|
||||||
"""
|
"""
|
||||||
title = specialPrint("Please Enter Experiment Set Title, leave blank for trial runs", False, messageType.REGULAR)
|
prefix = specialPrint("Please Enter Experiment Set Title, leave blank for trial runs", True, messageType.REGULAR)
|
||||||
startAt = input("Start At Experiment #")
|
|
||||||
experimentConditionMatrix = loadFile()
|
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)
|
specialPrint("Title is: " + title, False, messageType.REGULAR)
|
||||||
allowPrinting = False
|
allowPrinting = False
|
||||||
isNewExperiment = True
|
isNewExperiment = True
|
||||||
experimentCount = int(startAt)
|
experimentCount = int(startAt)
|
||||||
header = "Cycle Time,Latitude, Longitude, Altitude, Pitch, Roll\n"
|
header = "Cycle Time,Latitude, Longitude, Altitude, Pitch, Roll\n"
|
||||||
|
file2 = open("/Users/flyingtopher/Desktop/Test Destination/Current Experiment/CurrentExperimentList.txt", 'w')
|
||||||
"""
|
"""
|
||||||
Experiment Loop
|
Experiment Loop
|
||||||
"""
|
"""
|
||||||
while(experimentCount<len(experimentConditionMatrix)):
|
while(experimentCount<len(experimentConditionMatrix)):
|
||||||
setUp()
|
setUp()
|
||||||
file = open("/Users/flyingtopher/X-Plane 11/Data.txt", 'a')
|
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]
|
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):
|
if(exitExperimentLoop):
|
||||||
break
|
break
|
||||||
|
cleanUp(experimentCount,title)
|
||||||
experimentCount+=1
|
experimentCount+=1
|
||||||
cleanUp((experimentCount),title)
|
|
||||||
# pag.alert(text="Experiment " + str(experimentCount+1) + " complete. Starting new Experiment", title="EXPERIMENT STATUS UPDATE")
|
# pag.alert(text="Experiment " + str(experimentCount+1) + " complete. Starting new Experiment", title="EXPERIMENT STATUS UPDATE")
|
||||||
"""
|
"""
|
||||||
End of Experiments
|
End of Experiments
|
||||||
"""
|
"""
|
||||||
now = datetime.datetime
|
now = datetime.datetime
|
||||||
##Adding something to copy all the battery files into a safe folder so they don't get overwritten
|
##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)
|
specialPrint("Experiment Battery Complete", False,messageType.REGULAR)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
ex()
|
ex()
|
||||||
Reference in New Issue
Block a user