mirror of
https://github.com/orbbec/OrbbecSDK_ROS2.git
synced 2026-10-11 06:59:49 +08:00
Fix the problem that shutting down LDP using service causes laser to shut down
This commit is contained in:
@@ -502,7 +502,15 @@ void OBCameraNode::setLdpEnableCallback(
|
|||||||
(void)response;
|
(void)response;
|
||||||
bool ldp_enable = request->data;
|
bool ldp_enable = request->data;
|
||||||
try {
|
try {
|
||||||
device_->setBoolProperty(OB_PROP_LDP_BOOL, ldp_enable);
|
if (device_->isPropertySupported(OB_PROP_LASER_CONTROL_INT, OB_PERMISSION_READ_WRITE)) {
|
||||||
|
auto laser_enable = device_->getIntProperty(OB_PROP_LASER_CONTROL_INT);
|
||||||
|
device_->setBoolProperty(OB_PROP_LDP_BOOL, ldp_enable);
|
||||||
|
device_->setIntProperty(OB_PROP_LASER_CONTROL_INT, laser_enable);
|
||||||
|
} else if (device_->isPropertySupported(OB_PROP_LASER_BOOL, OB_PERMISSION_READ_WRITE)) {
|
||||||
|
auto laser_enable = device_->getIntProperty(OB_PROP_LASER_BOOL);
|
||||||
|
device_->setBoolProperty(OB_PROP_LDP_BOOL, ldp_enable);
|
||||||
|
device_->setIntProperty(OB_PROP_LASER_BOOL, laser_enable);
|
||||||
|
}
|
||||||
response->success = true;
|
response->success = true;
|
||||||
} catch (const ob::Error& e) {
|
} catch (const ob::Error& e) {
|
||||||
response->success = false;
|
response->success = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user