Skip to content

Commit 96bc9ed

Browse files
Vikrant Shahabhishekbajpayee
andauthored
Fixig bug in spinnaker 2.x.x which causes serial number to be read in hex (#84)
Co-authored-by: agv <ab9@mit.edu>
1 parent cd38cd3 commit 96bc9ed

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

include/spinnaker_sdk_camera_driver/camera.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ namespace acquisition {
5959
// void setTrigMode();
6060
// void setTriggerOverlapOff();
6161

62-
string get_id() { return string(pCam_->GetUniqueID()); }
62+
string get_id();
6363
void make_master() { MASTER_ = true; ROS_DEBUG_STREAM( "camera " << get_id() << " set as master"); }
6464
bool is_master() { return MASTER_; }
6565
void set_color(bool flag) { COLOR_ = flag; }

src/camera.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,14 @@ void acquisition::Camera::trigger() {
292292

293293
}
294294

295+
string acquisition::Camera::get_id() {
296+
INodeMap& nodeMap = pCam_->GetTLDeviceNodeMap();
297+
CStringPtr ptrDeviceSerialNumber = nodeMap.GetNode("DeviceSerialNumber");
298+
if (IsReadable(ptrDeviceSerialNumber)){
299+
return string(ptrDeviceSerialNumber->GetValue());
300+
}
301+
return "";
302+
}
295303

296304
void acquisition::Camera::targetGreyValueTest() {
297305
CFloatPtr ptrExpTest =pCam_->GetNodeMap().GetNode("AutoExposureTargetGreyValue");
@@ -327,4 +335,4 @@ void acquisition::Camera::calibrationParamsTest(int calibrationWidth, int calibr
327335
ROS_WARN_STREAM(" Looks like your calibration is not done at full Sensor Resolution for cam_id = "<<get_id()<<" , Sensor_Width = "<<(pCam_ ->SensorWidth()) <<" given cameraInfo params:width = "<<calibrationWidth);
328336
if ( (pCam_ ->SensorHeight()) != calibrationHeight )
329337
ROS_WARN_STREAM(" Looks like your calibration is not done at full Sensor Resolution for cam_id = "<<get_id()<<" , Sensor_Height= "<<(pCam_ ->SensorHeight()) <<" given cameraInfo params:height = "<<calibrationHeight);
330-
}
338+
}

0 commit comments

Comments
 (0)