From b323f2cf9fd1d2fffd7926638b82128b71612dbb Mon Sep 17 00:00:00 2001 From: agv Date: Mon, 27 Apr 2020 21:14:12 -0400 Subject: [PATCH] Fixig bug in spinnaker 2.x.x which causes serial number to be read in hex --- include/spinnaker_sdk_camera_driver/camera.h | 2 +- src/camera.cpp | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/include/spinnaker_sdk_camera_driver/camera.h b/include/spinnaker_sdk_camera_driver/camera.h index 1f12fbc..c3bba14 100755 --- a/include/spinnaker_sdk_camera_driver/camera.h +++ b/include/spinnaker_sdk_camera_driver/camera.h @@ -59,7 +59,7 @@ namespace acquisition { // void setTrigMode(); // void setTriggerOverlapOff(); - string get_id() { return string(pCam_->GetUniqueID()); } + string get_id(); void make_master() { MASTER_ = true; ROS_DEBUG_STREAM( "camera " << get_id() << " set as master"); } bool is_master() { return MASTER_; } void set_color(bool flag) { COLOR_ = flag; } diff --git a/src/camera.cpp b/src/camera.cpp index ed04971..a97fd4f 100755 --- a/src/camera.cpp +++ b/src/camera.cpp @@ -292,6 +292,14 @@ void acquisition::Camera::trigger() { } +string acquisition::Camera::get_id() { + INodeMap& nodeMap = pCam_->GetTLDeviceNodeMap(); + CStringPtr ptrDeviceSerialNumber = nodeMap.GetNode("DeviceSerialNumber"); + if (IsReadable(ptrDeviceSerialNumber)){ + return string(ptrDeviceSerialNumber->GetValue()); + } + return ""; +} void acquisition::Camera::targetGreyValueTest() { CFloatPtr ptrExpTest =pCam_->GetNodeMap().GetNode("AutoExposureTargetGreyValue"); @@ -327,4 +335,4 @@ void acquisition::Camera::calibrationParamsTest(int calibrationWidth, int calibr ROS_WARN_STREAM(" Looks like your calibration is not done at full Sensor Resolution for cam_id = "<