Skip to content

BUG: Controllers called twice per time node in Flight.__simulate #959

@Krissal1234

Description

@Krissal1234

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions