Coder Social home page Coder Social logo

ugo-nama-kun / gym_torcs Goto Github PK

View Code? Open in Web Editor NEW
409.0 17.0 165.0 192.04 MB

License: MIT License

Shell 1.45% Python 0.48% Makefile 4.75% M4 0.07% C 14.34% Batchfile 4.73% HTML 9.58% CSS 0.03% JavaScript 0.01% XSLT 0.24% NSIS 1.59% Java 11.47% C++ 48.77% TeX 2.07% Objective-C 0.32% Roff 0.09%

gym_torcs's Introduction

Gym-TORCS

Gym-TORCS is the reinforcement learning (RL) environment in TORCS domain with OpenAI-gym-like interface. TORCS is the open-rource realistic car racing simulator recently used as RL benchmark task in several AI studies.

Gym-TORCS is the python wrapper of TORCS for RL experiment with the simple interface (similar, but not fully) compatible with OpenAI-gym environments. The current implementaion is for only the single-track race in practie mode. If you want to use multiple tracks or other racing mode (quick race etc.), you may need to modify the environment, "autostart.sh" or the race configuration file using GUI of TORCS.

This code is developed based on vtorcs (https://github.com/giuse/vtorcs) and python-client for torcs (http://xed.ch/project/snakeoil/index.html).

The detailed explanation of original TORCS for AI research is given by Daniele Loiacono et al. (https://arxiv.org/pdf/1304.1672.pdf)

Because torcs has memory leak bug at race reset. As an ad-hoc solution, we relaunch and automate the gui setting in torcs. Any better solution is welcome!

Requirements

We are assuming you are using Ubuntu 14.04 LTS/16.04 LTS machine and installed

Example Code

The example code and agent are written in example_experiment.py and sample_agent.py.

Initialization of the Race

After the insallation of vtorcs-RL-color, you need to initialize the race setting. You can find the detailed explanation in a document (https://arxiv.org/pdf/1304.1672.pdf), but here I show the simple gui-based setting.

So first you need to run

sudo torcs

in the terminal, the GUI of TORCS should be launched. Then, you need to choose the race track by following the GUI (Race --> Practice --> Configure Race) and open TORCS server by selecting Race --> Practice --> New Race. This should result that TORCS keeps a blue screen with several text information.

If you need to treat the vision input in your AI agent, you have to set the small image size in TORCS. To do so, you have to run

python snakeoil3_gym.py

in the second terminal window after you open the TORCS server (just as written above). Then the race starts, and you can select the driving-window mode by F2 key during the race.

After the selection of the driving-window mode, you need to set the appropriate gui size. This is done by using the display option mode in Options --> Display. You can select the Screen Resolution, and you need to select 64x64 for visual input (our immplementation only support this screen size, other screen size results the unreasonable visual information). Then, you need to shut down TORCS to complete the configuration for the vision treatment.

Simple How-To

from gym_torcs import TorcsEnv

#### Generate a Torcs environment
# enable vision input, the action is steering only (1 dim continuous action)
env = TorcsEnv(vision=True, throttle=False)

# without vision input, the action is steering and throttle (2 dim continuous action)
# env = TorcsEnv(vision=False, throttle=True)

ob = env.reset(relaunch=True)  # with torcs relaunch (avoid memory leak bug in torcs)
# ob = env.reset()  # without torcs relaunch

# Generate an agent
from sample_agent import Agent
agent = Agent(1)  # steering only
action = agent.act(ob, reward, done, vision=True)

# single step
ob, reward, done, _ = env.step(action)

# shut down torcs
env.end()

Add Noise in Low-dim Sensors

If you want to apply sensor noise in low-dimensional sensors, you should

os.system('torcs -nofuel -nodamage -nolaptime -vision -noisy &')
os.system('torcs -nofuel -nolaptime -noisy &')

at 33 & 35th lines in gym_torcs.py

Great Application

gym-torcs was utilized in DDPG experiment with Keras by Ben Lau. This experiment is really great!

https://yanpanlau.github.io/2016/10/11/Torcs-Keras.html

Acknowledgement

gym_torcs was developed during the spring internship 2016 at Preferred Networks.

gym_torcs's People

Contributors

billyzs avatar ioarun avatar nonick avatar ugo-nama-kun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gym_torcs's Issues

Error while 'making' Vtorcs

Hi,

When I execute ./configure in vtorcs folder, the command runs smoothly. However when i execute the next command which is make I get the error as documented in this pastebin link.
Any idea why I get so many errors? I suspect that the makefile is not well formatted.

Thanks

'Observaion' object has no attribute 'angle'

No angle attribute in Observation?

>>>dir(ob)
['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__iter__', '__le__', '__len__', '__lt__', '__module__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmul__', '__setattr__', '__sizeof__', '__slots__', '__str__', '__subclasshook__', '_asdict', '_fields', '_make', '_replace', '_source', 'count', 'focus', 'index', 'opponents', 'rpm', 'speedX', 'speedY', 'speedZ', 'track', 'wheelSpinVel']

How to run snakeoil3_gym.py in racing mode?

Hi~Currently I can run snakeoil3_gym.py in Practice mode. Can I ask how can I run snakeoil3_gym.py in other racing mode? I start torcs --> Race --> Non-Championship Race --> New Race

Then on another terminal I run python snakeoil3_gym.py but I got the following error

ben@i5:~/torcs_race$ python snakeoil3_gym.py
Waiting for server on 3101............
Count Down : 5
Waiting for server on 3101............
Count Down : 4

The above procedure works for Practice Mode...

Thanks

Why was vtorcs not forked?

Hi ugo-nama-kun, I just stumbled upon your repo by chance. I am one of the original authors of vtorcs. I am very happy if my code gets used and distributed by the community, I only wish you had forked it properly, or even better included it as a submodule. Grabbingthe code as you did and then commit it yourself in another repo hides the real authors from the git-blame (and I sure am not even the main one), and cuts any chance for me to pull patches from your work into my repo. Since your work seem much more popular, I would have been happy even to even have you as the official maintainer. Let me know if you like to reconnect to my work, else all these comments marked with "giuse" in your repository may look... well, quite weird :) cheers!

Can't initialize properly - fopen (config/graph.xml, "wb") failed

Hi,

I am trying to get gym_torcs to work on my Ubuntu 14.04. When I execute the sample_experiement.py file, I get the following error:

gfParmSetStr: fopen (config/graph.xml, "wb") failed

Full log:

Fuel consumption disabled!
Car damages disabled!
Laptime limit disabled!
Image generation is ON!
Visual Properties Report
------------------------
Compatibility mode, properties unknown.
Waiting for request on port 3101
TORCS Experiment Start.
Episode : 0
Client connected on 3101..............
OpenAL backend info:
  Vendor: OpenAL Community
  Renderer: OpenAL Soft
  Version: 1.1 ALSOFT 1.14
  Available sources: 256
  Available buffers: 1024 or more
  Dynamic Sources: requested: 235, created: 235
  #static sources: 21
  #dyn sources   : 235
gfParmSetStr: fopen (config/graph.xml, "wb") failed
sw 64 - sh 64 - vw 64 - vh 64 - imgsize 12288
Traceback (most recent call last):
  File "example_experiment.py", line 26, in <module>
    ob = env.reset(relaunch=True)
  File "/home/pavitrakumar/Desktop/gym_torcs-master/gym_torcs.py", line 192, in reset
    self.observation = self.make_observaton(obs)
  File "/home/pavitrakumar/Desktop/gym_torcs-master/gym_torcs.py", line 272, in make_observaton
    image_rgb = self.obs_vision_to_image_rgb(raw_obs[names[8]])
  File "/home/pavitrakumar/Desktop/gym_torcs-master/gym_torcs.py", line 242, in obs_vision_to_image_rgb
    return np.array([r, g, b], dtype=np.uint8)
TypeError: long() argument must be a string or a number, not 'NoneType'
pavitrakumar@pavitrakumar-PC:~/Desktop/gym_torcs-master$ Timeout for client answer
Timeout for client answer
Timeout for client answer
Timeout for client answer
Timeout for client answer
Timeout for client answer
Timeout for client answer
Timeout for client answer
Timeout for client answer
Timeout for client answer
Timeout for client answer
Timeout for client answer
Timeout for client answer
.
.
.

I am trying this on python 2.x with the necessary imports to make it work (print and division), but I am not sure where the requested file (graph.xml) is located.

Error while validating the trained model

I was trying to implement gym_torcs, have successfully completed the training for 397000 episodes. When i do the validation/ inference the car runs only for few seconds and restarts again.

May i know how exactly the validation looks like does it complete the full track after training?

vision input not working while ssh

Somehow I get a black screenshot every run. The window mode is correct 64. I am using torcs and its client from a remote source via ssh.

More data from Server ?

I looked into the TORCS manual, and get to know that you can export more sensor data through tCarElt, any idea how to achieve that? Many thanks!

How to uninstall vtorcs?

I want to change the source code of vtorcs and then reinstall it.
I don't know what if I reinstall it directly so firstly I need to uninstall vtorcs.
Any method is OK, thank you!

Could it be driven by hand?

Hi
I want to collect observation and action data generated by expert demonstration. So, How could I drive it manually?

Thanks very much!

How to display the car in the video screen?

Can I ask how to display the actual car in the video screen? Currently if I switch to different view mode it does not show the driving car, like below

torcs_nocar

Most TORCS example in the internet did show the car and the dashboard
torcs_with_car

Can I ask while file I need to amend to display the car?

Many thanks!

torcs restarting again and again

**gym_torcs git:(master)** ✗ python snakeoil3_gym.py
Waiting for server on 3101............
Count Down : 4
Waiting for server on 3101............
Count Down : 3
Waiting for server on 3101............
Count Down : 2
Waiting for server on 3101............
Count Down : 1
Waiting for server on 3101............
Count Down : 0
Waiting for server on 3101............
Count Down : -1
relaunch torcs
Visual Properties Report
------------------------
Compatibility mode, properties unknown.
WARNING: ssgLoadTexture: Cannot determine file type for './(null)'
Waiting for server on 3101............
Count Down : 4
Waiting for server on 3101............
Count Down : 3
Waiting for server on 3101............
Count Down : 2
Waiting for server on 3101............
Count Down : 1
Waiting for server on 3101............
Count Down : 0
Waiting for server on 3101............
Count Down : -1
relaunch torcs
Visual Properties Report
------------------------
Compatibility mode, properties unknown.
WARNING: ssgLoadTexture: Cannot determine file type for './(null)'

I find a question about track information that make me amazing today!

If you read the 19 tracks' information and print it when you are running the car on torcs, you can find the information is very amazing. When the car turn left or turn right in a large curve, if you see the printed 19 tracks' information carefully, you will find the track[1] or track [2] or track[17] or track[16] or the others larger than you expect sometimes.
I think the track return a larger value on the other side of the curve instead of closer to car.

How to improve the frames per second in gym_torcs.py

Hi,
I am working on the new projects in gym_torcs which requires faster frames per second. I found that in

ob, reward, done, _ = env.step(action)

which calls line 122-124 in gym_torcs.py

client.respond_to_server() 
# Get the response of TORCS 
client.get_servers_input() 

is very slow. the 2 lines above took 0.2 seconds (so 5 fps)

Do you know if there is anyway I can improve the fps?

Thanks,

Ben

Car/Camera view is freezed - It doesn't move - Timeout for client answer

Hi,

Thanks for your package.

I am trying to use it for RL and DNN but having problem with making it work. Basically my problem is that it kind of freezes. I tried to run the 'example_experiment.py' as well but the same thing happens, it runs TORCS environment and progresses until it starts the race but after that the car does't move or in another word camera view does now changes (it slowly, very slow, moves toward left but not forward). I am not sure where is the problem. I was trying to test it with python 2.x and 3.x and the following is the result:

--- with python2
amir-ai@Amir:~/gym_torcs$ python example_experiment.py

Fuel consumption disabled!
Car damages disabled!
Laptime limit disabled!
Image generation is ON!
Visual Properties Report

Compatibility mode, properties unknown.
TORCS Experiment Start.
Episode : 0
Waiting for server on 3101............
Count Down : 5
Waiting for server on 3101............
Count Down : 4
Waiting for server on 3101............
Count Down : 3
Waiting for server on 3101............
Count Down : 2
Waiting for server on 3101............
Count Down : 1
Waiting for server on 3101............
Count Down : 0
Waiting for server on 3101............
Count Down : -1
relaunch torcs

Fuel consumption disabled!
Car damages disabled!
Laptime limit disabled!
Image generation is ON!
Visual Properties Report

Compatibility mode, properties unknown.
Waiting for server on 3101............
Count Down : 4
Waiting for server on 3101............
Count Down : 3
Waiting for server on 3101............
Count Down : 2
Waiting for request on port 3101
Waiting for server on 3101............
Count Down : 1
Received from server: identified
Client connected on 3101..............
OpenAL backend info:
Vendor: OpenAL Community
Renderer: OpenAL Soft
Version: 1.1 ALSOFT 1.14
Available sources: 256
Available buffers: 1024 or more
Dynamic Sources: requested: 235, created: 235
#static sources: 21
#dyn sources : 235
gfParmSetStr: fopen (config/graph.xml, "wb") failed
sw 64 - sh 64 - vw 64 - vh 64 - imgsize 12288
Traceback (most recent call last):
File "example_experiment.py", line 24, in
ob = env.reset(relaunch=True)
File "/home/amir-ai/gym_torcs/gym_torcs.py", line 192, in reset
self.observation = self.make_observaton(obs)
File "/home/amir-ai/gym_torcs/gym_torcs.py", line 275, in make_observaton
image_rgb = self.obs_vision_to_image_rgb(raw_obs[names[8]])
File "/home/amir-ai/gym_torcs/gym_torcs.py", line 232, in obs_vision_to_image_rgb
r = image_vec[0:len(image_vec):3]
TypeError: object of type 'float' has no len()
amir-ai@Amir:~/gym_torcs$ Timeout for client answer
Timeout for client answer
Timeout for client answer
Timeout for client answer
Timeout for client answer
Timeout for client answer
Timeout for client answer
Timeout for client answer
Timeout for client answer
Timeout for client answer
Timeout for client answer
Timeout for client answer
Timeout for client answer
Timeout for client answer
AL lib: ReleaseALC: 1 device not closed
^C

--- with python3

amir-ai@Amir:~/gym_torcs$ python3 example_experiment.py
/usr/local/lib/python3.4/dist-packages/matplotlib/backends/backend_gtk3agg.py:18: UserWarning: The Gtk3Agg backend is known to not work on Python 3.x with pycairo. Try installing cairocffi.
"The Gtk3Agg backend is known to not work on Python 3.x with pycairo. "

Fuel consumption disabled!
Car damages disabled!
Laptime limit disabled!
Image generation is ON!
Visual Properties Report

Compatibility mode, properties unknown.
Waiting for request on port 3101
TORCS Experiment Start.
Episode : 0
Received from server: b'identified\x00'
Traceback (most recent call last):
File "example_experiment.py", line 24, in
ob = env.reset(relaunch=True)
File "/home/amir-ai/gym_torcs/gym_torcs.py", line 185, in reset
self.client = snakeoil3.Client(p=3101, vision=self.vision) # Open new UDP in vtorcs
File "/home/amir-ai/gym_torcs/snakeoil3_gym.py", line 143, in init
self.setup_connection()
File "/home/amir-ai/gym_torcs/snakeoil3_gym.py", line 191, in setup_connection
if identify in sockdata:
TypeError: 'str' does not support the buffer interface
OpenAL backend info:
Vendor: OpenAL Community
Renderer: OpenAL Soft
Version: 1.1 ALSOFT 1.14
Available sources: 256
Available buffers: 1024 or more
Dynamic Sources: requested: 235, created: 235
#static sources: 21
#dyn sources : 235
gfParmSetStr: fopen (config/graph.xml, "wb") failed
sw 64 - sh 64 - vw 64 - vh 64 - imgsize 12288
amir-ai@Amir-SASLAB:~/gym_torcs$ Timeout for client answer
Timeout for client answer
Timeout for client answer
Timeout for client answer
Timeout for client answer
Timeout for client answer
Timeout for client answer
Timeout for client answer
Timeout for client answer
Timeout for client answer
Timeout for client answer
Timeout for client answer
Timeout for client answer


Thanks,

How to get image observation as an RGB value array?

We are trying to get an observation output of the vision image for each step in order to write an A3C algorithm with tensorflow that will be able to learn from vision.

We have made sure that the resolution is set to 64 x 64 when trying to run the agent and that vision is set to True when calling the environment:
en=TorcsEnv(vision=True, )

We get back an observation dictionary that does not contain an ' img' key, thus we get a KeyError.

Design new tracks

Does anybody know how to design our own track (with possibly 5-6 lanes)?
Any hint would be appropriated :)

please merge the pull request for mul instance

enables running multiple torcs instances, each of which is controlled by different TorcsEnv instances. It would helpful if you run multiple experiments at the same time, or running parallel RL algorithms.

After this PR, if you want to run multiple torcs, just create TorcsEnv instances with different port values.

Add -title option to torcs so that its window title can be changed
Use xdotool instead of xte so that it can specify which window to control by its title
Chage TorcsEnv and Client accordingly
Remove auto-generated files (This is not related to the subject of the PR. If there's a problem, I'll omit this change.)

Running multiple gym_torcs experiments in parallel on the same machine

Hi,
I want to launch multiple gym_torcs environments on my machine so that I can run multiple simulations in parallel. Currently when I try to launch an extra simulation, the previous one crashes. The problem is likely the fact that the client and server always talk through the 3001 port. Is there a way to assign different ports to different instances of gym_torcs?
Thank you,
Anirban

Adding obstacles in map.

Hi~ I'm testing a RL work based on this project, and I wanna to add some obstacles to train the agent to avoid collisions. What should I do to add obstacles in the tracks? Also, is the collision available of these obstacles?

Thanks a lot!

Improve gym_torcs FPS

@ugo-nama-kun
Hello ugo-nama-kun,
Our team is currently using TorcsEnv to test behaviour cloning, and there there is an FPS discrepancy between user demonstration (60FPS) and TorcsEnv (< 10 FPS). May I ask how to modify your source codes, so that the TorcsEnv can provide a 60 FPS testing environment?

Cannot extract 64x64x3 image screen properly

Hi, I am running example_experiment.py and I try to plot the visual input in sample_agent.py. However, I didn't get the proper image. Attached is the screenshot. Can you please advise? Thanks

figure_1

The Game Console is running properly and I can see the car is running
torcs

Not able to make in vtorcs

In Ubunto 18, when I run ./configure everything goes smoothly. But when I command "make"
I am facing with the following error. Could you please help me?

make TORCS_BASE=/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color MAKE_DEFAULT=/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/Make-default.mk make[1]: Entering directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color' make[2]: Entering directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src' make[3]: Entering directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/interfaces' Exporting car.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/car.h Exporting graphic.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/graphic.h Exporting js.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/js.h Exporting playerpref.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/playerpref.h Exporting raceman.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/raceman.h Exporting replay.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/replay.h Exporting robot.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/robot.h Exporting simu.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/simu.h Exporting telemetry.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/telemetry.h Exporting track.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/track.h make[3]: Leaving directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/interfaces' make[3]: Entering directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/libs' make[4]: Entering directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/libs/txml' Exporting xml.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/xml.h Exporting xmlparse.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/xmlparse.h make[4]: Leaving directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/libs/txml' make[4]: Entering directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/libs/tgf' Exporting tgf.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/tgf.h Exporting os.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/os.h make[4]: Leaving directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/libs/tgf' make[4]: Entering directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/libs/tgfclient' Exporting tgfclient.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/tgfclient.h Exporting screen_properties.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/screen_properties.h Exporting glfeatures.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/glfeatures.h make[4]: Leaving directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/libs/tgfclient' make[4]: Entering directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/libs/client' Exporting client.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/client.h Exporting exitmenu.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/exitmenu.h make[4]: Leaving directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/libs/client' make[4]: Entering directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/libs/confscreens' Exporting confscreens.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/confscreens.h Exporting driverconfig.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/driverconfig.h Exporting joystickconfig.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/joystickconfig.h Exporting mouseconfig.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/mouseconfig.h Exporting controlconfig.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/controlconfig.h Exporting graphconfig.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/graphconfig.h Exporting simuconfig.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/simuconfig.h Exporting soundconfig.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/soundconfig.h Exporting openglconfig.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/openglconfig.h make[4]: Leaving directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/libs/confscreens' make[4]: Entering directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/libs/racescreens' Exporting racescreens.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/racescreens.h make[4]: Leaving directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/libs/racescreens' make[4]: Entering directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/libs/robottools' Exporting robottools.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/robottools.h make[4]: Leaving directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/libs/robottools' make[4]: Entering directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/libs/raceengineclient' Exporting singleplayer.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/singleplayer.h Exporting raceinit.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/raceinit.h make[4]: Leaving directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/libs/raceengineclient' make[4]: Entering directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/libs/learning' Exporting policy.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/learning/policy.h Exporting ann_policy.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/learning/ann_policy.h Exporting ANN.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/learning/ANN.h Exporting learn_debug.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/learning/learn_debug.h Exporting real.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/learning/real.h Exporting string_utils.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/learning/string_utils.h Exporting List.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/learning/List.h Exporting MathFunctions.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/learning/MathFunctions.h Exporting Distribution.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/learning/Distribution.h make[4]: Leaving directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/libs/learning' make[4]: Entering directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/libs/portability' Exporting portability.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/portability.h make[4]: Leaving directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/libs/portability' make[4]: Entering directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/libs/math' Exporting linalg_t.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/tmath/linalg_t.h Exporting v2_t.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/tmath/v2_t.h Exporting v3_t.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/tmath/v3_t.h Exporting v4_t.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/tmath/v4_t.h Exporting straight2_t.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/tmath/straight2_t.h make[4]: Leaving directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/libs/math' make[3]: Leaving directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/libs' make[3]: Entering directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/linux' Exporting osspec.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/osspec.h make[3]: Leaving directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/linux' make[3]: Entering directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/modules' make[4]: Entering directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/modules/simu' make[5]: Entering directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/modules/simu/simuv2' make[6]: Entering directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/modules/simu/simuv2/SOLID-2.0' make[7]: Entering directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/modules/simu/simuv2/SOLID-2.0/include' make[8]: Entering directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/modules/simu/simuv2/SOLID-2.0/include/3D' Exporting Basic.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/3D/Basic.h Exporting Matrix.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/3D/Matrix.h Exporting Point.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/3D/Point.h Exporting Quaternion.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/3D/Quaternion.h Exporting Tuple3.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/3D/Tuple3.h Exporting Tuple4.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/3D/Tuple4.h Exporting Vector.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/3D/Vector.h make[8]: Leaving directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/modules/simu/simuv2/SOLID-2.0/include/3D' make[8]: Entering directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/modules/simu/simuv2/SOLID-2.0/include/SOLID' Exporting solid.h to /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/export/include/SOLID/solid.h make[8]: Leaving directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/modules/simu/simuv2/SOLID-2.0/include/SOLID' make[7]: Leaving directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/modules/simu/simuv2/SOLID-2.0/include' make[6]: Leaving directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/modules/simu/simuv2/SOLID-2.0' make[5]: Leaving directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/modules/simu/simuv2' make[4]: Leaving directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/modules/simu' make[3]: Leaving directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/modules' make[2]: Leaving directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src' make[2]: Entering directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src' make[3]: Entering directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/libs' make[4]: Entering directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/libs/txml' make[5]: Entering directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/libs/txml/gennmtab' make[5]: Nothing to be done for 'tools'. make[5]: Leaving directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/libs/txml/gennmtab' make[4]: Leaving directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/libs/txml' make[3]: Leaving directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/libs' make[3]: Entering directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/tools' make[4]: Entering directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/tools/accc' make[4]: Nothing to be done for 'tools'. make[4]: Leaving directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/tools/accc' make[4]: Entering directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/tools/nfs2ac' make[4]: Nothing to be done for 'tools'. make[4]: Leaving directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/tools/nfs2ac' make[4]: Entering directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/tools/nfsperf' make[4]: Nothing to be done for 'tools'. make[4]: Leaving directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/tools/nfsperf' make[4]: Entering directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/tools/package' make[4]: Nothing to be done for 'tools'. make[4]: Leaving directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/tools/package' make[4]: Entering directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/tools/texmapper' make[4]: Nothing to be done for 'tools'. make[4]: Leaving directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/tools/texmapper' make[4]: Entering directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/tools/trackgen' make[4]: Nothing to be done for 'tools'. make[4]: Leaving directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/tools/trackgen' make[3]: Leaving directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/tools' make[3]: Entering directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/linux' make[3]: Nothing to be done for 'tools'. make[3]: Leaving directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/linux' make[2]: Leaving directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src' make[2]: Entering directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src' make[3]: Entering directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/libs' make[4]: Entering directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/libs/confscreens' make[4]: *** No rule to make target '/home/abaheri/Desktop/gym_torcs-master/gym_torcs-master/vtorcs-RL-color/export/include/tgfclient.h', needed by 'controlconfig.o'. Stop. make[4]: Leaving directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/libs/confscreens' /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/Make-default.mk:679: recipe for target 'subdirs' failed make[3]: *** [subdirs] Error 1 make[3]: Leaving directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src/libs' /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/Make-default.mk:679: recipe for target 'subdirs' failed make[2]: *** [subdirs] Error 1 make[2]: Leaving directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/src' /home/abaheri/Desktop/gym_torcs/vtorcs-RL-color/Make-default.mk:679: recipe for target 'subdirs' failed make[1]: *** [subdirs] Error 1 make[1]: Leaving directory '/home/abaheri/Desktop/gym_torcs/vtorcs-RL-color' Makefile:30: recipe for target 'restart' failed make: *** [restart] Error 2``

Running with vision occasionally got freeze

Hi, I am trying to run your code with vision input by setting . I have set the resolution to 64x64, but the screen sometimes got freeze and stuck for about a few second before the program recover back to normal vision output. Do you have any ideas about how to solve it? BTW without vision it works perfectly fine :)

Thanks in advance.

can't import TorcsEnv

thanks very much for your work!I want to use it but I meet a problem.I can import gym_torcs,but can't import TorcsEnv.

Python 3.5.2 |Anaconda custom (64-bit)| (default, Jul 2 2016, 17:53:06)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.

import gym_torcs
from gym_torcs import TorcsEnv
Traceback (most recent call last):
File "", line 1, in
ImportError: cannot import name 'TorcsEnv'

could you help me ?

how to compile plip for ubuntu 64?

It says in the installation guid of vtorcs-color:
Requires plib 1.8.5, FreeGLUT or GLUT, be aware to compile plib with -fPIC on AMD64 if you run a 64 bit version of Linux. Be aware that maybe just 1.8.5 works.
I'm still new to this kind of stuff, so could you please tell how to do that?

About image size that an agent can get.

I am implementing RL algorithms using gym_torcs.
Would you tell me how to extract larger images (e.g. 200×200×3) than default images 64×64×3 ?
I changed line 7 and 8 in gym_torcs/vtorcs-RL-color/exp-settings/config/screen.xml as follows,

    <attnum name="x" val="200"/>
    <attnum name="y" val="200"/>

but it doesn't work well. (output image is 64×64×3).

error running snakeoil3_gym.py

Encountered error running this file. Error message below:

File "snakeoil3_gym.py", line 246
if 'identified' in sockdata:
^
IndentationError: expected an indented block

Server state is getting another car's info in case of Quick Race.

Hi,

When i run snakeoil3_gym.py in Practice mode, it gets server state properly. (e.g. speedX, angle, tracPos).
But when i run snakeoil3_gym.py in Quick Race mode, it gets another car's server state.

For example, if i select two cars (scr_server 1 and tita 3) in 'Selected' list in Quick Race configuration, then snakeoil3_gym.py gets speedX, tracPos of tita not of scr_server.

Do you have any idea of this problem?
Thank you.

Unable to build Vtorcs

Hi, I'm getting this following build error when I'm trying to make vtorcs-

simu.cpp: In function ‘void ctrlCheck(tCar*)’:
simu.cpp:64:9: error: non-floating-point argument in call to function ‘__builtin_isnan’
if (isnan(car->ctrl->gear) || isinf(car->ctrl->gear)) car->ctrl->gear = 0;
^
simu.cpp:64:35: error: non-floating-point argument in call to function ‘__builtin_isinf_sign’
if (isnan(car->ctrl->gear) || isinf(car->ctrl->gear)) car->ctrl->gear = 0;

Is there a fix for this?

Error when running Torcs in vision mode

Hi,

When i run the default code and follow the instructions, I get the following error:

sahil@CoolToad:/gym_torcs$ python example_experiment.py 
pkill: killing pid 20651 failed: Operation not permitted
pkill: killing pid 20668 failed: Operation not permitted

Fuel consumption disabled!
Car damages disabled!
Laptime limit disabled!
Image generation is ON!
Visual Properties Report
------------------------
Compatibility mode, properties unknown.
TORCS Experiment Start.
Episode : 0
Client connected on 3101..............
cannot bind socketTraceback (most recent call last):
  File "example_experiment.py", line 24, in <module>
    ob = env.reset(relaunch=True)
  File "/gym_torcs/gym_torcs.py", line 190, in reset
    self.observation = self.make_observaton(obs)
  File "/gym_torcs/gym_torcs.py", line 267, in make_observaton
    image_rgb = self.obs_vision_to_image_rgb(raw_obs[names[8]])
KeyError: 'img'

Any idea why this happens?

Cannot run in API mode

Runnning vtorcs by supplying a default config file

torcs -r <Path-to-config.xml>

doesn't seem to work. Any ideas?

Not rendering video while training.

Hi,
I was trying to train Deep Deterministic policy on Torcs environment.
Is there a way to stop video rendering during the training. Just like openAI gym has
env.render()
to explicitly render when called and otherwise not.

Thanks,
Apoorv

can I just use "pip install torcs"?

I failed to install libglu1-mesa-dev,so I just use "pip install torcs". But it seems that many problem occur.
When I run snakeoil3_gym.py in https://github.com/yanpanlau/DDPG-Keras-Torcs , it look like this and always relauch.
/usr/bin/python2.7 /home/hanzy/software/gym_torcs-master/snakeoil3_gym.py
Waiting for server on 3101............
Count Down : 5
Waiting for server on 3101............
Count Down : 4
Waiting for server on 3101............
Count Down : 3
Waiting for server on 3101............
Count Down : 2
Waiting for server on 3101............
Count Down : 1
Waiting for server on 3101............
Count Down : 0
Waiting for server on 3101............
Count Down : -1
relaunch torcs
Waiting for server on 3101............
Count Down : 4
Waiting for server on 3101............
Count Down : 3
Waiting for server on 3101............
Count Down : 2
Waiting for server on 3101............
Count Down : 1
Waiting for server on 3101............
Count Down : 0
Waiting for server on 3101............
Count Down : -1
relaunch torcs
Waiting for server on 3101............

When I run ddpg.py in https://github.com/yanpanlau/DDPG-Keras-Torcs , an error below happen.
/usr/bin/python2.7 /home/hanzy/software/gym_torcs-master/ddpg.py
Using TensorFlow backend.
Traceback (most recent call last):
File "/home/hanzy/software/gym_torcs-master/ddpg.py", line 10, in
from keras.engine.training import collect_trainable_weights
ImportError: cannot import name collect_trainable_weights

Process finished with exit code 1

WHY!!!

How can you ensure that your step reward is the true reward after the action?

I read your source codes and feel confused with your TorcsEnv.step function.
From line 121 to 124,
# Apply the Agent's action into torcs
client.respond_to_server()
# Get the response of TORCS
client.get_servers_input()
You send the action to the Torcs server first and then get the observations from the torcs instantly, which is used to calculate the reward. However, are you sure the server will respond to the actions before you run "client.get_servers_input()"?

How to add sensor noise?

I want to use noisy sensors to train my Deep-RL car, and I try the command $ sudo torcs -noisy as said in torcs manual, but it doesn't work.
screenshot 2016-11-16 10 45 43

Do you have any ideas? Thank you!

Are low-dimensional state observations different between with vision and without vision?

I want to train an agent using DDPG with low-dim input and use it as a teacher to train a imitation learning agent. However, after training DDPG, when I set vision=True, I found DDPG can not perform well. But I set vision=False back, DDPG can drive without any issue.

My question is: are the scales or measurements of the low-dim state different between vision=True and vision=False.

installation error

Hi,
I followed the installation steps.
Unfortunately after I finished to install gym_torcs, I got the following errror for typing "torcs" in command.
would you please help me to solve this problem?

Visual Properties Report

Compatibility mode, properties unknown.
freeglut (/usr/local/lib/torcs/torcs-bin): ERROR: Internal error in function fgOpenWindow

Changing the race track from code

I understand that it's possible to change the race track from the GUI of TORCS and then command the car from python. Is it possible to select the race track form python itself?

This can be useful if you want to run a single script to evaluate your model on a bunch different racetracks.

Thanks,
Avi

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.