Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to set operating mode at init_client #629

Merged
merged 7 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading