Git Product home page Git Product logo

libcarla's Introduction

Build system for the new architecture of CARLA

Build Status

Demo project for developing the new build system and architecture of CARLA Simulator.

This new architecture supports multi-client multi-agent communication, basically any number of Python clients can connect and send instructions to the simulator simultaneously. The result is a new API that allows a finer control of each actor in the scene

import carla

client = carla.Client('localhost', 8080)
client.set_timeout(1000)

print('client version: %s' % client.get_client_version())
print('server version: %s' % client.get_server_version())

world = client.get_world()

blueprint = random.choice(world.get_blueprint_library())

transform = carla.Transform(
    carla.Location(x=-12.5, y=24.0, z=2.0),
    carla.Rotation(yaw=-90))

actor = world.spawn_actor(blueprint, transform)

while True:
    control = carla.VehicleControl(
        throttle=random.uniform(0.3, 1.0),
        steer=random.uniform(-0.1, 0.1))

    actor.apply_control(control)

    time.sleep(1)

Design

The most challenging part of the setup is to compile all the dependencies and modules to be compatible with a) Unreal Engine in the server-side, and b) Python in the client-side.

The goal is to be able to call Unreal Engine's functions from a separate Python process.

modules

Compilation

Required installed dependencies,

$ sudo add-apt-repository ppa:ubuntu-toolchain-r/test
$ sudo apt-get install clang-5.0 lld-5.0 g++-7 ninja-build python python-pip python3 python3-pip libboost-python-dev
$ pip2 install --user setuptools nose2
$ pip3 install --user setuptools nose2

Required compiler

  • clang++-5.0

Best if it is set up as default version of clang

$ sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/lib/llvm-5.0/bin/clang++ 101
$ sudo update-alternatives --install /usr/bin/clang clang /usr/lib/llvm-5.0/bin/clang 101

Everything is compiled with -std=c++17.

Required CMake 3.9 or higher.

Required Unreal Engine 4.19, install with the usual

$ git clone --depth=1 -b 4.19 https://github.com/EpicGames/UnrealEngine.git ~/UnrealEngine_4.19
$ cd ~/UnrealEngine_4.19
$ ./Setup.sh && ./GenerateProjectFiles.sh && make

and set your UE4_ROOT environment variable

$ export UE4_ROOT=~/UnrealEngine_4.19

Once everything is installed, run one of the following commands

$ make launch   # Compiles CARLA and launches Unreal Engine's Editor.
$ make package  # Compiles CARLA and creates a packaged version for distribution.
$ make help     # Print all available commands.

Compilation details

Here a detailed description of the different modules that need to be compiled. The Makefile compiles these modules incrementally as needed.

Setup

Command

$ make setup

Get and compile dependencies

  • llvm-5.0 (libc++ and libc++abi)
  • rpclib-2.2.1 (both with libstdc++ and libc++)
  • boost-1.67 (headers only)
  • googletest-1.8.0 (with libc++)

LibCarla

Compiled with CMake (min. version required CMake 3.9).

Command

$ make LibCarla

Two configurations:

Server Client
Unit tests yes no
Requires rpclib, gtest, boost rpclib, boost
std runtime LLVM's libc++ Default libstdc++
Output headers and test exes libcarla_client.a
Required by Carla plugin PythonAPI

CarlaUE4 and Carla plugin

Both compiled at the same step with Unreal Engine 4.19 build tool. They require the UE4_ROOT environment variable set.

Command

$ make CarlaUE4Editor

To launch Unreal Engine's Editor run

$ make launch

PythonAPI

Compiled using Python's setuptools ("setup.py"). Currently requires the following to be installed in the machine: Python, libpython-dev, and libboost-python-dev; both for Python 2.7 and 3.5.

Command

$ make PythonAPI

It creates two "egg" packages

  • PythonAPI/dist/carla-0.9.0-py2.7-linux-x86_64.egg
  • PythonAPI/dist/carla-0.9.0-py3.5-linux-x86_64.egg

This package can be directly imported into a Python script by adding it to the system path

#!/usr/bin/env python

import sys

sys.path.append(
    'dist/carla-0.9.0-py%d.%d-linux-x86_64.egg' % (sys.version_info.major,
                                                   sys.version_info.minor))

import carla

or installed with easy_install

$ easy_install2 --user --no-deps PythonAPI/dist/carla-0.9.0-py2.7-linux-x86_64.egg
$ easy_install3 --user --no-deps PythonAPI/dist/carla-0.9.0-py3.5-linux-x86_64.egg

libcarla's People

Contributors

nsubiron avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.