Working with an Ouster sensor

Configuring Your Sensor

To work with your sensor, you should configure the ports, the OperatingMode, and the LidarMode:

# create empty config
config = client.SensorConfig()

# set the values that you need: see sensor documentation for param meanings
config.operating_mode = client.OperatingMode.OPERATING_NORMAL
config.lidar_mode = client.LidarMode.MODE_1024x10
config.udp_port_lidar = 7502
config.udp_port_imu = 7503

# set the config on sensor, using appropriate flags
client.set_config(hostname, config, persist=True, udp_dest_auto=True)

Each config parameter corresponds directly to the sensor configuration parameters available on the sensor.

You can run the above code, captured in the configure_sensor_params() example, as follows:

$ python3 -m ouster.sdk.examples.client $SENSOR_HOSTNAME configure-sensor

Once you’ve configured your sensor, you shouldn’t have to configure it again until it shuts down or restarts. You can explore the persist flag to persist port and udp_dest settings over sensor restarts.

If you have a Rev6 or later sensor and are running FW 2.2+, you should be able to configure your sensor to use dual returns by setting the config parameter UDPProfileLidar:

config.udp_profile_lidar = client.UDPProfileLidar.PROFILE_LIDAR_RNG19_RFL8_SIG16_NIR16_DUAL

Try the configure_dual_returns() configuration example on your Rev6 or later sensor:

$ python3 -m ouster.sdk.examples.client $SENSOR_HOSTNAME configure-dual-returns

Obtaining Sensor Metadata

Ouster sensors require metadata to interpret the readings of the sensor. Represented by the object SensorInfo, metadata fields include configuration parameters such as lidar_mode and sensor intrinsics like beam_azimuth_angles.

When you work with a sensor, the client will automatically fetch the metadata. Recorded pcaps, however, must always be accompanied by a json file containing the metadata of the sensor as it was when the data was recorded.

Since it’s crucial to save the correct metadata file, let’s see how we can get that from a sensor. Try running the following example:

$ python3 -m ouster.sdk.examples.client $SENSOR_HOSTNAME fetch-metadata

And now let’s look inside the fetch_metadata() we just ran:

with closing(client.Sensor(hostname, 7502, 7503)) as source:
    # print some useful info from
    print("Retrieved metadata:")
    print(f"  serial no:        {}")
    print(f"  firmware version: {source.metadata.fw_rev}")
    print(f"  product line:     {source.metadata.prod_line}")
    print(f"  lidar mode:       {source.metadata.config.lidar_mode}")
    print(f"Writing to: {hostname}.json")

    # write metadata to disk

Seems simple enough!