ITS ALIVEEEE!!!!!!
This commit is contained in:
@@ -65,6 +65,8 @@ class AircraftLandingModel(pyactr.ACTRModel):
|
|||||||
"""
|
"""
|
||||||
Update all controls at the same time by calculating control values for each parameter.
|
Update all controls at the same time by calculating control values for each parameter.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
print("Entered Update Controls Simultaneously")
|
||||||
# Compute control values for all parameters (yoke pull, yoke steer, rudder, throttle)
|
# Compute control values for all parameters (yoke pull, yoke steer, rudder, throttle)
|
||||||
yoke_pull, self.integral_airspeed = self.proportionalIntegralControl(self.airspeed, self.target_airspeed, self.integral_airspeed)
|
yoke_pull, self.integral_airspeed = self.proportionalIntegralControl(self.airspeed, self.target_airspeed, self.integral_airspeed)
|
||||||
yoke_steer, self.integral_roll = self.proportionalIntegralControl(self.roll, self.target_roll, self.integral_roll)
|
yoke_steer, self.integral_roll = self.proportionalIntegralControl(self.roll, self.target_roll, self.integral_roll)
|
||||||
@@ -79,12 +81,13 @@ class AircraftLandingModel(pyactr.ACTRModel):
|
|||||||
Sends all control inputs to X-Plane using XPlaneConnect
|
Sends all control inputs to X-Plane using XPlaneConnect
|
||||||
"""
|
"""
|
||||||
# Send yoke pull, yoke steer, rudder, and throttle simultaneously
|
# Send yoke pull, yoke steer, rudder, and throttle simultaneously
|
||||||
self.client.sendControls([yoke_pull, yoke_steer, 0, rudder, throttle]) # Control inputs: [yoke_pull, yoke_steer, roll/pitch, rudder, throttle]
|
self.client.sendCTRL([yoke_pull, yoke_steer, rudder, throttle, -998, -998]) # Control inputs: [yoke_pull, yoke_steer, rudder, throttle]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Update the model's DM based on X-Plane data
|
# Update the model's DM based on X-Plane data
|
||||||
def update_aircraft_state(self):
|
def update_aircraft_state(self):
|
||||||
|
print("Entered Update Aircraft State")
|
||||||
# Retrieve current data from X-Plane
|
# Retrieve current data from X-Plane
|
||||||
airspeed = self.client.getDREF("sim/cockpit2/gauges/indicators/airspeed_kts_pilot")
|
airspeed = self.client.getDREF("sim/cockpit2/gauges/indicators/airspeed_kts_pilot")
|
||||||
roll = self.client.getDREF("sim/cockpit2/gauges/indicators/roll_AHARS_deg_pilot")
|
roll = self.client.getDREF("sim/cockpit2/gauges/indicators/roll_AHARS_deg_pilot")
|
||||||
@@ -97,10 +100,15 @@ class AircraftLandingModel(pyactr.ACTRModel):
|
|||||||
# model.declarative_memory["heading"] = heading
|
# model.declarative_memory["heading"] = heading
|
||||||
# model.declarative_memory["descent_rate"] = descent_rate
|
# model.declarative_memory["descent_rate"] = descent_rate
|
||||||
|
|
||||||
self.airspeed = airspeed
|
self.airspeed = airspeed[0]
|
||||||
self.roll = roll
|
self.roll = roll[0]
|
||||||
self.heading = heading
|
self.heading = heading[0]
|
||||||
self.descent_rate = descent_rate
|
self.descent_rate = descent_rate[0]
|
||||||
|
print(self.airspeed)
|
||||||
|
print(self.roll)
|
||||||
|
print(self.heading)
|
||||||
|
print(self.descent_rate)
|
||||||
|
|
||||||
|
|
||||||
# def rules(self):
|
# def rules(self):
|
||||||
# """
|
# """
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
from time import sleep
|
from time import sleep
|
||||||
import xpc
|
import xpc
|
||||||
from model import AircraftLandingModel
|
from cognitiveModel import AircraftLandingModel
|
||||||
|
|
||||||
def ex():
|
def ex():
|
||||||
print("X-Plane Connect example script")
|
print("X-Plane Connect example script")
|
||||||
@@ -16,8 +16,7 @@ def ex():
|
|||||||
print("Exiting...")
|
print("Exiting...")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
cogModel = AircraftLandingModel(client)
|
||||||
test = AircraftLandingModel(client)
|
|
||||||
|
|
||||||
# # Set position of the player aircraft
|
# # Set position of the player aircraft
|
||||||
# print("Setting position")
|
# print("Setting position")
|
||||||
@@ -102,9 +101,9 @@ def ex():
|
|||||||
client.pauseSim(True) # Pause Simulator
|
client.pauseSim(True) # Pause Simulator
|
||||||
#Run Model (Send commands to simulator within this process)
|
#Run Model (Send commands to simulator within this process)
|
||||||
####Insert Model Here, some assembly required#######
|
####Insert Model Here, some assembly required#######
|
||||||
test.update_aircraft_state()
|
cogModel.update_aircraft_state()
|
||||||
test.update_controls_simultaneously()
|
cogModel.update_controls_simultaneously()
|
||||||
#Please work
|
#Please work........no excuses now
|
||||||
#Repeat
|
#Repeat
|
||||||
print("Advanced 50 Milliseconds: Step #" + str(count))
|
print("Advanced 50 Milliseconds: Step #" + str(count))
|
||||||
count+=1
|
count+=1
|
||||||
Reference in New Issue
Block a user