Okay, I tried the load calibration again today, and I saw the depth window open with the same file I pasted above. The depth was bad, even though the calibration is correct as far as I know. The following is the depth:
What should I do now?
Edit1:
The depth is still bad after switching left and right in the calibration load file. I don't think I changed the camera setup. Should I calibrate again just to be sure? A few days ago, switching left and right in the depth_preview file gave the correct depth, but that is not the case now.
Edit2:
I calibrated the camera again, and now depth_preview is better, but I keep seeing blue-colored shadows of the outline of objects. Why is this happening? Is this how it is supposed to work around the discontinuity in depth?
Edit3:
After switching left and right in the calibration_load.py and using the -nic calibration data, I got good depth. It looks like the following:
Do you still want me to switch numerical calibration values instead to make it work with ROS 2?
Edit 4:
I did what you asked. I switched the numeric calibration values in the -nic calibration file but got bad depth with and without switching the cameras in calibration_load.py. I have pasted the original and the modified below:
Original:
{
"batchName": "",
"batchTime": 0,
"boardConf": "",
"boardCustom": "",
"boardName": "Custom FFC",
"boardOptions": 0,
"boardRev": "R1M0E3",
"cameraData": [
[
1,
{
"cameraType": 0,
"distortionCoeff": [
-0.7255496382713318,
5.1313700675964355,
-0.0002011057222262025,
0.0008841821108944714,
-6.754741668701172,
-0.7626256942749023,
5.142012119293213,
-6.697120189666748,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0
],
"extrinsics": {
"rotationMatrix": [],
"specTranslation": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"toCameraSocket": -1,
"translation": {
"x": 0.0,
"y": 0.0,
"z": 0.0
}
},
"height": 800,
"intrinsicMatrix": [
[
907.2047119140625,
0.0,
625.1134033203125
],
[
0.0,
907.6209716796875,
397.6976013183594
],
[
0.0,
0.0,
1.0
]
],
"lensPosition": 0,
"specHfovDeg": 75.0,
"width": 1280
}
],
[
2,
{
"cameraType": 0,
"distortionCoeff": [
-0.11288045346736908,
0.9440451264381409,
-0.0003182076325174421,
0.0005265712388791144,
-2.1388356685638428,
-0.15885838866233826,
1.0026153326034546,
-2.1278512477874756,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0
],
"extrinsics": {
"rotationMatrix": [
[
0.9948962926864624,
0.10089320689439774,
-0.0013819887535646558
],
[
-0.10070427507162094,
0.9937053918838501,
0.04907328262925148
],
[
0.006324450485408306,
-0.04868365451693535,
0.9987941980361938
]
],
"specTranslation": {
"x": 9.0,
"y": 0.0,
"z": 0.0
},
"toCameraSocket": 1,
"translation": {
"x": -8.728154182434082,
"y": 0.45325255393981934,
"z": -0.024646950885653496
}
},
"height": 800,
"intrinsicMatrix": [
[
907.8340454101563,
0.0,
646.8483276367188
],
[
0.0,
908.2755737304688,
384.77850341796875
],
[
0.0,
0.0,
1.0
]
],
"lensPosition": 0,
"specHfovDeg": 75.0,
"width": 1280
}
]
],
"deviceName": "",
"hardwareConf": "",
"housingExtrinsics": {
"rotationMatrix": [],
"specTranslation": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"toCameraSocket": -1,
"translation": {
"x": 0.0,
"y": 0.0,
"z": 0.0
}
},
"imuExtrinsics": {
"rotationMatrix": [],
"specTranslation": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"toCameraSocket": -1,
"translation": {
"x": 0.0,
"y": 0.0,
"z": 0.0
}
},
"miscellaneousData": [],
"productName": "",
"stereoEnableDistortionCorrection": false,
"stereoRectificationData": {
"leftCameraSocket": 1,
"rectifiedRotationLeft": [
[
0.9986503720283508,
-0.05185985937714577,
0.0028200335800647736
],
[
0.05191338434815407,
0.9983528256416321,
-0.024425296112895012
],
[
-0.0015486960764974356,
0.024538729339838028,
0.9996976852416992
]
],
"rectifiedRotationRight": [
[
0.99879390001297,
0.049086324870586395,
-0.0011084240395575762
],
[
-0.04904444143176079,
0.9984954595565796,
0.024524861946702003
],
[
0.0023105917498469353,
-0.02444092184305191,
0.9996985793113708
]
],
"rightCameraSocket": 2
},
"stereoUseSpecTranslation": true,
"version": 7,
"verticalCameraSocket": -1
}
Modified:
{
"batchName": "",
"batchTime": 0,
"boardConf": "",
"boardCustom": "",
"boardName": "Custom FFC",
"boardOptions": 0,
"boardRev": "R1M0E3",
"cameraData": [
[
1,
{
"cameraType": 0,
"distortionCoeff": [
-0.11288045346736908,
0.9440451264381409,
-0.0003182076325174421,
0.0005265712388791144,
-2.1388356685638428,
-0.15885838866233826,
1.0026153326034546,
-2.1278512477874756,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0
],
"extrinsics": {
"rotationMatrix": [
[
0.9948962926864624,
0.10089320689439774,
-0.0013819887535646558
],
[
-0.10070427507162094,
0.9937053918838501,
0.04907328262925148
],
[
0.006324450485408306,
-0.04868365451693535,
0.9987941980361938
]
],
"specTranslation": {
"x": 9.0,
"y": 0.0,
"z": 0.0
},
"toCameraSocket": 2,
"translation": {
"x": -8.728154182434082,
"y": 0.45325255393981934,
"z": -0.024646950885653496
}
},
"height": 800,
"intrinsicMatrix": [
[
907.8340454101563,
0.0,
646.8483276367188
],
[
0.0,
908.2755737304688,
384.77850341796875
],
[
0.0,
0.0,
1.0
]
],
"lensPosition": 0,
"specHfovDeg": 75.0,
"width": 1280
}
],
[
2,
{
"cameraType": 0,
"distortionCoeff": [
-0.7255496382713318,
5.1313700675964355,
-0.0002011057222262025,
0.0008841821108944714,
-6.754741668701172,
-0.7626256942749023,
5.142012119293213,
-6.697120189666748,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0
],
"extrinsics": {
"rotationMatrix": [],
"specTranslation": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"toCameraSocket": -1,
"translation": {
"x": 0.0,
"y": 0.0,
"z": 0.0
}
},
"height": 800,
"intrinsicMatrix": [
[
907.2047119140625,
0.0,
625.1134033203125
],
[
0.0,
907.6209716796875,
397.6976013183594
],
[
0.0,
0.0,
1.0
]
],
"lensPosition": 0,
"specHfovDeg": 75.0,
"width": 1280
}
]
],
"deviceName": "",
"hardwareConf": "",
"housingExtrinsics": {
"rotationMatrix": [],
"specTranslation": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"toCameraSocket": -1,
"translation": {
"x": 0.0,
"y": 0.0,
"z": 0.0
}
},
"imuExtrinsics": {
"rotationMatrix": [],
"specTranslation": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"toCameraSocket": -1,
"translation": {
"x": 0.0,
"y": 0.0,
"z": 0.0
}
},
"miscellaneousData": [],
"productName": "",
"stereoEnableDistortionCorrection": false,
"stereoRectificationData": {
"leftCameraSocket": 1,
"rectifiedRotationLeft": [
[
0.99879390001297,
0.049086324870586395,
-0.0011084240395575762
],
[
-0.04904444143176079,
0.9984954595565796,
0.024524861946702003
],
[
0.0023105917498469353,
-0.02444092184305191,
0.9996985793113708
]
],
"rectifiedRotationRight": [
[
0.9986503720283508,
-0.05185985937714577,
0.0028200335800647736
],
[
0.05191338434815407,
0.9983528256416321,
-0.024425296112895012
],
[
-0.0015486960764974356,
0.024538729339838028,
0.9996976852416992
]
],
"rightCameraSocket": 2
},
"stereoUseSpecTranslation": true,
"version": 7,
"verticalCameraSocket": -1
}
Edit :
@jakaskerl I tried the ROS 1 noetic container, and the depth was good. But the fps was around 10, and it was unsynchronized even after setting synchronization to true. So the bug is in the ROS 2 driver, and the hardware is faulty?
I can't use the ROS 1 topic with RTabmap because the camera information is giving a negative baseline, even though the depth in rviz is correct. Rtabmap works with positive baseline. Rtabmap assumes the left camera is the reference, but I see in the rostopic info that it is switched.
Also, the image in ROS 1 topic has switched left and right. I move my right arm and see left side move in the image not like a mirror.