Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiple cameras - device_num logic unnecessary #42

Open
bmegli opened this issue Jul 8, 2024 · 1 comment
Open

multiple cameras - device_num logic unnecessary #42

bmegli opened this issue Jul 8, 2024 · 1 comment

Comments

@bmegli
Copy link

bmegli commented Jul 8, 2024

Currently when using multiple sensors user has to pass number of sensors to driver

  • this is the only place in code I can see device_num used

This is unnecessary and difficult for user (what if sensors are added dynamically to the system by user?)

It should be enough to:

  • check if serial and USB descriptor are both empty (not defined)
    • connect to default sensor in that case
  • connect by serial otherwise
  • connect by USB descriptor otherwise

Link to relevant code fragment:

std::shared_ptr<ob::Device> OBCameraNodeDriver::selectDevice(
const std::shared_ptr<ob::DeviceList> &list) {
if (device_num_ == 1) {
ROS_INFO_STREAM("Connecting to the default device");
return list->getDevice(0);
}
std::shared_ptr<ob::Device> device = nullptr;
if (!serial_number_.empty()) {
ROS_INFO_STREAM("Connecting to device with serial number: " << serial_number_);
device = selectDeviceBySerialNumber(list, serial_number_);
} else if (!usb_port_.empty()) {
ROS_INFO_STREAM("Connecting to device with usb port: " << usb_port_);
device = selectDeviceByUSBPort(list, usb_port_);
}
if (device == nullptr) {
ROS_WARN_THROTTLE(1.0, "Device with serial number %s not found", serial_number_.c_str());
device_connected_ = false;
return nullptr;
}
return device;
}

bmegli added a commit to Extend-Robotics/OrbbecSDK_ROS1 that referenced this issue Jul 8, 2024
@bmegli
Copy link
Author

bmegli commented Jul 8, 2024

Example implementation in:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant