The directory contains a Vagrantfile
which is the build script, and a package.box
which is the virtual machine image. Vagrant combines these to create and launch an up-to-date virtual machine and launches it in Virtual Box.
- Make sure you install the required software above
- Clone the repo:
git clone https://github.com/UWEcoCAR/UW-Infotainment.git
- Download the
package.box
(large file) here. Save it in this repo. - You may also want the torcs source code here
cd
to this repo- Install the box:
vagrant box add simulator package.box
- Run
vagrant up
(this will install the latest packages for the dev environment). Vagrant will now start Virtual Box, SSH in and automatically install packages. Hopefully everything updates installs correctly. - The
package.box
file can now be deleted - The VM is permanently in the Virtual Box's default directory
- Run
vagrant up
in the repo directory to open the vm vagrant reload
can reload a running vm- the
--provision
argument will rerun the install scripts in the above commands - To stop the vm run
vagrant halt
- to ssh into vm from your os type
vagrant ssh
- Update Vm:
git pull
this repo for the latestVagrantfile
- Run
vagrant up --provision
in theVagrantfile
directory
- Uninstall Vm:
vagrant destroy
in theVM/
directory. You will loose you virtual machine, but can reinstall fresh.
- Torcs torcs-1.3.6 source code
- Hardware accelerated OpenGL (usually provided by your Linux distribution)
- GLUT 3.7 or FreeGlut (better than GLUT for full screen support)
- PLIB 1.8.5 version
- OpenAL
- libpng and zlib (usually provided by your Linux distribution)
- FreeALUT
cd
into thetorcs-1.3.6
- Configure with by running
./configure
- make with
sudo make
- install with
sudo make install
- add extras with
sudo make datainstall
- Simply type
torcs
in a command window - Note, there are command line options to set default settings
- Note that due to my print tweak explained below, in game info is printed to the console
In torcs-1.3.6/src
you can tweak the game. Below is a list of files that may be of interest
-
In
/drivers
you can edit the different bots. Thehuman
driver is useful for changing behavior when a human is playing (using arrow keys)-
I have added a
printf
line inhuman.cpp
so that parameters such as speed, rpm, gear and fuel are printed -
this is the print statement I added :
printf("Speed : %0.2f \tYaw : %0.2f\tRPM : %0.2f\tGear : %d\tFuel : %0.2f\n", 3.6*car->_speed_x,yaw_rel, car->_enginerpm, car->_gear, car->_fuel);
-
-
In
/interfaces/car.h
you can see what a car class is made up of. It has things such ascar->_enginerpm
which will tell you the RPM of the of the car.
The server allows you to make custom bots to autonomously drive a level. We have a python wrapper for this server that defines simple driver and car control classes to tweak the bots
The server is already included in torcs in this repo, but it can be installed or uninstalled with the patch in the torcs-1.3.6/scr-patch
directory.
- source code is in
/python_svr
- Run the server by typing
python pyclient.py
in the/python_svr
directory - The server will wait for a race to start
- the race must have
scr_server_1
as a player for the default pyclient to work - Once the race starts, the
scr_server_1
should drive on its own
Notes:
- Essentially the
driver.py
will steer to stay in the middle of the road, and increase speed until themax_speed
limit is reached. Once it is reached, the bot will oscillate around this speed. - The steering algorithm is
steer = (angle - dist)/self.steer_lock
where angle is the cars angle, dist is distance from ideal path and steer_lock is a constant to prevent over steering. - The gear shift algorithm is also in the
driver.py
- Start the python server client by typing
python pyclient.py
in the/python_svr
directory - Start the game with
torcs
- In torcs, start a race and make sure
scr_server_1
is a player - The python server should connect and in game information should be printed to console