Hello,
I tried what you suggested, but the ROS2 code still does not work.
Then, I copied all the lines in the Python pipeline code into the C++ ROS2 code, converted to C++ syntax, compiled and ran it. Still, the ROS2 code is not working. Here is the revised C++ ROS2 code: https://www.dropbox.com/scl/fi/hxxxzya1eb70kkwqnl4fu/yolov4_spatial_publisher.cpp?rlkey=ejzr6pjw4pqwg961v72efiv6k&st=rmactwgm&dl=0
Is it possible the Python code is using a different Depthai library (as in import depthai as dai) than the C++ code is?
How can I make sure that both the Python code and the C++ ROS2 code use the same version of Depthai?
I suspect this, because:
stereo.setDepthAlign(dai.CameraBoardSocket.CAM_A) # Align depth to RGB camera
works in the Python code and its C++ equivalent
stereo->setDepthAlign(dai::CameraBoardSocket::CAM_A);
does not compile, and I have to use
stereo->setDepthAlign(dai::CameraBoardSocket::RGB);
to get the C++ code to compile.
The error that I get is:
/luxonis/depthai_examples/src/yolov4_spatial_publisher.cpp:75:51: error: ‘CAM_A’ is not a member of ‘dai::CameraBoardSocket’
75 | stereo->setDepthAlign(dai::CameraBoardSocket::CAM_A);
Any help is truly appreciated.
Thank you so much in advance!