Skip to content

My attempt at building an autonomous vehicle, during my motorsport days. Built for TORCS, using game data for navigation.

Notifications You must be signed in to change notification settings

VictorySpecificationII/maria-virtual-autonomous-vehicle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 

Repository files navigation

maria-virtual-autonomous-vehicle

An implementation of an autonomous racing car using game data for navigation. An early attempt at creating some form of Artificial Intelligence.

Maria AI

The driver is capable of:

  • Autonomous driving with trajectory planning
  • Adaptive acceleration and braking
  • Gear and steering control
  • ABS and traction control
  • Collision avoidance
  • Pit stop management
  • Opponent tracking and overtaking strategy

Created and tested with:

  • TORCS v.1.3.7 running on Ubuntu 16.04.
  • TORCS v.1.3.7 running on Ubuntu 24.04.

Deployment Notes - TORCS

Install Torcs 1.3.7 AIO

sudo apt update
sudo apt-get install valgrind
sudo apt install build-essential g++ \
libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev \
zlib1g-dev libopenal-dev libalut-dev libvorbis-dev \
libxi-dev libxmu-dev libxrender-dev libxrandr-dev \
libpng-dev
wget https://deac-fra.dl.sourceforge.net/project/torcs/all-in-one/1.3.7/torcs-1.3.7.tar.bz2
tar -xvf torcs-1.3.7.tar.bz2
sudo mv torcs-1.3.7 /usr/local/src/torcs-1.3.7

Add to bashrc the following:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
export TORCS_BASE=/usr/local/src/torcs-1.3.7
export MAKE_DEFAULT=$TORCS_BASE/Make-default.mk

Then run:

source ~/.bashrc

After this, run:

sudo chown -R $(whoami) /usr/local/src/torcs-1.3.7
cd /usr/local/src/torcs-1.3.7
./configure --enable-debug

With TORCS 1.3.7 AIO, you are going to hit errors on building:

The first one will be when running the make command. I encountered the following error:

"/usr/local/src/torcs-1.3.7/src/libs/musicplayer/OpenALMusicPlayer.cpp" 271 line
OpenALMusicPlayer.cpp:164:29: error: invalid conversion from ‘char’ to ‘const char*’ [-fpermissive]

To solve it, open the file /usr/local/src/torcs-1.3.7/src/libs/musicplayer/OpenALMusicPlayer.cpp, go to line 271 and make the following change from:

    const char* error = '\0';  

to (changing single quote to double quotes)

	const char* error = "\0";

The second bug appeared when running make install. The following error showed up:

	src/drivers/olethros/geometry.cpp
	isnan not define. line 396

To solve it, open the file /usr/local/src/torcs-1.3.7/src/drivers/olethros/geometry.cpp. Go to line 396 and change it from:

    if (isnan(r)) {

to

    if (std::isnan(r)) {  

After this, you can proceed with the installation by running:

sudo make
sudo make install
sudo make datainstall

You can then launch TORCS (the -g argument is for debug mode, that's what valgrind is installed for in the beginning).

torcs -g

Add the Maria AI Driver to TORCS

From the maria-virtual-autonomous-vehicle repository, run:

sudo cp -r Maria/ $TORCS_BASE/src/drivers
cd $TORCS_BASE/src/drivers/Maria
sudo chown -R $(whoami):$(whoami) $TORCS_BASE/src/drivers/Maria
sudo rm -f $TORCS_BASE/src/drivers/Maria/*.o

Now run:

cd $TORCS_BASE
sudo make clean
sudo make
sudo make install

Extras

Add new driver to TORCS

You can replace melissa and universe with your own values.

The former is the name of the robot, and the latter is the author.

cd $TORCS_BASE
./robotgen -n "melissa" -a "universe" -c "acura-nsx-sz"
cd $TORCS_BASE
sudo make clean
sudo make
sudo make install

Uninstall Torcs 1.3.7 AIO

To uninstall, run the following:

sudo rm -f /usr/local/bin/torcs
sudo rm -rf /usr/local/src/torcs-1.3.7
sudo rm -rf /usr/local/share/games/torcs
sudo rm -rf /usr/local/share/torcs
sudo rm -rf /usr/local/lib/torcs/
sudo rm -rf ~/.torcs
hash -r

The following command:

which torcs

Should return nothing.

About

My attempt at building an autonomous vehicle, during my motorsport days. Built for TORCS, using game data for navigation.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published