4 Star 19 Fork 8

Gitee 极速下载/carla

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/carla-simulator/carla
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

C++ Client Example

This example creates an application using CARLA's C++ API to connect and control the simulator from C++.

Compile and run

Use the Makefile provided (Linux only), to compile and run the example. Note that it expects to have a simulator running at port 2000.

make run

How it works

In order to link our application against LibCarla, we need to compile LibCarla with the same compiler and configuration we are using with our application. To do so, we generate a CMake tool-chain file specifying the compiler and flags we want

# Example ToolChain.cmake
set(CMAKE_C_COMPILER /usr/bin/clang-8)
set(CMAKE_CXX_COMPILER /usr/bin/clang++-8)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -O3 -DNDEBUG" CACHE STRING "" FORCE)

We pass this file to CMake when compiling LibCarla.client

cd /path/to/carla-root-folder

make setup

cd /path/to/build-folder

cmake \
    -G "Ninja" \
    -DCMAKE_BUILD_TYPE=Client \
    -DLIBCARLA_BUILD_RELEASE=ON \
    -DLIBCARLA_BUILD_DEBUG=OFF \
    -DLIBCARLA_BUILD_TEST=OFF \
    -DCMAKE_TOOLCHAIN_FILE=/path/to/ToolChain.cmake \
    -DCMAKE_INSTALL_PREFIX=/path/to/install-folder \
    /path/to/carla-root-folder

ninja
ninja install

This will generate the following structure at the provided install path

libcarla-install
├── include
│   ├── carla
│   ├── cephes
│   ├── pugixml
|   ├── ...
│   └── system
│       ├── boost
│       ├── recast
│       └── rpc
└── lib
    ├── libcarla_client.a
    ├── librpc.a
    ├── libboost_filesystem.a
    └── ...

Our application needs to be linked at minimum against libcarla_client.a, librpc.a, libRecast.a, and libDetour*.a. If we make use of IO functionality and/or image processing we would need to link against boost_filesystem, png, tiff, and/or jpeg.

For more details take a look at the Makefile provided.

马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C/C++
1
https://gitee.com/mirrors/carla.git
git@gitee.com:mirrors/carla.git
mirrors
carla
carla
dev

搜索帮助