sensor_http.h

Class

class SensorHttp

An interface to communicate with Ouster sensors via http requests

Public Functions

virtual ~SensorHttp() = default

Deconstruct the sensor http interface.

inline const ouster::util::version &firmware_version() const

Returns the cached sensor FW version retrieved on construction.

Returns:

returns the sensor FW version

inline const std::string &hostname() const

Returns the hostname for the associated sensor.

Returns:

returns the sensor FW version

virtual std::string metadata(int timeout_sec = SHORT_HTTP_REQUEST_TIMEOUT_SECONDS) const = 0

Queries the sensor metadata.

Parameters:

timeout_sec[in] The timeout for the request in seconds.

Returns:

returns a json string of the sensor metadata.

virtual std::string sensor_info(int timeout_sec = SHORT_HTTP_REQUEST_TIMEOUT_SECONDS) const = 0

Queries the sensor_info.

Parameters:

timeout_sec[in] The timeout for the request in seconds.

Returns:

returns a json string representing the sensor_info.

virtual std::string get_config_params(bool active, int timeout_sec = SHORT_HTTP_REQUEST_TIMEOUT_SECONDS) const = 0

Queries active/staged configuration on the sensor

Parameters:
  • active[in] if true retrieve active, otherwise get staged configs.

  • timeout_sec[in] The timeout for the request in seconds.

Returns:

a string representing the active or staged config

virtual void set_config_param(const std::string &key, const std::string &value, int timeout_sec = SHORT_HTTP_REQUEST_TIMEOUT_SECONDS) const = 0

Set the value of a specfic configuration on the sensor, the changed configuration is not active until the sensor is restarted.

Parameters:
  • key[in] name of the config to change.

  • value[in] the new value to set for the selected configuration.

  • timeout_sec[in] The timeout for the request in seconds.

virtual std::string active_config_params(int timeout_sec = SHORT_HTTP_REQUEST_TIMEOUT_SECONDS) const = 0

Retrieves the active configuration on the sensor

Parameters:

timeout_sec[in] The timeout for the request in seconds.

Returns:

json string of active configuration parameters set on the sensor

virtual std::string staged_config_params(int timeout_sec = SHORT_HTTP_REQUEST_TIMEOUT_SECONDS) const = 0

Retrieves the staged configuration on the sensor

Parameters:

timeout_sec[in] The timeout for the request in seconds.

Returns:

json string of staged configuration parameters set on the sensor

virtual void set_udp_dest_auto(int timeout_sec = SHORT_HTTP_REQUEST_TIMEOUT_SECONDS) const = 0

Enables automatic assignment of udp destination ports.

Parameters:

timeout_sec[in] The timeout for the request in seconds.

virtual std::string beam_intrinsics(int timeout_sec = SHORT_HTTP_REQUEST_TIMEOUT_SECONDS) const = 0

Retrieves beam intrinsics of the sensor.

Parameters:

timeout_sec[in] The timeout for the request in seconds.

Returns:

json string of beam_intrinsics retrieved from sensor

virtual std::string imu_intrinsics(int timeout_sec = SHORT_HTTP_REQUEST_TIMEOUT_SECONDS) const = 0

Retrieves imu intrinsics of the sensor.

Parameters:

timeout_sec[in] The timeout for the request in seconds.

Returns:

json string of imu_intrinsics received from sensor

virtual std::string lidar_intrinsics(int timeout_sec = SHORT_HTTP_REQUEST_TIMEOUT_SECONDS) const = 0

Retrieves lidar intrinsics of the sensor.

Parameters:

timeout_sec[in] The timeout for the request in seconds.

Returns:

json string of lidar_intrinsics retrieved from sensor

virtual std::string lidar_data_format(int timeout_sec = SHORT_HTTP_REQUEST_TIMEOUT_SECONDS) const = 0

Retrieves lidar data format.

Parameters:

timeout_sec[in] The timeout for the request in seconds.

Returns:

json string of lidar_data_format received from sensor

virtual std::string calibration_status(int timeout_sec = SHORT_HTTP_REQUEST_TIMEOUT_SECONDS) const = 0

Gets the calibaration status of the sensor.

Parameters:

timeout_sec[in] The timeout for the request in seconds.

Returns:

json string ofcalibration status received from sensor

virtual void reinitialize(int timeout_sec = SHORT_HTTP_REQUEST_TIMEOUT_SECONDS) const = 0

Restarts the sensor applying all staged configurations.

Parameters:

timeout_sec[in] The timeout for the request in seconds.

virtual void save_config_params(int timeout_sec = SHORT_HTTP_REQUEST_TIMEOUT_SECONDS) const = 0

Persist active configuration parameters to the sensor.

Parameters:

timeout_sec[in] The timeout for the request in seconds.

virtual std::string get_user_data(int timeout_sec = SHORT_HTTP_REQUEST_TIMEOUT_SECONDS) const = 0

Gets the user data stored on the sensor.

Parameters:

timeout_sec[in] The timeout for the request in seconds.

Returns:

user data retrieved from sensor

virtual UserDataAndPolicy get_user_data_and_policy(int timeout_sec = SHORT_HTTP_REQUEST_TIMEOUT_SECONDS) const = 0

Gets the user data stored on the sensor and the retention policy.

Parameters:

timeout_sec[in] The timeout for the request in seconds.

Returns:

user data and policy setting retrieved from the sensor

virtual void set_user_data(const std::string &data, bool keep_on_config_delete = true, int timeout_sec = SHORT_HTTP_REQUEST_TIMEOUT_SECONDS) const = 0

Sets the user data stored on the sensor.

Parameters:
  • data[in] Value of userdata to set on the sensor.

  • keep_on_config_delete[in] If true, keep the userdata when configuration is deleted from the sensor

  • timeout_sec[in] The timeout for the request in seconds.

virtual std::string network(int timeout_sec = SHORT_HTTP_REQUEST_TIMEOUT_SECONDS) const = 0

Gets sensor IP address information.

Parameters:

timeout_sec[in] The timeout to use in seconds for the version request, this argument is optional.

Returns:

a JSON string containing sensor IP address information.

virtual std::string auto_detected_udp_dest(int timeout_sec = SHORT_HTTP_REQUEST_TIMEOUT_SECONDS, nonstd::optional<std::string> original_destination = {}) const = 0

Gets the automatic destination address as detected by the sensor.

Parameters:
  • timeout_sec[in] The timeout to use in seconds for the version request, this argument is optional.

  • original_destination[in] Destination to restore to the sensor after. Otherwise pulled from the sensor.

Returns:

autodetected address

virtual void set_static_ip(const std::string &ip_address, int timeout_sec = SHORT_HTTP_REQUEST_TIMEOUT_SECONDS) const = 0

Set’s the sensor’s static IP address.

Parameters:
  • ip_address[in] The static IP to set on the sensor.

  • timeout_sec[in] The timeout for the request in seconds.

virtual void delete_static_ip(int timeout_sec = SHORT_HTTP_REQUEST_TIMEOUT_SECONDS) const = 0

Deletes any static IP address stored on the sensor.

Parameters:

timeout_sec[in] The timeout for the request in seconds.

virtual void delete_user_data(int timeout_sec = SHORT_HTTP_REQUEST_TIMEOUT_SECONDS) const = 0

Deletes the user data stored on the sensor.

Parameters:

timeout_sec[in] The timeout for the request in seconds.

virtual std::vector<uint8_t> diagnostics_dump(int timeout_sec = LONG_HTTP_REQUEST_TIMEOUT_SECONDS) const = 0

Downloads diagnostics data in zip format from the sensor.

Parameters:

timeout_sec[in] The timeout for the request in seconds.

Returns:

diagnostics dump file contents

Public Static Functions

static std::string firmware_version_string(const std::string &hostname, int timeout_sec = SHORT_HTTP_REQUEST_TIMEOUT_SECONDS)

Retrieves sensor firmware version information as a string.

Parameters:
  • hostname[in] hostname of the sensor to communicate with.

  • timeout_sec[in] The timeout to use in seconds for the version request, this argument is optional.

Returns:

firmware version string from sensor

static ouster::util::version firmware_version(const std::string &hostname, int timeout_sec = SHORT_HTTP_REQUEST_TIMEOUT_SECONDS)

Retrieves sensor firmware version information.

Parameters:
  • hostname[in] hostname of the sensor to communicate with.

  • timeout_sec[in] The timeout to use in seconds for the version request, this argument is optional.

Returns:

parsed firmware version from sensor

static std::unique_ptr<SensorHttp> create(const std::string &hostname, int timeout_sec = SHORT_HTTP_REQUEST_TIMEOUT_SECONDS)

Creates an instance of the SensorHttp interface.

Parameters:
  • hostname[in] hostname of the sensor to communicate with.

  • timeout_sec[in] The timeout to use in seconds for the version request, this argument is optional.

Returns:

a version specific implementation of the SensorHTTP instance

Structs

struct UserDataAndPolicy

Result for get_user_data_and_policy on SensorHttp

Functions

void ouster::sensor::util::set_http_api_headers(const std::vector<std::string> &headers)

Sets the list of additional headers to provide with each sensor HTTP request. Applies to any SensorHttps created after this point.

Parameters:

headers[in] list of headers to add

void ouster::sensor::util::set_http_api_prefix(const std::string &prefix)

Sets the prefix to add to any HTTP API requests to the sensor after /api/v1/. Applies to any SensorHttps created after this point.

Parameters:

prefix[in] prefix to add to http requests to the sensor