andreped / super-ml-pets

🐢 AI for Super Auto Pets
MIT License
31 stars 13 forks source link

Improve error message when bot fails to find pets #61

Open andreped opened 1 year ago

andreped commented 1 year ago

What might happen is that the bot might completely fail to find any pets, even though there are some.

A cause to this could be that the user did not use fullscreen, or accidentally opened the terminal or left the game, while the bot was making actions.

This results in the error message below, which should be catched and a better verbose shall be given to the user.

Error log:

(venv) PS C:\Users\andrp\workspace\super-ml-pets> python .\main.py --task deploy --infer_model .\models\model_sap_gym_sb3_180822_checkpoint_2175_steps
INFO main.py 53 Pausing...
INFO main.py 56 Running...
INFO deploy_agent.py 94 INITIALIZATION [self.run]: Loading Model
INFO deploy_agent.py 97 INITIALIZATION [self.run]: Create SuperAutoPetsEnv Object
INFO deploy_agent.py 104 CV SYSTEM [self.run]: Detect the Pets and Food in the Shop Slots
INFO deploy_agent.py 106 CV SYSTEM [self.run]: Calls [image_detection.find_the_animals]
Traceback (most recent call last):
  File ".\main.py", line 63, in <module>
    main()
  File ".\main.py", line 57, in main
    run(ret)
  File "C:\Users\andrp\workspace\super-ml-pets\smp\deploy_agent.py", line 109, in run
    directory=os.path.join(os.path.dirname(os.path.abspath(__file__)), "SAP_res/").replace("\\", "/"))
ValueError: not enough values to unpack (expected 2, got 0)
adjmathix commented 1 year ago

I noticed that there was a graphic update in the game, so the animals in-game aren't looking like the ones in SAP_res.

andreped commented 1 year ago

I noticed that there was a graphic update in the game, so the animals in-game aren't looking like the ones in SAP_res.

You need to do step 3 described in the Usage (see README). Then you will change back to the old style of the pets in the game.

andreped commented 1 year ago

@adjmathix The same thing was just now also reported in https://github.com/andreped/super-ml-pets/issues/70.

It seems you are right. All food templates needs to be updated... We move the discussion over to https://github.com/andreped/super-ml-pets/issues/70

MasonLyons commented 1 year ago

What might happen is that the bot might completely fail to find any pets, even though there are some.

A cause to this could be that the user did not use fullscreen, or accidentally opened the terminal or left the game, while the bot was making actions.

This results in the error message below, which should be catched and a better verbose shall be given to the user.

Error log:

(venv) PS C:\Users\andrp\workspace\super-ml-pets> python .\main.py --task deploy --infer_model .\models\model_sap_gym_sb3_180822_checkpoint_2175_steps
INFO main.py 53 Pausing...
INFO main.py 56 Running...
INFO deploy_agent.py 94 INITIALIZATION [self.run]: Loading Model
INFO deploy_agent.py 97 INITIALIZATION [self.run]: Create SuperAutoPetsEnv Object
INFO deploy_agent.py 104 CV SYSTEM [self.run]: Detect the Pets and Food in the Shop Slots
INFO deploy_agent.py 106 CV SYSTEM [self.run]: Calls [image_detection.find_the_animals]
Traceback (most recent call last):
  File ".\main.py", line 63, in <module>
    main()
  File ".\main.py", line 57, in main
    run(ret)
  File "C:\Users\andrp\workspace\super-ml-pets\smp\deploy_agent.py", line 109, in run
    directory=os.path.join(os.path.dirname(os.path.abspath(__file__)), "SAP_res/").replace("\\", "/"))
ValueError: not enough values to unpack (expected 2, got 0)

Related to this, would you accept a PR improving the overall logging of the project?

I've changed the code locally to also log to a file and output the filename, line and function in all logs. I've also cleaned up the formatting and changed the use of format to f-strings.

andreped commented 10 months ago

Should be fixed in https://github.com/andreped/super-ml-pets/commit/5ce7b6671bc6d0d067155ea72e5c454599f4d735.

But I need to run some tests tomorrow on my Windows laptop.

Basically, all food and pet items have now been updated: https://github.com/andreped/super-ml-pets/commit/5ce7b6671bc6d0d067155ea72e5c454599f4d735