DDPG-Keras-Torcs icon indicating copy to clipboard operation
DDPG-Keras-Torcs copied to clipboard

Torcs is continuously relaunching!

Open sahisnu opened this issue 6 years ago • 17 comments

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!

sahisnu avatar Dec 26 '17 03:12 sahisnu

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

kaushikb258 avatar Feb 22 '18 02:02 kaushikb258

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

kaushikb258 avatar Feb 22 '18 03:02 kaushikb258

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

sahisnu avatar Feb 22 '18 03:02 sahisnu

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?

kaushikb258 avatar Feb 22 '18 04:02 kaushikb258

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.

sahisnu avatar Feb 22 '18 04:02 sahisnu

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?

kaushikb258 avatar Feb 22 '18 04:02 kaushikb258

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.

sahisnu avatar Feb 22 '18 04:02 sahisnu

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

kaushikb258 avatar Feb 22 '18 04:02 kaushikb258

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

kaushikb258 avatar Feb 22 '18 04:02 kaushikb258

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.

sahisnu avatar Feb 23 '18 21:02 sahisnu

Thanks, I got it working after some minor changes.

kaushikb258 avatar Feb 23 '18 22:02 kaushikb258

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.

binderwang avatar Mar 29 '18 12:03 binderwang

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

kk2491 avatar Sep 19 '18 18:09 kk2491

This solved the problem for me

  • Make sure you have xautomation installed (i missed a dependancy lol)
  • Increase the variable n_fail in snakeoil3_gym.py from 5 to 15 or something

ThePancakerizer avatar Mar 04 '19 19:03 ThePancakerizer

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

umbertospazio avatar Sep 25 '19 19:09 umbertospazio

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

kaushikb258 avatar Sep 25 '19 20:09 kaushikb258

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.

Aarnnity avatar Jan 24 '21 15:01 Aarnnity