feat: rename AE mode parameter to AE reference stream and update related callbacks

This commit is contained in:
slz
2026-04-03 19:04:22 +08:00
parent 9aa802083d
commit 85cb7ed0ee
5 changed files with 23 additions and 23 deletions
@@ -408,7 +408,7 @@ class OBCameraNode {
void getUserCalibParamsCallback(const std::shared_ptr<GetUserCalibParams::Request>& request,
std::shared_ptr<GetUserCalibParams::Response>& response);
void setAEModeCallback(const std::shared_ptr<SetString::Request>& request,
void setAEReferenceStreamCallback(const std::shared_ptr<SetString::Request>& request,
std::shared_ptr<SetString::Response>& response);
void setSportsModeCallback(const std::shared_ptr<SetBool::Request>& request,
@@ -620,7 +620,7 @@ class OBCameraNode {
rclcpp::Service<std_srvs::srv::SetBool>::SharedPtr set_streams_enable_srv_;
rclcpp::Service<GetUserCalibParams>::SharedPtr get_user_calib_params_srv_;
rclcpp::Service<SetUserCalibParams>::SharedPtr set_user_calib_params_srv_;
rclcpp::Service<SetString>::SharedPtr set_ae_mode_srv_;
rclcpp::Service<SetString>::SharedPtr set_ae_reference_stream_srv_;
rclcpp::Service<SetBool>::SharedPtr set_sports_mode_srv_;
bool enable_sync_output_accel_gyro_ = false;
@@ -920,7 +920,7 @@ class OBCameraNode {
std::unique_ptr<FpsDelayStatus> fps_delay_status_depth_{nullptr};
std::string intra_camera_sync_reference_ = "";
std::string ae_mode_;
std::string ae_reference_stream_;
bool enable_sports_mode_;
int pid_ = 0;
};
+1 -1
View File
@@ -108,7 +108,7 @@ def generate_launch_description():
DeclareLaunchArgument('enable_colored_point_cloud', default_value='false'),
DeclareLaunchArgument('cloud_frame_id', default_value=''),
DeclareLaunchArgument('connection_delay', default_value='10'),
DeclareLaunchArgument('ae_mode', default_value='depthbased'), # depthbased or colorbased
DeclareLaunchArgument('ae_reference_stream', default_value='depth'), # depth or color
DeclareLaunchArgument('enable_sports_mode', default_value='false'),
DeclareLaunchArgument('color_width', default_value='0'),
DeclareLaunchArgument('color_height', default_value='0'),
+1 -1
View File
@@ -108,7 +108,7 @@ def generate_launch_description():
DeclareLaunchArgument('enable_colored_point_cloud', default_value='false'),
DeclareLaunchArgument('cloud_frame_id', default_value=''),
DeclareLaunchArgument('connection_delay', default_value='10'),
DeclareLaunchArgument('ae_mode', default_value='depthbased'), # depthbased or colorbased
DeclareLaunchArgument('ae_reference_stream', default_value='depth'), # depth or color
DeclareLaunchArgument('enable_sports_mode', default_value='false'),
DeclareLaunchArgument('color_width', default_value='0'),
DeclareLaunchArgument('color_height', default_value='0'),
+5 -5
View File
@@ -1009,12 +1009,12 @@ void OBCameraNode::setupDevices() {
RCLCPP_INFO_STREAM(logger_, "Setting Sports Mode to " << (enable_sports_mode_ ? "ON" : "OFF"));
}
if ((ae_mode_ == "depthbased" || ae_mode_ == "colorbased") &&
if ((ae_reference_stream_ == "depth" || ae_reference_stream_ == "color") &&
device_->isPropertySupported(OB_PROP_DEVICE_AE_REFERENCE_INT, OB_PERMISSION_WRITE)) {
if (device_->isPropertySupported(OB_PROP_DEVICE_AE_REFERENCE_INT, OB_PERMISSION_WRITE)) {
auto ae_mode = ae_mode_ == "depthbased" ? 0 : 1;
device_->setIntProperty(OB_PROP_DEVICE_AE_REFERENCE_INT, ae_mode);
RCLCPP_INFO_STREAM(logger_, "Setting AE Mode to " << ae_mode_);
auto ae_reference = ae_reference_stream_ == "depth" ? 0 : 1;
device_->setIntProperty(OB_PROP_DEVICE_AE_REFERENCE_INT, ae_reference);
RCLCPP_INFO_STREAM(logger_, "Setting AE Reference Stream to " << ae_reference_stream_);
}
}
}
@@ -2307,7 +2307,7 @@ void OBCameraNode::getParameters() {
setAndGetNodeParameter<bool>(enable_publish_extrinsic_, "enable_publish_extrinsic", false);
setAndGetNodeParameter<std::string>(intra_camera_sync_reference_, "intra_camera_sync_reference",
"Middle");
setAndGetNodeParameter<std::string>(ae_mode_, "ae_mode", "depthbased");
setAndGetNodeParameter<std::string>(ae_reference_stream_, "ae_reference_stream", "depth");
setAndGetNodeParameter<bool>(enable_sports_mode_, "enable_sports_mode", false);
RCLCPP_INFO_STREAM(logger_, "current time domain: " << time_domain_);
+13 -13
View File
@@ -282,10 +282,10 @@ void OBCameraNode::setupCameraCtrlServices() {
getUserCalibParamsCallback(request, response);
});
}
set_ae_mode_srv_ = node_->create_service<SetString>(
"set_ae_mode", [this](const std::shared_ptr<SetString::Request> request,
set_ae_reference_stream_srv_ = node_->create_service<SetString>(
"set_ae_reference_stream", [this](const std::shared_ptr<SetString::Request> request,
std::shared_ptr<SetString::Response> response) {
setAEModeCallback(request, response);
setAEReferenceStreamCallback(request, response);
});
set_sports_mode_srv_ = node_->create_service<SetBool>(
"set_sports_mode", [this](const std::shared_ptr<SetBool::Request> request,
@@ -666,15 +666,15 @@ void OBCameraNode::setAeRoiCallback(const std::shared_ptr<SetArrays ::Request>&
const stream_index_pair& stream_index) {
auto stream = stream_index.first;
if (device_->getDeviceInfo()->getPid() == GEMINI_305_PID &&
(stream != OB_STREAM_COLOR && ae_mode_ == "colorbased")) {
(stream != OB_STREAM_COLOR && ae_reference_stream_ == "color")) {
response->success = false;
response->message = "AE MODE is colorbased, other sensors setting is not supported";
response->message = "AE Reference Stream is color, other sensors setting is not supported";
return;
}
if (device_->getDeviceInfo()->getPid() == GEMINI_305_PID &&
(stream != OB_STREAM_DEPTH && ae_mode_ == "depthbased")) {
(stream != OB_STREAM_DEPTH && ae_reference_stream_ == "depth")) {
response->success = false;
response->message = "AE MODE is depthbased, other sensors sensor setting is not supported";
response->message = "AE Reference Stream is depth, other sensors sensor setting is not supported";
return;
}
auto config = OBRegionOfInterest();
@@ -1649,19 +1649,19 @@ void OBCameraNode::getUserCalibParamsCallback(
response->message = "exception occurred";
}
}
void OBCameraNode::setAEModeCallback(const std::shared_ptr<SetString::Request>& request,
void OBCameraNode::setAEReferenceStreamCallback(const std::shared_ptr<SetString::Request>& request,
std::shared_ptr<SetString::Response>& response) {
try {
if (device_->isPropertySupported(OB_PROP_DEVICE_AE_REFERENCE_INT, OB_PERMISSION_WRITE) &&
(request->data == "depthbased" || request->data == "colorbased")) {
(request->data == "depth" || request->data == "color")) {
device_->setIntProperty(OB_PROP_DEVICE_AE_REFERENCE_INT,
request->data == "depthbased" ? 0 : 1);
ae_mode_ = request->data;
request->data == "depth" ? 0 : 1);
ae_reference_stream_ = request->data;
response->success = true;
response->message = "set AE mode success";
response->message = "set AE reference stream success";
} else {
response->success = false;
response->message = "set AE mode failed";
response->message = "set AE reference stream failed";
}
} catch (...) {
response->success = false;