TUDelft-CNS-ATM / bluesky

The open source air traffic simulator
GNU General Public License v3.0
365 stars 244 forks source link

Add a reset for the autopilot? #483

Closed amorfinv closed 11 months ago

amorfinv commented 11 months ago

Hello,

I noticed a minor bug in the autopilot. Most variables are initialised as traffic arrays except idx_reached in line 78. Therefore, on a reset idx_reached does not get cleared.

bluesky crashed when I reset just as an aircraft had reached a waypoint. I then tried to start a new simulation but was not able to. The reason it crashed was because one of my plugins had an update function that uses idx_reached. I fixed it by only running the update if there are aircraft in the simulation.

Perhaps making idx_reached a traffic array or adding a reset method could be nice?

-Andres

ProfHoekstra commented 11 months ago

Hi Andres,

It is by its nature not a traffic array, as it is an array with the indices of aircraft who have reached their waypoint. So it is not per aircraft. It was a local variable and should still be used as such. Not sure why it was upgraded to a member variable, probably only for debugging. Do not use it for anything else.

If you want to know distance, active waypoint or changes thereof or anything related to the active waypoint, please use the actwp variables.