How to Configure an Ouster Sensor with a JSON Payload
This article will discuss the process for setting all the configuration parameters for an Ouster sensor all at once using a JSON payload through the HTTP API.
HTTP API Config URL
http://<sensor_hostname>/api/v1/sensor/config
Configuring with a file, e.g sensor-config.json
The sensor can be configured using a configuration file in JSON format. The format of this file is the same as the output of the TCP command get_config_param active
. It has the following format:
{
"auto_start_flag": 1,
"azimuth_window": [
0,
36000
],
"lidar_mode": "2048x10",
"multipurpose_io_mode": "INPUT_NMEA_UART",
"nmea_baud_rate": "BAUD_9600",
"nmea_ignore_valid_char": 0,
"nmea_in_polarity": "ACTIVE_HIGH",
"nmea_leap_seconds": 0,
"phase_lock_enable": false,
"phase_lock_offset": 0,
"sync_pulse_in_polarity": "ACTIVE_HIGH",
"sync_pulse_out_angle": 360,
"sync_pulse_out_frequency": 1,
"sync_pulse_out_polarity": "ACTIVE_HIGH",
"sync_pulse_out_pulse_width": 10,
"timestamp_mode": "TIME_FROM_SYNC_PULSE_IN",
"udp_ip": "",
"udp_port_imu": 7503,
"udp_port_lidar": 7502
}
Send the Configuration to Sensor
To send the configuration to the sensor you can use the POST HTTP Request Method. When you POST the sensor-config.json
file to the sensor it automatically reinitializes the sensor with the new config.
After you have POST the sensor-config.json
file to the sensor you must write the configuration if you would like them to persist after a reboot.
Do this with the standard TCP command
write_config_txt
HTTP Request Method
POST http://<sensor_hostname>/api/v1/sensor/config
Example httpie Command:
http POST http://<sensor_hostname>/api/v1/sensor/config < /path/to/sensor-config.json
Example curl Command:
curl -X POST -H "Content-Type: application/json" -d @/path/to/sensor-config.json http://<sensor_hostname>/api/v1/sensor/config