yanpanlau / DDPG-Keras-Torcs

Using Keras and Deep Deterministic Policy Gradient to play TORCS
717 stars 267 forks source link

Torcs is continuously relaunching! #31

Open sahisnu opened 6 years ago

sahisnu commented 6 years ago

Hi,

I am trying to run your ddpg code. I setup Torcs and all required packages. When I run torcs in my terminal, it runs well and I can play without any problem. But, whenever I try to execute the ddpg code, the torcs environment continuously relaunches. I am not been able to get the issue.

Here is the snapshot.

screen shot 2017-12-25 at 8 52 53 pm

I also studied gym_torcs.py where reset() functions are written, autostart.sh, and snakeoil3_gym.py. But, couldn't resolve it! Can you please tell me if I'm missing something!

kaushikb258 commented 6 years ago

Hi, I'm having the same issue. Did you solve the problem?

kaushikb258 commented 6 years ago

Actually I solved the problem. We need to also install vtorcs-RL-color. The relaunching loop issue is solved for me!

sahisnu commented 6 years ago

Yes,..I solved it! Sorry...forgot to update the issue.. Anyway, thanks a lot for your response!

kaushikb258 commented 6 years ago

But I am trying to train from scratch. I get a frozen screen and the message "Timeout for client answer." Were you able to train from scratch? Also, the weights file provided in GitHub (that came with this code) is not driving well. Did you have similar issues?

sahisnu commented 6 years ago

Yes, I am able to train it from scratch. I didn't use the weight files provided. So, cann't say how well it works.

Regarding the timeout problem, I remember I edited the sever source files in the "src" folder of vtorcs-RL-color. You can try increasing the timeout value there and see whether it works fine or not. I remember I set it to 60sec. After editing the src files, you need to reinstall vtorcs-RL-color to see the change.

kaushikb258 commented 6 years ago

I suppose you are referring to line 67 of this file: vtorcs-RL-color/src/drivers/scr_server/scr_server.cpp

which currently is set to:

define UDP_DEFAULT_TIMEOUT 100000

Should I increase this number?

sahisnu commented 6 years ago

Yes, you can try increasing that value. I guess it is 1ms. Also, make sure the change gets affected! If there is no change after modification, the timeout print statement is somewhere down the file. You can try to check the code segment out.

kaushikb258 commented 6 years ago

Works now. That's in microsecs actually. Thanks a lot!

kaushikb258 commented 6 years ago

One final question. To train from scratch, how many episodes did you need for the car to drive properly? It is currently set to the following values:

episode_count = 2000 max_steps = 100000

sahisnu commented 6 years ago

It takes large number of episodes....I ran it for 200 and stopped. However, you can get some improvement by tuning certain parameters of the model.

kaushikb258 commented 6 years ago

Thanks, I got it working after some minor changes.

binderwang commented 6 years ago

I met the relaunching problem as well. I found the reason maybe the client port 3001, I changed to the origin 3101 and it worked. May it help somebody.

kk2491 commented 6 years ago

I do have the same problem, I have tried both solutions updated here. But no luck. Could you guys please help me fix .?

ThePancakerizer commented 5 years ago

This solved the problem for me

umbertospazio commented 5 years ago

Hi @kaushikb258, @sahisnu . I need to increase UDP_DEFAULT_TIMEOUT in scr_server.cpp Can you please give me a hint of how to get the change affected? Thank you a lot

kaushikb258 commented 5 years ago

Somewhere near line 67 of vtorcs-RL-color/src/drivers/scr_server/scr_server.cpp you can set:

define UDP_DEFAULT_TIMEOUT 100000000

(this number is time in microseconds, set to a large value)

After that, the following 3 commands to re-compile vtorcs-RL-color: make make install make datainstall

Aarnnity commented 3 years ago

Somewhere near line 67 of vtorcs-RL-color/src/drivers/scr_server/scr_server.cpp you can set:

define UDP_DEFAULT_TIMEOUT 100000000

(this number is time in microseconds, set to a large value)

After that, the following 3 commands to re-compile vtorcs-RL-color: make make install make datainstall

Hi, I’m a novice, I’m learning DDPG recently, I think it’s very cool. However, I have encountered some problems, such as how to set up multiple lanes in torcs, and how to add other vehicles on the lanes, can you please provide some help, thank you, really, I need your help.