control problem identified (not fixed): commands are not within -1 to 1 range for integral control

This commit is contained in:
cs-powell
2025-02-10 18:37:52 -05:00
parent 9ff45d35a9
commit 1e39b3b1e6
2 changed files with 6 additions and 3 deletions

View File

@@ -7,6 +7,7 @@ import xpc
class AircraftLandingModel(pyactr.ACTRModel): class AircraftLandingModel(pyactr.ACTRModel):
def __init__(self,client): def __init__(self,client):
super().__init__() super().__init__()
# Initialize the declarative memory (DM) # Initialize the declarative memory (DM)
# self.decmem.add( # self.decmem.add(
# [ # [
@@ -20,6 +21,7 @@ class AircraftLandingModel(pyactr.ACTRModel):
# ("target_descent_rate", 500) # Target descent rate (fpm) # ("target_descent_rate", 500) # Target descent rate (fpm)
# ] # ]
# ) # )
self.client = client self.client = client
self.airspeed = 100 self.airspeed = 100
self.roll = 0 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) 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) 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) 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 # Send all controls simultaneously to X-Plane
self.send_controls_to_xplane(yoke_pull, yoke_steer, rudder, throttle) 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 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
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] self.client.sendCTRL([yoke_pull, yoke_steer, rudder, throttle, -998, -998]) # Control inputs: [yoke_pull, yoke_steer, rudder, throttle]

View File

@@ -97,8 +97,8 @@ def ex():
#50 Millisecond Timesteps #50 Millisecond Timesteps
sleep(0.05) sleep(0.05)
client.pauseSim(False) #Unpause client.pauseSim(False) #Unpause
sleep(0.05) # Run 50 Milliseconds # sleep(0.05) # Run 50 Milliseconds
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#######
cogModel.update_aircraft_state() cogModel.update_aircraft_state()