diff --git a/ouster_client/include/ouster/client.h b/ouster_client/include/ouster/client.h index 9c003418..63c4552b 100644 --- a/ouster_client/include/ouster/client.h +++ b/ouster_client/include/ouster/client.h @@ -91,6 +91,8 @@ std::shared_ptr init_client(const std::string& hostname, int lidar_port, * using zero the method will automatically acquire and assign any free port. * @param[in] timeout_sec how long to wait for the sensor to initialize. * @param[in] persist_config if true, persists sensor settings between restarts + * @param[in] operating_mode The lidar operating mode. When using zero the + * method will leave the sensor in its current operating mode. * * @return pointer owning the resources associated with the connection. */ @@ -99,7 +101,8 @@ std::shared_ptr init_client( lidar_mode ld_mode = MODE_UNSPEC, timestamp_mode ts_mode = TIME_FROM_UNSPEC, int lidar_port = 0, int imu_port = 0, int timeout_sec = LONG_HTTP_REQUEST_TIMEOUT_SECONDS, - bool persist_config = false); + bool persist_config = false, + OperatingMode operating_mode = OPERATING_NORMAL); /** * [BETA] Connect to and configure the sensor and start listening for data via diff --git a/ouster_client/include/ouster/types.h b/ouster_client/include/ouster/types.h index d112cfb4..c97c10a1 100644 --- a/ouster_client/include/ouster/types.h +++ b/ouster_client/include/ouster/types.h @@ -100,7 +100,8 @@ enum timestamp_mode { * meaning of each option. */ enum OperatingMode { - OPERATING_NORMAL = 1, ///< Normal sensor operation + OPERATING_UNSPEC = 0, ///< Unspecified sensor operation + OPERATING_NORMAL, ///< Normal sensor operation OPERATING_STANDBY ///< Standby }; diff --git a/ouster_client/src/client.cpp b/ouster_client/src/client.cpp index f21167ad..76299472 100644 --- a/ouster_client/src/client.cpp +++ b/ouster_client/src/client.cpp @@ -382,7 +382,8 @@ std::shared_ptr init_client(const std::string& hostname, const std::string& udp_dest_host, lidar_mode ld_mode, timestamp_mode ts_mode, int lidar_port, int imu_port, - int timeout_sec, bool persist_config) { + int timeout_sec, bool persist_config, + OperatingMode operating_mode) { auto cli = init_client(hostname, lidar_port, imu_port); if (!cli) return std::shared_ptr(); logger().info("(0 means a random port will be chosen)"); @@ -406,7 +407,7 @@ std::shared_ptr init_client(const std::string& hostname, if (lidar_port) config.udp_port_lidar = lidar_port; if (imu_port) config.udp_port_imu = imu_port; if (persist_config) config_flags |= CONFIG_PERSIST; - config.operating_mode = OPERATING_NORMAL; + if (operating_mode) config.operating_mode = operating_mode; set_config(*sensor_http, config, config_flags, timeout_sec); // will block until no longer INITIALIZING