Skip to content

Commit

Permalink
add option to disable external control (default!)
Browse files Browse the repository at this point in the history
  • Loading branch information
berndpfrommer committed Apr 18, 2024
1 parent 811df06 commit 519aef7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ class Camera
double acquisitionTimeout_{3.0};
bool adjustTimeStamp_{false};
bool connectWhileSubscribed_{false}; // if true, connects to SDK when subscription happens
bool enableExternalControl_{false};
uint32_t currentExposureTime_{0};
double averageTimeDifference_{std::numeric_limits<double>::quiet_NaN()};
int64_t baseTimeOffset_{0};
Expand Down
9 changes: 6 additions & 3 deletions spinnaker_camera_driver/src/camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ void Camera::readParameters()
acquisitionTimeout_ = safe_declare<double>(prefix_ + "acquisition_timeout", 3.0);
parameterFile_ = safe_declare<std::string>(prefix_ + "parameter_file", "parameters.yaml");
connectWhileSubscribed_ = safe_declare<bool>(prefix_ + "connect_while_subscribed", false);
enableExternalControl_ = safe_declare<bool>(prefix_ + "enable_external_control", false);
callbackHandle_ = node_->add_on_set_parameters_callback(
std::bind(&Camera::parameterChanged, this, std::placeholders::_1));
}
Expand Down Expand Up @@ -667,9 +668,11 @@ bool Camera::start()

infoManager_ = std::make_shared<camera_info_manager::CameraInfoManager>(
node_, name_.empty() ? node_->get_name() : name_, cameraInfoURL_);
controlSub_ = node_->create_subscription<flir_camera_msgs::msg::CameraControl>(
"~/" + topicPrefix_ + "control", 10,
std::bind(&Camera::controlCallback, this, std::placeholders::_1));
if (enableExternalControl_) {
controlSub_ = node_->create_subscription<flir_camera_msgs::msg::CameraControl>(
"~/" + topicPrefix_ + "control", 10,
std::bind(&Camera::controlCallback, this, std::placeholders::_1));
}
metaPub_ =
node_->create_publisher<flir_camera_msgs::msg::ImageMetaData>("~/" + topicPrefix_ + "meta", 1);

Expand Down

0 comments on commit 519aef7

Please sign in to comment.