3.3.1 Building and installing examples

OSMP includes three examples located in osmp/examples:

OSMPDummySensor/

Can be used as a simple dummy sensor model, demonstrating the use of OSI for sensor models consuming sensor view data and generating sensor data output.

OSMPDummySource/

Can be used as a simple source of sensor view data and ground-truth data. It can be connected to the input of an OSMPDummySensor model, for simple testing and demonstration purposes.

OSMPCNetworkProxy/

Demonstrates a simple C network proxy that can send and receive OSI data via TCP sockets.

Prerequisites

Steps

  1. Clone the OSMP repository.

    git clone https://github.com/OpenSimulationInterface/osi-sensor-model-packaging.git
  2. Switch to the OSMP repository.

    cd osi-sensor-model-packaging
  3. Update and initialize the OSI submodule.

    git submodule update --init
  4. Run cmake and build

    1. If you followed the protobuf installation instructions for Windows using vcpkg, you can use the built protobuf libraries to automatically build the examples by specifying the triplet and toolchain file from VCPKG on the cmake configuration command-line:

      cd examples
      mkdir build
      cd build
      cmake .. -DVCPKG_TARGET_TRIPLET=x64-windows-static-md -DCMAKE_TOOLCHAIN_FILE=../../../vcpkg/scripts/buildsystems/vcpkg.cmake
      cmake –-build .

      The CMAKE_TOOLCHAIN_FILE must point to your vcpkg directory, which in this example was parallel to the osi-sensor-model-packaging directory.

    2. If you did not install and build protobuf using vcpkg, use:

      cd examples
      mkdir build
      cd build
      cmake ..
      cmake --build .