The TORCS Racing Board
Username: Password: Remember Me?
Lost Password Register
Author: joe | Created: 2017-03-11 22:25:14
Subject: Thuroughly confused about TORCs setup
I am completely stumped on installing TORCS in order to make a robot. The tutorial seems to be only valid for 1.2.4. The only part I got working were the dependencies (the current ones).

It is not clear to me how to install the current 1.3.8 test version or where the current robotgen files are. I am also not sure how to use CVS properly. I followed the commands on the downloads/installation page but am not sure how to set up environment variables etc when using CVS. Or do you have to build from tarballs in order to be able to set up robotgen?

Last question (for now) is how to update TORCs after install without messing up the robotgen setup? for patches or future versions.

Your help is appreciated.
Last Edited: 2017-03-11 22:25:14 by joe
    Author: firechief | Created: 2017-03-12 02:25:16
    Subject: Re: Thuroughly confused about TORCs setup
    I could help if you were developing under Windows, but if you're on linux I'm not sure what the procedure is. My best suggestion is to follow the instructions in the INSTALL file, but failing that I'm sure there's plenty of other people here who could help.

    Btw I've never once used robotgen, I've just taken an existing robot as a base, made a copy & renamed it.
    Last Edited: 2017-03-12 02:25:16 by firechief
    Author: dummy | Created: 2017-03-12 09:37:59
    Subject: Re: Thuroughly confused about TORCs setup
    For a Debian based distro this should work. I don't use CVS or robotgen, have no idea about those, but the existing robots should work after this:

    I extracted the torcs-1.3.8-test1.tar.bz2 under /home/daniel/torcs.
    So the source code is in "/home/daniel/torcs/torcs-1.3.8-test1".

    Install TORCS:
    # apt-get build-dep torcs
    $ ./configure --prefix="/home/daniel/torcs" --enable-debug
    $ make
    $ make install
    $ make datainstall

    Run TORCS:
    $ ~/torcs/bin/torcs -d

    Add to .bashrc for building robots:
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/daniel/torcs/lib
    export TORCS_BASE=/home/daniel/torcs/torcs-1.3.8-test1
    export MAKE_DEFAULT=$TORCS_BASE/Make-default.mk

    Danny
    Last Edited: 2017-03-12 09:37:59 by dummy
      Author: scheurneus | Created: 2017-03-12 13:50:00
      Subject: Re: Thuroughly confused about TORCs setup
      FYI, in this setup robotgen should work fine. I don't know about CVS though.
      Last Edited: 2017-03-12 13:50:00 by scheurneus
    Author: joe | Created: 2017-03-12 23:29:45
    Subject: Re: Thuroughly confused about TORCs setup
    Thanks all, got it working. I followed the tutorial but there is a different tar command to extract the .tar.bz2 files "tar xfvj ..." as opposed to the .tgz files in the tutorial. Mostly my problem is not knowing when somthing is required or not. For example, before this I didnt know robotgen was optional. I think I am prepared to start actually coding now. So watch out! (for errant robots with worn tires)
    Last Edited: 2017-03-12 23:29:45 by joe
    Author: jspenn | Created: 2017-03-13 09:36:31
    Subject: Re: Thuroughly confused about TORCs setup
    This might be a good time to say that Axiom crashes TORCS, and I don't know why.
    Last Edited: 2017-03-13 09:36:31 by jspenn
      Author: dummy | Created: 2017-03-13 09:45:09
      Subject: Re: Thuroughly confused about TORCs setup
      Just downloaded the last version of Axiom and it works on my box.
      Last Edited: 2017-03-13 09:45:09 by dummy
        Author: jspenn | Created: 2017-03-13 11:27:46
        Subject: Re: Thuroughly confused about TORCs setup
        Hmm, weird. When I get home, I shall check again. What do you run?
        Last Edited: 2017-03-13 15:28:33 by jspenn
          Author: dummy | Created: 2017-03-13 12:33:23
          Subject: Re: Thuroughly confused about TORCs setup
          Debian 8 Jessie
          Last Edited: 2017-03-13 12:33:23 by dummy
            Author: jspenn | Created: 2017-03-13 13:05:04
            Subject: Re: Thuroughly confused about TORCs setup
            Same here.
            Last Edited: 2017-03-13 13:05:04 by jspenn
      Author: firechief | Created: 2017-03-13 13:31:35
      Subject: Re: Thuroughly confused about TORCs setup
      I think I know the problem. Open MyRobot.cpp and search for "lets read/merge the car parms". The code following that comment will look for setup files, and then after that, following a comment which reads "get the private parameters now" it uses a file handle to start to read values - except if no XML files were found the handle will be null, and the first GfParmGetNum call will segfault.

      Besides putting some error checking in there to stop the crash happening, the solution is to create XML files. You'll note from the code that is looking for <robotname>/cars/<carname>/<carname>.xml - for example, if your robot is called "quickbot" and the car is "car1-trb1", it'll try to load torcs-1.3.8/runtime/drivers/quickbot/cars/car1-trb1/car1-trb1.xml - this is the default setup for all tracks, so its a good idea to create it. You can just copy the XML for the car you're running, and add a section called "<sieger private>" which can contain instructions for how quickly the robot should try to drive. Do that, and the crashing should go away.

      Next its trying to load a track-specific XML. eg. runtime/drivers/quickbot/cars/car1-trb1/track-alpine-1.xml - this will override whatever was in the default xml file. And lastly it will try to load an XML for specific types of event, whether practice, qualifying or race, and this will override the other two. If either of these files is missing it'll just run with the default setup.

      Last Edited: 2017-03-13 13:31:35 by firechief
        Author: firechief | Created: 2017-03-13 13:56:11
        Subject: Re: Thuroughly confused about TORCs setup
        Here's the current default XML from axiom. It should be enough to get it running ok on most tracks, though it certainly won't be fast - you need to create your own race-specific setups for that ;)

        < setup removed - it wasn't needed and was cluttering up this thread >
        Last Edited: 2017-03-21 01:06:51 by firechief
        Author: jspenn | Created: 2017-03-13 19:23:44
        Subject: Re: Thuroughly confused about TORCs setup
        Hmm. I have the XML, but when I run the race through a terminal (my favourite troubleshooting device), I get the following:
        new Override[0] for mu scale, start=100 end=150 value=1.280
        new Override[1] for mu scale, start=170 end=360 value=1.150
        new Override[2] for mu scale, start=361 end=500 value=1.140
        new Override[3] for mu scale, start=730 end=760 value=1.020
        new Override[4] for mu scale, start=840 end=899 value=1.500
        new Override[5] for mu scale, start=900 end=927 value=1.030
        new Override[6] for mu scale, start=1220 end=1285 value=1.060
        new Override[7] for mu scale, start=1286 end=1330 value=1.200
        new Override[0] for kz scale, start=1200 end=1340 value=0.110
        new Override[0] for right margin, start=0 end=1320 value=-0.450
        new Override[1] for right margin, start=1360 end=6000 value=-0.400
        new Override[0] for left margin, start=270 end=400 value=0.000
        new Override[1] for left margin, start=350 end=380 value=0.000
        new Override[2] for left margin, start=470 end=520 value=0.300
        new Override[3] for left margin, start=1655 end=1700 value=0.300
        new Override[4] for left margin, start=0 end=6000 value=-0.350
        GfParmCheckHandle: parameter "Car/initial fuel" out of bounds: min:1 max:87 val:100 in ("(null)" - "")
        /usr/local/bin/torcs: line 53: 2182 Segmentation fault $LIBDIR/torcs-bin -l $LOCAL_CONF -L $LIBDIR -D $DATADIR $*

        Hope you can make sense of this,
        Jacob
        Last Edited: 2017-03-13 19:23:44 by jspenn
          Author: dummy | Created: 2017-03-13 19:55:43
          Subject: Re: Thuroughly confused about TORCs setup
          Hi Jacob,

          I see you installed TORCS in the /usr/local/ directory, which is the default. I strongly believe it's better to install in your home directory like I did above with the ./configure --prefix="/home/daniel/torcs" command. This way you don't have to be root to install the robots.

          Danny
          Last Edited: 2017-03-13 19:58:45 by dummy
            Author: jspenn | Created: 2017-03-13 20:10:19
            Subject: Re: Thuroughly confused about TORCs setup
            Ah, I see that you have not taken in to account the fact that I changed the permissions to make it easier.
            Last Edited: 2017-03-13 20:13:59 by jspenn
            Author: joe | Created: 2017-03-13 21:17:28
            Subject: Re: Thuroughly confused about TORCs setup
            Is this for the sake of convenience or for security when running foreign code?
            Last Edited: 2017-03-13 21:17:28 by joe
              Author: dummy | Created: 2017-03-14 06:50:14
              Subject: Re: Thuroughly confused about TORCs setup
              For me it's more about convenience. But if you're worried about security, you should read section '10.5. TORCS Installation Recommendation' in the championship rules ;)
              Last Edited: 2017-03-14 06:50:14 by dummy
          Author: firechief | Created: 2017-03-13 22:34:13
          Subject: Re: Thuroughly confused about TORCs setup
          Ah ok, so you have an XML - and at a glance I can see it has track-specific overrides. I'm not sure which track you're running it on, but if that's an XML from last year then it won't work now, as we're in pro mode & those were written for semi-pro. That won't cause TORCS to crash though, it'll only make the car itself crash ;)

          To track down the cause of your crashing, try running it in gdb.
          Last Edited: 2017-03-13 22:34:13 by firechief
            Author: jspenn | Created: 2017-03-14 09:36:36
            Subject: Re: Thuroughly confused about TORCs setup
            what's gdb?
            Last Edited: 2017-03-14 09:36:36 by jspenn
              Author: dummy | Created: 2017-03-14 09:58:54
              Subject: Re: Thuroughly confused about TORCs setup
              If you install TORCS with 'configure --enable-debug' like I did above and run torcs with -d option, you will automatically run under gdb (the debugger). In case of a crash you will get the backtrace in the console where you see the part of the code that crashed.
              Last Edited: 2017-03-14 09:58:54 by dummy
                Author: jspenn | Created: 2017-03-17 20:22:52
                Subject: Re: Thuroughly confused about TORCs setup
                I ran with -d, no change.
                Last Edited: 2017-03-17 20:22:52 by jspenn
                  Author: jspenn | Created: 2017-03-17 20:29:21
                  Subject: Re: Thuroughly confused about TORCs setup
                  Also DanDroid crashes it - here's what the terminal says:
                  GfParmCheckHandle: parameter "Rear Differential/type" value:"FREE" not allowed in ("" - "drivers/dandroid/car3-trb1/default.xml")
                  /usr/local/bin/torcs: line 53: 3462 Segmentation fault $LIBDIR/torcs-bin -l $LOCAL_CONF -L $LIBDIR -D $DATADIR $*
                  Last Edited: 2017-03-17 20:29:21 by jspenn
                    Author: dummy | Created: 2017-03-18 12:47:50
                    Subject: Re: Thuroughly confused about TORCs setup
                    I get the same "FREE" not allowed in my installation. That's not the reason for the crash.

                    Could you install TORCS in your home dir? Just for you to have the same installation procedure as I have. Otherwise it's harder to solve your problem.

                    Danny
                    Last Edited: 2017-03-18 12:47:50 by dummy
                      Author: jspenn | Created: 2017-03-18 16:10:40
                      Subject: Re: Thuroughly confused about TORCs setup
                      Ok. Since i haven't had the time to compile 1.3.8, i think I'll do it there.
                      Last Edited: 2017-03-18 16:10:40 by jspenn
                        Author: jspenn | Created: 2017-03-19 22:32:10
                        Subject: Re: Thuroughly confused about TORCs setup
                        Just done 1.3.8 from the source package (.tar.bz2, if that helps), Axiom works. However, the file "setup_linux.sh" did not exist, and I had to copy it over from 1.3.7, and it works ok.

                        EDIT: DanDroid works as well.
                        EDIT2: Everything's fine, well done andrew on hidden valley!
                        Last Edited: 2017-03-21 11:34:28 by jspenn
                          Author: jspenn | Created: 2017-03-24 18:58:15
                          Subject: Re: Thuroughly confused about TORCs setup
                          Oh hell, I've just done "make" on berniw_2004, and this happens:
                          g++ -I/home/daviddeb/torcs/torcs-1.3.7/export/include -I/home/daviddeb/torcs/torcs-1.3.7 -g -O2 -Wall -fPIC -fno-strict-aliasing -O2 -DUSE_RANDR_EXT -DGL_GLEXT_PROTOTYPES -Wall -fPIC -fno-strict-aliasing -O2 -DUSE_RANDR_EXT -DGL_GLEXT_PROTOTYPES -D_SVID_SOURCE -D_BSD_SOURCE -DSHM -DHAVE_CONFIG_H -c berniw_2004.cpp
                          In file included from berniw_2004.cpp:21:0:
                          berniw.h:27:17: fatal error: tgf.h: No such file or directory
                          #include <tgf.h>
                          ^
                          compilation terminated.
                          /home/daviddeb/torcs/torcs-1.3.7/Make-default.mk:240: recipe for target 'berniw_2004.o' failed
                          make: *** [berniw_2004.o] Error 1
                          Last Edited: 2017-03-24 18:58:15 by jspenn
                            Author: dummy | Created: 2017-03-24 20:07:37
                            Subject: Re: Thuroughly confused about TORCs setup
                            Why do you work with torcs-1.3.7 after you installed 1.3.8 already?

                            Doesn't help you, but it's me being just curious.

                            EDIT: Just try 1.3.8, maybe it works after all ;)
                            Last Edited: 2017-03-24 20:10:14 by dummy
                            Author: berniw | Created: 2017-03-24 22:26:38
                            Subject: Re: Thuroughly confused about TORCs setup
                            Maybe you just messed up the environment variables, pointing to nonexisting 1.3.7 instead of 1.3.8-test1?

                            Kind regards

                            Bernhard
                            Last Edited: 2017-03-24 22:26:38 by berniw
                              Author: jspenn | Created: 2017-03-25 09:25:19
                              Subject: Re: Thuroughly confused about TORCs setup
                              Thanks for reminding me about the environment variables, I've forgotten to change them. I still have 1.3.7 though, and it's about 50-50 as to robots that compile eg axiom, and robots that don't eg berniw.

                              EDIT: Just changed the environment variables, no change.
                              Last Edited: 2017-03-26 09:08:15 by jspenn