Skip to content

Commit

Permalink
Add operating_mode parameter to init_client(#629)
Browse files Browse the repository at this point in the history
  • Loading branch information
BlaiseLebreton authored Dec 18, 2024
1 parent f21d7c7 commit 8495190
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 4 additions & 1 deletion ouster_client/include/ouster/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ std::shared_ptr<client> 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.
*/
Expand All @@ -99,7 +101,8 @@ std::shared_ptr<client> 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
Expand Down
3 changes: 2 additions & 1 deletion ouster_client/include/ouster/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
};

Expand Down
5 changes: 3 additions & 2 deletions ouster_client/src/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,8 @@ std::shared_ptr<client> 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<client>();
logger().info("(0 means a random port will be chosen)");
Expand All @@ -406,7 +407,7 @@ std::shared_ptr<client> 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
Expand Down

0 comments on commit 8495190

Please sign in to comment.