utiasDSL / lsy_drone_racing

Autonomous drone racing course @ LSY
MIT License
15 stars 24 forks source link

Error running train.py #1

Closed ge75xuv closed 5 months ago

ge75xuv commented 5 months ago

Hi @amacati,

I tried to run train.py, the new script that you created for training an RL agent. However, it gives an error that says:

"File "examples/train.py", line 46, in main env = create_race_env(config_path=config_path, gui=gui) File "examples/train.py", line 39, in create_race_env return DroneRacingWrapper(firmware_env, terminate_on_lap=True) File "/home/tngrbz/drone_racing/lsy_drone_racing/lsy_drone_racing/wrapper.py", line 81, in init n_gates = env.env.NUM_GATES AttributeError: 'Quadrotor' object has no attribute 'NUM_GATES'"

It's weird because I switched the safe-control-gym repo to the "lsy_drone_racing" branch, which you suggested on Moodle, and I can see the place where the NUM_GATES is defined as well (in quadrotor.py line 346). Also, it was running well before switching to the dev. Here is the whole error prompt I get. I think I misconfigured something, but I couldn't really figure it out. ErrorLog.txt

amacati commented 5 months ago

Can you recheck if you are on commit efaf54cf9dd3c5ccc265e9cc31537172ebcc74a7 for safe-control-gym and on commit 0025437 for lsy_drone_racing, and rerun the script? I fixed a related error in commit 0025437, but cannot reproduce yours.

amacati commented 5 months ago

I also added some tests. You can install pytest and run them from the root folder with

pytest tests

There are some warnings from third-party packages that you can ignore. On my setup, all tests pass. If they don't on your end, then please double-check if you have installed safe-control-gym in editable mode. Otherwise the most recent updates are not applied, even though the repository has been updated.

Let me know if any of the above works

ge75xuv commented 5 months ago

For safe-control-gym, I am exactly on the commit that you mentioned (efaf54cf9dd3c5ccc265e9cc31537172ebcc74a7); for the lsy_drone_racing; I fetched and pulled everything recently, so I am on the latest commit, which means one after the one you mentioned. I ran pytest, and it also failed with the very same error above, so I guess it is not in editable mode as you referred. I will have a look at it

ge75xuv commented 5 months ago

Okay thanks for the help, installing it in editable mode pip install -e . made it work. Weird because I am sure that I did that in the beginning as well since you said so in the kick-off meeting.