neufieldrobotics / spinnaker_sdk_camera_driver

Point Grey (FLIR) Spinnaker based camera driver (Blackfly S etc.)
MIT License
127 stars 90 forks source link

Building on Jetson AGX Xavier running Jetpack 4.3 (Ubuntu 18.04) #89

Open rishabhkjain opened 4 years ago

rishabhkjain commented 4 years ago

I am trying setup this package on an Xavier which runs 18.04 (thus ROS melodic). As OpenCV is already installed with Jetpack (OpenCV 4 on Jetpack 4.3), and due to other differences in architecture (arm64) there were some issues with building this driver. Below are the issues I ran into when building along with the ways I was able to resolve them to get the package running. Hopefully this helps other people trying to use a similar compute.

Note, this was using the dev branch of the repo as I was having the serial hex issue with the master branch.

Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
CMake Error at /opt/ros/melodic/share/cv_bridge/cmake/cv_bridgeConfig.cmake:113 (message):
  Project 'cv_bridge' specifies '/usr/include/opencv' as an include dir,
  which is not found.  It does neither exist as an absolute directory nor in
  '${{prefix}}//usr/include/opencv'.  Check the issue tracker
  'https://github.com/ros-perception/vision_opencv/issues' and consider
  creating a ticket if the problem has not been reported yet.
Call Stack (most recent call first):
  /opt/ros/melodic/share/catkin/cmake/catkinConfig.cmake:76 (find_package)
  spinnaker_sdk_camera_driver/CMakeLists.txt:18 (find_package)

-------------------------------------------------------------------------------

Solved by including this package in src for the workspace  

https://github.com/ros-perception/vision_opencv

===============================================================================
vision_opencv/cv_bridge/CMakeLists.txt:11 (find_package)
CMake Error at /usr/share/cmake-3.10/Modules/FindBoost.cmake:1947 (message):
  Unable to find the requested Boost libraries.

  Boost version: 1.65.1

  Boost include path: /usr/include

  Could not find the following Boost libraries:

          boost_python37

  No Boost libraries were found.  You may need to set BOOST_LIBRARYDIR to the
  directory containing Boost libraries or BOOST_ROOT to the location of
  Boost.
--------------------------------------------------------------------------------------
Solved by changing 
     find_package(Boost REQUIRED python37) 
to    
    find_package(Boost REQUIRED python3)
 at /src/vision_opencv/cv_bridge/CMakeLists.txt:11

=========================================================================================

In file included from /home/avsensors/flir_ws/src/spinnaker_sdk_camera_driver/include/spinnaker_sdk_camera_driver/capture.h:4:0,
                 from /home/avsensors/flir_ws/src/spinnaker_sdk_camera_driver/src/capture.cpp:1:
/home/avsensors/flir_ws/src/spinnaker_sdk_camera_driver/include/spinnaker_sdk_camera_driver/std_include.h:9:10: fatal error: cv.h: No such file or directory
 #include <cv.h>

-------------------------------------------------------------------------------------------

Solved by changing 

#include <cv.h>
to
#include <opencv2/opencv.hpp>

in /src/spinnaker_sdk_camera_driver/include/spinnaker_sdk_camera_driver/std_inc

==============================================================================================

/home/avsensors/flir_ws/src/spinnaker_sdk_camera_driver/src/capture.cpp:927:42: error: ‘CV_WINDOW_NORMAL’ was not declared in this scope
     if (LIVE_)namedWindow("Acquisition", CV_WINDOW_NORMAL | CV_WINDOW_KEEPRATIO);
                                          ^~~~~~~~~~~~~~~~
/home/avsensors/flir_ws/src/spinnaker_sdk_camera_driver/src/capture.cpp:927:42: note: suggested alternative: ‘CV_RAND_NORMAL’
     if (LIVE_)namedWindow("Acquisition", CV_WINDOW_NORMAL | CV_WINDOW_KEEPRATIO);
                                          ^~~~~~~~~~~~~~~~
                                          CV_RAND_NORMAL
/home/avsensors/flir_ws/src/spinnaker_sdk_camera_driver/src/capture.cpp:927:61: error: ‘CV_WINDOW_KEEPRATIO’ was not declared in this scope
     if (LIVE_)namedWindow("Acquisition", CV_WINDOW_NORMAL | CV_WINDOW_KEEPRATIO);
                                                             ^~~~~~~~~~~~~~~~~~~
/home/avsensors/flir_ws/src/spinnaker_sdk_camera_driver/src/capture.cpp:927:61: note: suggested alternative: ‘CV_MINOR_VERSION’
     if (LIVE_)namedWindow("Acquisition", CV_WINDOW_NORMAL | CV_WINDOW_KEEPRATIO);
                                                             ^~~~~~~~~~~~~~~~~~~
                                                             CV_MINOR_VERSION
/home/avsensors/flir_ws/src/spinnaker_sdk_camera_driver/src/capture.cpp:976:23: error: ‘cvWaitKey’ was not declared in this scope
             int key = cvWaitKey(1);
                       ^~~~~~~~~
/home/avsensors/flir_ws/src/spinnaker_sdk_camera_driver/src/capture.cpp:1003:21: error: ‘cvDestroyAllWindows’ was not declared in this scope
                     cvDestroyAllWindows();
                     ^~~~~~~~~~~~~~~~~~~
/home/avsensors/flir_ws/src/spinnaker_sdk_camera_driver/src/capture.cpp:1032:21: error: ‘cvDestroyAllWindows’ was not declared in this scope
                     cvDestroyAllWindows();
------------------------------------------------------------------------------------------------------------------------------

solved by changing the usage to new CV definitions 

CV_WINDOW_NORMAL -> WINDOW_NORMAL 
CV_WINDOW_KEEPRATIO -> WINDOW_KEEPRATIO
cvWaitKey -> waitKey 
cvDestroyAllWindows -> destroyAllWindows 

in /src/spinnaker_sdk_camera_driver/src/capture.cpp

=======================================================================================================================================

/usr/include/python2.7/numpy/__multiarray_api.h:1537:144: error: return-statement with no value, in function returning ‘void*’ [-fpermissive]
 #define import_array() {if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); return NUMPY_IMPORT_ARRAY_RETVAL; } }
                                                                                                                                                ^
/usr/include/python2.7/numpy/__multiarray_api.h:1537:144: note: in definition of macro ‘import_array’
 #define import_array() {if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); return NUMPY_IMPORT_ARRAY_RETVAL; } }

----------------------------------------------------------------------------------------------------------------------------------
 solved by 
 changing
 #define NUMPY_IMPORT_ARRAY_RETVAL 
to 
 #define NUMPY_IMPORT_ARRAY_RETVAL NULL 

 in /usr/include/python2.7/numpy/__multiarray_api.h:1534

 ================================================================================================================================
ghost commented 4 years ago

@rishabhkjain This is helpful. Thanks.

capitalPSA commented 4 years ago

Works for me too. Thanks.

Estella12 commented 3 years ago

Every step is working following the modifications, thx.

davidy commented 3 years ago

Thanks for the contribution!