Skip to content

Commit

Permalink
Fix #31 Make CARLA start without client by default
Browse files Browse the repository at this point in the history
  • Loading branch information
nsubiron committed Nov 18, 2017
1 parent d12de6a commit c01492c
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 34 deletions.
5 changes: 0 additions & 5 deletions Docs/carla_settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,3 @@ hierarchy overriding earlier values.
Take a look at the [CARLA Settings example][settingslink].

[settingslink]: https://github.com/carla-simulator/carla/blob/master/Docs/Example.CarlaSettings.ini

!!! tip
If you are in editor, you most probably want to disable networking.
Otherwise the game will hang until a client connects. Set
`UseNetworking=false` in "./Unreal/CarlaUE4/Config/CarlaSettings.ini".
2 changes: 1 addition & 1 deletion Docs/how_to_build_on_linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ How to build CARLA on Linux

Install the build tools and dependencies

$ sudo apt-get install build-essential clang-3.9 git cmake ninja-build python3-pip python3-requests python-dev tzdata curl wget unzip autoconf libtool
$ sudo apt-get install build-essential clang-3.9 git cmake ninja-build python3-pip python3-requests python-dev tzdata sed curl wget unzip autoconf libtool
$ sudo pip3 install protobuf

To avoid compatibility issues between Unreal Engine and the CARLA dependencies,
Expand Down
54 changes: 31 additions & 23 deletions Docs/how_to_run.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,27 @@ CARLA Simulator
Welcome to CARLA simulator.

This file contains the instructions to run the CARLA simulator binaries on
Linux. [Get the latest release here.][releaselink]
Linux.

[Get the latest release here.][releaselink]

For building CARLA from source, please check out the
[CARLA Documentation][docslink].

CARLA can be run directly by running the "CarlaUE4.sh" script provided in the
release package.

There are currently two scenarios available, the desired scenario can be chosen
from the command-line

$ ./CarlaUE4.sh /Game/Maps/Town01

or

$ ./CarlaUE4.sh /Game/Maps/Town02

To run CARLA as server, see ["Running the server"](#running-the-server) below.

[releaselink]: https://github.com/carla-simulator/carla/releases/latest
[docslink]: http://carla.readthedocs.io

Expand Down Expand Up @@ -45,41 +61,33 @@ Run the help command to see options available
Running the server
------------------

!!! note
By default the game starts in networking mode. It will hang until a client
is connected. See below how to run it without client.

The server can be started by running the `CarlaUE4.sh` script. When run in
networking mode (controlled by the CARLA client), it is highly recommended to
run it at fixed time-step
The server can be started by running the `CarlaUE4.sh` script with some extra
arguments. When run in server mode (controlled by the CARLA client), it is
highly recommended to run it at fixed time-step

$ ./CarlaUE4.sh /Game/Maps/Town01 -benchmark -fps=15
$ ./CarlaUE4.sh /Game/Maps/Town01 -carla-server -benchmark -fps=15

The arguments `-benchmark -fps=15` make the engine run at a fixed time-step of
1/15 seconds. In this mode, game-time decouples from real-time and the
simulation runs as fast as possible.

To run the game on the second city, just change the command to select the
"Town02"

$ ./CarlaUE4.sh /Game/Maps/Town02 -benchmark -fps=15

To run the game windowed at a given resolution
To run the game on the second town, just change the command to select the
"Town02" map

$ ./CarlaUE4.sh /Game/Maps/Town01 -benchmark -fps=15 -windowed -ResX=800 -ResY=600
$ ./CarlaUE4.sh /Game/Maps/Town02 -carla-server -benchmark -fps=15

The game can also be run without a client, this way you can drive around the
city just using the keyboard (in this mode is not recommended to use fixed
frame-rate to get a more realistic feeling)
When run as server is sometimes useful to run the game in a smaller window, this
can be chosen with

$ ./CarlaUE4.sh /Game/Maps/Town02 -carla-no-networking
$ ./CarlaUE4.sh /Game/Maps/Town01 -carla-server -benchmark -fps=15 -windowed -ResX=800 -ResY=600

#### CARLA command-line options
#### CARLA specific command-line options

* `-carla-server` Launches CARLA as server, the execution hangs until a client connects.
* `-carla-settings=<ini-file-path>` Load settings from the given INI file. See Example.CarlaSettings.ini.
* `-carla-world-port=<port-number>` Listen for client connections at <port-number>, agent ports are set to <port-number>+1 and <port-number>+2 respectively. Activates networking.
* `-carla-no-networking` Disable networking. Overrides other settings.
* `-carla-world-port=<port-number>` Listen for client connections at <port-number>, agent ports are set to <port-number>+1 and <port-number>+2 respectively. Activates server.
* `-carla-no-hud` Do not display the HUD by default.
* `-carla-no-networking` Disable networking. Overrides `-carla-server` if present.

#### Running CARLA off-screen

Expand Down
11 changes: 8 additions & 3 deletions Docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ Troubleshooting

#### Editor hangs after hitting Play

By default, when CARLA is started it waits for a client to be connected and
control the vehicle. This is the intended behavior. This can be changed in
"./Unreal/CarlaUE4/Config/CarlaSettings.ini" changing `UseNetworking=false`.
This is most probably happening because CARLA is started in server mode. Check
in your CarlaSettings.ini file ("./Unreal/CarlaUE4/Config/CarlaSettings.ini")
and set

```ini
[CARLA/Server]
UseNetworking=false
```

#### Very low FPS in editor when not in focus

Expand Down
3 changes: 2 additions & 1 deletion Setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ popd >/dev/null
CARLA_SETTINGS_FILE="./Unreal/CarlaUE4/Config/CarlaSettings.ini"

if [[ ! -f $CARLA_SETTINGS_FILE ]]; then
cp -v ./Docs/Example.CarlaSettings.ini $CARLA_SETTINGS_FILE
echo "Copying CarlaSettings.ini..."
sed -e 's/UseNetworking=true/UseNetworking=false/' ./Docs/Example.CarlaSettings.ini > $CARLA_SETTINGS_FILE
fi

./Util/Protoc.sh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ void UCarlaSettings::LoadSettings()
}
// Override settings from command-line.
{
if (FParse::Param(FCommandLine::Get(), TEXT("carla-server"))) {
bUseNetworking = true;
}
uint32 Value;
if (FParse::Value(FCommandLine::Get(), TEXT("-world-port="), Value) ||
FParse::Value(FCommandLine::Get(), TEXT("-carla-world-port="), Value)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class CARLA_API UCarlaSettings : public UObject

/** If active, wait for the client to connect and control the pawn. */
UPROPERTY(Category = "CARLA Server", VisibleAnywhere)
bool bUseNetworking = true;
bool bUseNetworking = false;

/** World port to listen for client connections. */
UPROPERTY(Category = "CARLA Server", VisibleAnywhere, meta = (EditCondition = bUseNetworking))
Expand Down

0 comments on commit c01492c

Please sign in to comment.