package information
-------------------
Driver version is v0.12.0, built using 7.0.3.0 with DW SDK v7.00

requirements
------------
* DRIVEOS 7.00
* Additionally this package depends on `libcurl4-openssl-dev:arm64` for arm processor and `libcurl4-openssl-dev:amd64` for x86

device information
------------------
* Sensor Model: OSDOME
* Serial No: 122506001671
* FW version: v3.2.0

getting started
---------------
* To connect to a live sensor, first go through the included quick start guide. Alternatively, follow use the following link:
https://static.ouster.dev/sensor-docs/image_route1/image_route2/connecting/connecting-to-sensors.html

Once you have successfully verified is accessible from the NVIDIA DriveWorks kit, execute the following command:
```
SENSOR_ADDR=<sensor-ip-address>
HOST_ADDR=<destination-address> # optional
LIDAR_PORT=<lidar-port-value>   # optional (default is 7502)
IMU_PORT=<imu-port-value>       # optional (default is 7503)
ARCH=x86
PLUGIN_PATH=<path-to-plugin>/OSDOME/REV07/dwplugin_v0.12.0/driveworks_7.00/${ARCH}/libouster_lidar_plugin_${ARCH}.so
/usr/local/driveworks/bin/sample_lidar_replay \
    --protocol=lidar.custom  \
    --params=device="CUSTOM_EX",decoder-path="${PLUGIN_PATH}",ip=${SENSOR_ADDR},dip=${HOST_ADDR},lidar_port=${LIDAR_PORT},imu_port=${IMU_PORT}
```

where:
 - SENSOR_ADDR is the sensor hostname or ip address
 - HOST_ADDR is optional parameter that is used to specify the udp destination
 - ARCH should be set either 'x86' or 'arm' based on the computer architecture
 - PLUGIN_PATH is the path to decorder included in the drver
 - LIDAR_PORT is an optional parameter when not specified the plugin assumes the default port (7502) is used.
 - IMU_PORT is an optional parameter when not specified the plugin assumes the default port (7503) is used.

For example, if we are connect to the sensor with the hostname: `os-122506001671.local`, if the sensor
hostname is known to the machine in use then we use it to connect to the sensor, otherwise we obtain
the ip address of the sensor using ping let's assume it 192.168.1.19 then assuming the sensor is configured
with default lidar and imu port values we connect to it as follows:
```
SENSOR_ADDR=192.168.1.19
PLUGIN_PATH=<path-to-plugin>/OSDOME/REV07/dwplugin_v0.12.0/driveworks_7.00/x86/libouster_lidar_plugin_x86.so
/usr/local/driveworks/bin/sample_lidar_replay \
    --protocol=lidar.custom  \
    --params=device="CUSTOM_EX",decoder-path="${PLUGIN_PATH}",ip=${SENSOR_ADDR}
```

> **Note: The lidar port and the imu port are ports on the client device that the sensor will forward lidar data and imu data
to. To use lidar or imu port values other that is different form the default, you will need to access the sensor config page as
indicated in the quickstart guide, update the port values of either or both, then save the config (consider persisting these
values if necessary), then pass the new port values to the plugin launch command using `lidar_port` and `imu_port` params shown
earlier**.

* To replay an existing capture:
```
BIN_FILE=<path-to-bin-file>
ARCH=x86
PLUGIN_PATH=<path-to-plugin>/OSDOME/REV07/dwplugin_v0.12.0/driveworks_7.00/${ARCH}/libouster_lidar_plugin_${ARCH}.so
/usr/local/driveworks/bin/sample_lidar_replay \
    --protocol=lidar.virtual \
    --params=device="CUSTOM_EX",decoder-path="${PLUGIN_PATH}",file="${BIN_FILE}"
```

where:
 - BIN_FILE is the path to the bin to be played by the plugin
 - ARCH should be set either 'x86' or 'arm' based on the computer architecture
 - PLUGIN_PATH is the path to decorder included in the drver

For example, to replay the included `122506001671.bin` under `captures` folder, simply set the path to the bin file
and execute the `sample_lidar_replay` app as shown below:
```
BIN_FILE=<path-to-capture>/captures/122506001671.bin
ARCH=x86
PLUGIN_PATH=<path-to-plugin>/OSDOME/REV07/dwplugin_v0.12.0/driveworks_7.00/${ARCH}/libouster_lidar_plugin_${ARCH}.so
/usr/local/driveworks/bin/sample_lidar_replay \
    --protocol=lidar.virtual \
    --params=device="CUSTOM_EX",decoder-path="${PLUGIN_PATH}",file="${BIN_FILE}"
```

* To make a new capture create a rig file that for the recorder and add the following:
```
{
    "rig": {
        "sensors": [
            {
                "name": "<SESSION_ID>",
                "nominalSensor2Rig_FLU": {
                    "roll-pitch-yaw": [
                        0.0,
                        0.0,
                        0.0
                    ],
                    "t": [
                        0.0,
                        0.0,
                        0.0
                    ]
                },                                                                                                                                                                                                  
                "parameter": "device=CUSTOM_EX,decoder-path=<PLUGIN_PATH>,ip=<SENSOR_ADDR>,dip=<HOST_ADDR>,session_id=<SESSION_ID>"
                "properties": null,
                "protocol": "lidar.custom"
            },
            ...
        ],
        "vehicle" : {...}
    },
    "version": 2
}
```

Replace the following with approprite values:
 - SESSION_ID is a name that will be used when saving the file
 - PLUGIN_PATH: path to the plugin shared object (i.e the path to `libouster_lidar_plugin_x86.so` or `libouster_lidar_plugin_arm.so`)
 - SENSOR_ADDR: sensor ip or hostname
 - HOST_ADDR: destination ip address (optional)

Then save the rig file and launch the recorder application
```
/usr/local/driveworks/tools/capture/recorder ${SESSION_ID}_ouster_lidar_rig.json
```

Once the driver connects to the sensor press `s` followed by <enter> to start
recording, wait for the period you intend to capture then press `q` followed by
<enter> to stop the capture. Once the script exits a new recording will be saved
to the `captures` folder using the provided <SESSION-ID>

viewing pcap file
-----------------
* First install the latest ouster-sdk using `pip install ouster-sdk`
* Find the included `122506001671.pcap` sample file under `captures` and execute the command:
```
ouster-cli source 122506001671.pcap viz
```
A new window should pop up showing the lidar pcap replay. 

Refer to documentation/README.md for additional information
