Building the C++ Client from Source
Building the example code requires a compiler supporting C++14 and CMake 3.1 or newer and the jsoncpp, Eigen3, and tins libraries with headers installed on the system. The sample visualizer also requires the GLFW3 and GLEW libraries.
The C++ example code is available on the Ouster Github. Follow the instructions for cloning the project.
Building on Linux / macOS
To install build dependencies on Ubuntu, run:
$ sudo apt install build-essential cmake libjsoncpp-dev libeigen3-dev libcurl4-openssl-dev \ libtins-dev libpcap-dev libglfw3-dev libglew-dev libspdlog-dev
You may also install curl with a different ssl backend, for example libcurl4-gnutls-dev or libcurl4-nss-dev.
On macOS, install XCode and homebrew and run:
$ brew install cmake pkg-config jsoncpp eigen curl libtins glfw glew spdlog
To build run the following commands:
$ mkdir build $ cd build $ cmake <path to ouster_example> -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLES=ON $ cmake --build .
<path to ouster_example> is the location of the
ouster_example source directory. The
CMake build script supports several optional flags. Add any of the following to override the
-DBUILD_VIZ=OFF # Do not build the sample visualizer -DBUILD_PCAP=OFF # Do not build pcap tools -DBUILD_EXAMPLES=ON # Build C++ examples -DBUILD_TESTING=ON # Build tests -DBUILD_SHARED_LIBS=ON # Build shared instead of static libraries
Building on Windows
The example code can be built on Windows 10 with Visual Studio 2019 using CMake support and vcpkg for dependencies. Follow the official documentation to set up your build environment:
Note You’ll need to run
git checkout 2022.02.23 in the vcpkg directory before bootstrapping
to use the correct versions of the dependencies. Building may fail unexpectedly if you skip this
Don’t forget to integrate vcpkg with Visual Studio after bootstrapping:
PS > .\vcpkg.exe integrate install
You should be able to install dependencies with
PS > .\vcpkg.exe install --triplet x64-windows jsoncpp eigen3 curl libtins glfw3 glew spdlog
After these steps are complete, you should be able to open, build and run the
project using Visual Studio:
Start Visual Studio.
When the prompt opens asking you what type of project to open click Open a local folder and navigate to the
After opening the project for the first time, wait for CMake configuration to complete.
Make sure Visual Studio is building in release mode. You may experience performance issues and missing data in the visualizer otherwise.
In the menu bar at the top of the screen, select Build > Build All.
To use the resulting binaries, go to View > Terminal and run, for example:
Running the Sample Client
Make sure the sensor is connected to the network. See “Connecting to the Sensor” in the Software User Manual for instructions and different options for network configuration.
examples under the build directory, which should contain an executable named
client_example. This program will attempt to connect to the sensor, capture lidar data, and
write point clouds out to CSV files:
$ ./client_example <sensor hostname> <udp data destination>
<sensor hostname> can be the hostname (os-99xxxxxxxxxx) or IP of the sensor and
data destingation> is the hostname or IP to which the sensor should send lidar data. You can also
"", an empty string, to utilize automatic detection.
On Windows, you may need to allow the client/visualizer through the Windows firewall to receive sensor data.