Add load_config_json_file_path and export_config_json_file_path parameters

This commit is contained in:
jj
2025-04-22 15:53:27 +08:00
parent 08a6f69390
commit 70c0a05718
3 changed files with 18 additions and 1 deletions
@@ -654,6 +654,8 @@ class OBCameraNode {
int max_depth_limit_ = 0; int max_depth_limit_ = 0;
std::string time_domain_ = "global"; // device, system, global std::string time_domain_ = "global"; // device, system, global
std::string exposure_range_mode_ = "default"; std::string exposure_range_mode_ = "default";
std::string load_config_json_file_path_ = "";
std::string export_config_json_file_path_ = "";
// soft ware trigger // soft ware trigger
rclcpp::TimerBase::SharedPtr software_trigger_timer_; rclcpp::TimerBase::SharedPtr software_trigger_timer_;
rclcpp::TimerBase::SharedPtr diagnostic_timer_; rclcpp::TimerBase::SharedPtr diagnostic_timer_;
@@ -57,6 +57,8 @@ def generate_launch_description():
DeclareLaunchArgument('usb_port', default_value=''), DeclareLaunchArgument('usb_port', default_value=''),
DeclareLaunchArgument('device_num', default_value='1'), DeclareLaunchArgument('device_num', default_value='1'),
DeclareLaunchArgument('preset_firmware_path', default_value=''), DeclareLaunchArgument('preset_firmware_path', default_value=''),
DeclareLaunchArgument('load_config_json_file_path', default_value=''),
DeclareLaunchArgument('export_config_json_file_path', default_value=''),
DeclareLaunchArgument('uvc_backend', default_value='libuvc'),#libuvc or v4l2 DeclareLaunchArgument('uvc_backend', default_value='libuvc'),#libuvc or v4l2
DeclareLaunchArgument('point_cloud_qos', default_value='default'), DeclareLaunchArgument('point_cloud_qos', default_value='default'),
DeclareLaunchArgument('enable_point_cloud', default_value='true'), DeclareLaunchArgument('enable_point_cloud', default_value='true'),
+14 -1
View File
@@ -645,10 +645,19 @@ void OBCameraNode::setupDevices() {
TRY_TO_SET_PROPERTY(setIntProperty, OB_PROP_DEVICE_PERFORMANCE_MODE_INT, 1); TRY_TO_SET_PROPERTY(setIntProperty, OB_PROP_DEVICE_PERFORMANCE_MODE_INT, 1);
} else if (exposure_range_mode_ == "regular") { } else if (exposure_range_mode_ == "regular") {
TRY_TO_SET_PROPERTY(setIntProperty, OB_PROP_DEVICE_PERFORMANCE_MODE_INT, 0); TRY_TO_SET_PROPERTY(setIntProperty, OB_PROP_DEVICE_PERFORMANCE_MODE_INT, 0);
} else { } else {
RCLCPP_ERROR(logger_, "exposure range mode does not support this setting"); RCLCPP_ERROR(logger_, "exposure range mode does not support this setting");
} }
} }
if (!load_config_json_file_path_.empty()) {
device_->loadPresetFromJsonFile(load_config_json_file_path_.c_str());
RCLCPP_INFO_STREAM(logger_, "Loading config json file path : " << load_config_json_file_path_);
}
if (!export_config_json_file_path_.empty()) {
device_->exportSettingsAsPresetJsonFile(export_config_json_file_path_.c_str());
RCLCPP_INFO_STREAM(logger_,
"Exporting config json file path : " << export_config_json_file_path_);
}
} }
void OBCameraNode::setupColorPostProcessFilter() { void OBCameraNode::setupColorPostProcessFilter() {
auto color_sensor = device_->getSensor(OB_SENSOR_COLOR); auto color_sensor = device_->getSensor(OB_SENSOR_COLOR);
@@ -1603,6 +1612,10 @@ void OBCameraNode::getParameters() {
setAndGetNodeParameter<bool>(enable_color_undistortion_, "enable_color_undistortion", false); setAndGetNodeParameter<bool>(enable_color_undistortion_, "enable_color_undistortion", false);
setAndGetNodeParameter<std::string>(time_domain_, "time_domain", "global"); setAndGetNodeParameter<std::string>(time_domain_, "time_domain", "global");
setAndGetNodeParameter<std::string>(exposure_range_mode_, "exposure_range_mode", "default"); setAndGetNodeParameter<std::string>(exposure_range_mode_, "exposure_range_mode", "default");
setAndGetNodeParameter<std::string>(load_config_json_file_path_, "load_config_json_file_path",
"");
setAndGetNodeParameter<std::string>(export_config_json_file_path_, "export_config_json_file_path",
"");
auto device_info = device_->getDeviceInfo(); auto device_info = device_->getDeviceInfo();
CHECK_NOTNULL(device_info.get()); CHECK_NOTNULL(device_info.get());
auto pid = device_info->getPid(); auto pid = device_info->getPid();