speed-dreams/doc/tutorials/robot/torcs/robot/ch5/creating.html

202 lines
6.7 KiB
HTML

<!DOCTYPE public "-//w3c//dtd html 4.01 transitional//en"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<!--
copyright : (C) 2003-2004 Bernhard Wymann
email : berniw@bluewin.ch
version : $Id$
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
Texts. A copy of the license is included in the section entitled "GNU
Free Documentation License".
-->
<head>
<title>creating the directory structure</title>
<link rel="stylesheet" type="text/css" href="../../../css/format.css"/>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"/>
<meta name="description" content="straight class"/>
<meta name="author" content="Bernhard Wymann"/>
<meta name="keywords" content="torcs, berniw, bernhard wymann, car, setup, create, directory"/>
<script src="../../../js/utilities.js" type="text/javascript"></script>
</head>
<body bgcolor="#ffffff">
<table class="maincontent">
<tr>
<td class="maincontent">
<h1>5.3 Creating the Directory Structure</h1>
<h3>Introduction</h3>
<p>
In this section we will create the directory structure and the Makefiles
for the cg-nascar-rwd (the car with index <span style="color:green;">0</span>).
For the other cars it works the same way. We need Makefiles just to ease
the deployment, we could also copy the setup files manually to the torcs directory.
</p>
<h3>Creating the Directories</h3>
<p>
Make sure you are in the <span style="color:red;">bt</span> source directory:
</p>
<p>
<tt>
$ cd $TORCS_BASE/src/drivers/<span style="color:red;">bt</span><br/>
</tt>
</p>
<p>
Now we create the subdirectories for the setups:
</p>
<p>
<tt>
$ mkdir -p <span style="color:green;">0</span>/practice<br/>
$ mkdir <span style="color:green;">0</span>/qualifying</br/>
$ mkdir <span style="color:green;">0</span>/race<br/>
</tt>
</p>
<p>
For another car replace <span style="color:green;">0</span> with its index and do it
the same way.
</p>
<h3>The Makefiles</h3>
<p>
First we change the main Makefile of <span style="color:red;">bt</span> to process
the subdirectory <span style="color:green;">0</span>. Change the line
</p>
<p>
<pre class="lbcolor">SHIPSUBDIRS =</pre>
</p>
<p>
to
</p>
<p>
<pre class="lcolor">SHIPSUBDIRS = <span style="color:green;">0</span></pre>
</p>
<p>
When you want to add more subdirectories append them to this line, e. g. "0 1". Now
create the Makefile in directory <span style="color:green;">0</span> with the
following content:
</p>
<p>
<pre class="lcolor">ROBOT = <span style="color:red;">bt</span>
SHIPDIR = drivers/${ROBOT}/<span style="color:green;">0</span>
SHIP = default.xml
SHIPSUBDIRS = practice qualifying race
PKGSUBDIRS = ${SHIPSUBDIRS}
src-robots-bt_PKGFILES = $(shell find * -maxdepth 0 -type f -print)
src-robots-bt_PKGDIR = ${PACKAGE}-${VERSION}/$(subst ${TORCS_BASE},,$(shell pwd))
include ${MAKE_DEFAULT}</pre>
</p>
<p>
Like you can see it deploys the file default.xml and the subdirectories practice,
qualifying and race. In this subdirectories we need also Makefiles to deploy
the setup files. Here is the Makefile for the
<span style="color:green;">0</span>/practice directory.
</p>
<p>
<pre class="lcolor">ROBOT = <span style="color:red;">bt</span>
SHIPDIR = drivers/${ROBOT}/<span style="color:green;">0</span>/practice
SHIP = $(shell find *.xml -maxdepth 0 -type f -print)
src-robots-bt_PKGFILES = $(shell find * -maxdepth 0 -type f -print)
src-robots-bt_PKGDIR = ${PACKAGE}-${VERSION}/$(subst ${TORCS_BASE},,$(shell pwd))
include ${MAKE_DEFAULT}</pre>
</p>
<p>
Here the Makefile for the <span style="color:green;">0</span>/qualifying directory.
</p>
<p>
<pre class="lcolor">ROBOT = <span style="color:red;">bt</span>
SHIPDIR = drivers/${ROBOT}/<span style="color:green;">0</span>/qualifying
SHIP = $(shell find *.xml -maxdepth 0 -type f -print)
src-robots-bt_PKGFILES = $(shell find * -maxdepth 0 -type f -print)
src-robots-bt_PKGDIR = ${PACKAGE}-${VERSION}/$(subst ${TORCS_BASE},,$(shell pwd))
include ${MAKE_DEFAULT}</pre>
</p>
<p>
And finally the Makefile for the <span style="color:green;">0</span>/race directory.
</p>
<p>
<pre class="lcolor">ROBOT = <span style="color:red;">bt</span>
SHIPDIR = drivers/${ROBOT}/<span style="color:green;">0</span>/race
SHIP = $(shell find *.xml -maxdepth 0 -type f -print)
src-robots-bt_PKGFILES = $(shell find * -maxdepth 0 -type f -print)
src-robots-bt_PKGDIR = ${PACKAGE}-${VERSION}/$(subst ${TORCS_BASE},,$(shell pwd))
include ${MAKE_DEFAULT}</pre>
</p>
<p>
Before the Makefiles work there has to be at least one XML file in every directory.
Put <a href="../download/default.xml">this</a> stripped down default setup of cg-nascar-rwd into the file
<span style="color:green;">0</span>/default.xml. Copy it also to the following locations:
</p>
<p>
<tt>
$ cp <span style="color:green;">0</span>/default.xml <span style="color:green;">0</span>/practice/g-track-3.xml</br>
$ cp <span style="color:green;">0</span>/default.xml <span style="color:green;">0</span>/qualifying/g-track-3.xml</br>
$ cp <span style="color:green;">0</span>/default.xml <span style="color:green;">0</span>/race/g-track-3.xml</br>
</tt>
</p>
<p>
This should be enough for a litte test run. Do a "make install", check if it works
without errors and look up in the target directory if everything is in place. In the
next sections we will work with these files.
</p>
<h3>Downloads</h3>
<p>
In case you got lost, you can <a href="../download/bt53.tar.gz">download</a> my robot for TORCS 1.2.0 or later.
</p>
<h3>Summary</h3>
<ul style="list-style-type:disk; color:black;">
<li>You know the directory structure.</li>
<li>You have created all files.</li>
<li>You have checked if the installation works.</li>
</ul>
<br/>
</td>
</tr>
</table>
<table class="navigation_foot">
<tr>
<td class="navigation_foot">
<a href="./loading.html">
<p style="text-align:left;">Back</p>
</a>
</td>
<td class="navigation_foot">
<a href="./properties.html">
<p style="text-align:right;">Car properties.</p>
</a>
</td>
</tr>
</table>
</body>
</html>