In Flight.__simulate, controllers are called twice per time node.
This is a leftover loop from the refactor introduced in #843.
In commit 45a891e, __process_sensors_and_controllers_at_current_node
was introduced for sensor and controller processing. However,
the original controller loop was not removed from __simulate.
Any flight simulation with a controller (e.g. air brakes) will trigger
this bug. You can verify it by adding a print statement to your controller:
def air_brakes_controller(t, y_sol, solution, sensors):
print(t)
You will see each timestamp printed twice, confirming the controller
is being called twice per time node.
A controller that depends on the time elapsed since the last call (e.g. a PID
controller) will compute incorrect values since it is called twice at the same timestamp.
In
Flight.__simulate, controllers are called twice per time node.This is a leftover loop from the refactor introduced in #843.
In commit 45a891e,
__process_sensors_and_controllers_at_current_nodewas introduced for sensor and controller processing. However,
the original controller loop was not removed from
__simulate.Any flight simulation with a controller (e.g. air brakes) will trigger
this bug. You can verify it by adding a print statement to your controller:
def air_brakes_controller(t, y_sol, solution, sensors):
print(t)
You will see each timestamp printed twice, confirming the controller
is being called twice per time node.
A controller that depends on the time elapsed since the last call (e.g. a PID
controller) will compute incorrect values since it is called twice at the same timestamp.