From 1e39b3b1e648d19d9e2f27c2414f8ee627d3b5ae Mon Sep 17 00:00:00 2001 From: cs-powell <142438185+cs-powell@users.noreply.github.com> Date: Mon, 10 Feb 2025 18:37:52 -0500 Subject: [PATCH] control problem identified (not fixed): commands are not within -1 to 1 range for integral control --- Python3/src/cognitiveModel.py | 5 ++++- Python3/src/testPlatform.py | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Python3/src/cognitiveModel.py b/Python3/src/cognitiveModel.py index e292d99..8ae0a4b 100644 --- a/Python3/src/cognitiveModel.py +++ b/Python3/src/cognitiveModel.py @@ -7,6 +7,7 @@ import xpc class AircraftLandingModel(pyactr.ACTRModel): def __init__(self,client): super().__init__() + # Initialize the declarative memory (DM) # self.decmem.add( # [ @@ -20,6 +21,7 @@ class AircraftLandingModel(pyactr.ACTRModel): # ("target_descent_rate", 500) # Target descent rate (fpm) # ] # ) + self.client = client self.airspeed = 100 self.roll = 0 @@ -72,7 +74,7 @@ class AircraftLandingModel(pyactr.ACTRModel): yoke_steer, self.integral_roll = self.proportionalIntegralControl(self.roll, self.target_roll, self.integral_roll) rudder, self.integral_heading = self.proportionalIntegralControl(self.heading, self.target_heading, self.integral_heading) throttle, self.integral_descent_rate = self.proportionalIntegralControl(self.descent_rate, self.target_descent_rate, self.integral_descent_rate) - + # Send all controls simultaneously to X-Plane self.send_controls_to_xplane(yoke_pull, yoke_steer, rudder, throttle) @@ -81,6 +83,7 @@ class AircraftLandingModel(pyactr.ACTRModel): Sends all control inputs to X-Plane using XPlaneConnect """ # Send yoke pull, yoke steer, rudder, and throttle simultaneously + print("Yoke Pull:" + str(yoke_pull)) self.client.sendCTRL([yoke_pull, yoke_steer, rudder, throttle, -998, -998]) # Control inputs: [yoke_pull, yoke_steer, rudder, throttle] diff --git a/Python3/src/testPlatform.py b/Python3/src/testPlatform.py index f923a67..0f782c7 100644 --- a/Python3/src/testPlatform.py +++ b/Python3/src/testPlatform.py @@ -97,8 +97,8 @@ def ex(): #50 Millisecond Timesteps sleep(0.05) client.pauseSim(False) #Unpause - sleep(0.05) # Run 50 Milliseconds - client.pauseSim(True) # Pause Simulator + # sleep(0.05) # Run 50 Milliseconds + # client.pauseSim(True) # Pause Simulator #Run Model (Send commands to simulator within this process) ####Insert Model Here, some assembly required####### cogModel.update_aircraft_state()