feat: support versioned preset launch configuration

This commit is contained in:
slz
2026-09-03 16:36:24 +08:00
parent 27e0c7dc97
commit 5fcd5eed85
15 changed files with 110 additions and 14 deletions
+9 -1
View File
@@ -423,7 +423,15 @@ void logCurrentPresetList(const rclcpp::Logger &logger, const std::shared_ptr<ob
const uint32_t count = preset_list->getCount();
RCLCPP_INFO(logger, "[%s] Current preset count: %u", stage, count);
for (uint32_t i = 0; i < count; ++i) {
RCLCPP_INFO(logger, "[%s] Preset[%u]: %s", stage, i, preset_list->getName(i));
const char *version = nullptr;
try {
version = preset_list->getDepthWorkModeVersion(i);
} catch (...) {
// Older firmware can enumerate presets without exposing version information.
}
RCLCPP_INFO(logger, "[%s] Preset[%u]: %s, depth work mode version: %s", stage, i,
preset_list->getName(i),
version == nullptr || version[0] == '\0' ? "not available" : version);
}
} catch (const ob::Error &e) {
RCLCPP_WARN(logger, "[%s] Failed to query preset list: %s", stage,
+10 -1
View File
@@ -205,7 +205,16 @@ void printPreset(const std::shared_ptr<ob::Device>& device) {
std::cout << "Preset list:" << std::endl;
for (uint32_t i = 0; i < preset_list->getCount(); i++) {
auto name = preset_list->getName(i);
std::cout << "Preset list[" << i << "]: " << name << std::endl;
std::string version;
try {
const char* version_value = preset_list->getDepthWorkModeVersion(i);
version = version_value == nullptr ? "" : version_value;
} catch (...) {
// Older firmware can enumerate presets without exposing version information.
}
std::cout << "Preset list[" << i << "]: " << name
<< ", depth work mode version: " << (version.empty() ? "not available" : version)
<< std::endl;
}
}
+9 -1
View File
@@ -181,7 +181,15 @@ void printPresetInfo(const std::shared_ptr<ob::Device> &device) {
for (uint32_t i = 0; i < preset_count; ++i) {
const char *preset_name = preset_list->getName(i);
if (preset_name != nullptr && preset_name[0] != '\0') {
RCLCPP_INFO_STREAM(logger, " - " << preset_name);
std::string version;
try {
const char *version_value = preset_list->getDepthWorkModeVersion(i);
version = version_value == nullptr ? "" : version_value;
} catch (...) {
// Older firmware can enumerate presets without exposing version information.
}
RCLCPP_INFO_STREAM(logger, " - " << preset_name << " (depth work mode version: "
<< (version.empty() ? "not available" : version) << ")");
}
}