ros2_object_analytics安装过程全记录
ros2_object_analytics安裝過程全記錄
- ros2_object_analytics安裝過程全記錄
- 問題總結(jié)
- (1)OpenCV3.3依賴問題
- (2)devel版本中l(wèi)ibrealsense版本過低問題
- (3)NCS版本不好用的問題
- 安裝過程記錄
- (1)Install ROS2 desktop packages ros-crystal-desktop
- (2)Install ROS2 dependences
- (3)Install librealsense SDK2
- (4)Install NCS
- (5)Install OpenCV3 with opencv-contrib
- (6)Install Intel Distribution of OpenVINO toolkit
- (7)Install OpenCL Driver for GPU
- (8)(OpenCV)Additional steps are required on ubuntu 18.04
- (9)(librealsense SDK2.0)Other Dependencies
- (10)Building and Installation
- (10)Running the Demo
- (11)Build ros2_object_analytics
- (12)Object Analytics with OpenVINO
ros2_object_analytics安裝過程全記錄
問題總結(jié)
安裝ros2_object_analytics(下文簡稱OA)一共用了我個(gè)三個(gè)工作日時(shí)間,主要是自己對(duì)系統(tǒng)構(gòu)架不夠熟悉并且調(diào)試能力也不夠,所以將自己遇到的問題和安裝流程記錄下來,方便后來參考,另外這些問題是我在安裝時(shí)按照當(dāng)前版本的readme遇到的問題,因?yàn)榘姹具€會(huì)不不斷更新,更新之后可能問題就不存在了。
(1)OpenCV3.3依賴問題
按照readme安裝完OpenCV3.3編譯OA的時(shí)候會(huì)遇到
/usr/bin/ld: cannot find -llz4這應(yīng)該OpenCV3.3的依賴問題,解決辦法如下:
sudo apt-get install liblz4-dev(2)devel版本中l(wèi)ibrealsense版本過低問題
devel版本中的readme安裝realsense的驅(qū)動(dòng)的方法是
sudo apt-get install ros-crystal-librealsense2 ros-crystal-realsense-ros2-camera而在后面運(yùn)行的OA的時(shí)候,master分支沒有問題,但是devel分支的話會(huì)發(fā)現(xiàn)沒有點(diǎn)云信息,后來發(fā)現(xiàn)ros-crystal-librealsense2中的librealsense的SDK版本沒有更新是2.16.5版本的,這個(gè)版本中發(fā)布的點(diǎn)云節(jié)點(diǎn)是’/camera/depth/color/points’,而不是’/camera/aligned_depth_to_color/color/points’,而OA中master版本訂閱(映射)的點(diǎn)云節(jié)點(diǎn)是’/camera/depth/color/points’,devel中變成了’/camera/aligned_depth_to_color/color/points’,因此按照上述命令安裝realsense驅(qū)動(dòng)的話只有master版本是好用的,而devel版本就沒法用了。
我的解決辦法是,先卸載上面的兩個(gè)包
sudo apt-get remove ros-crystal-librealsense2 ros-crystal-realsense-ros2-camera按照Linux Distribution中安裝distribution版本的librealsense SDK2.0,安裝2.17.1的或者最新的都可以,然后將ros-crystal-realsense-ros2-camera放到工作空間中和OA一起編譯,之后就能解決上述沒有點(diǎn)云的問題
(3)NCS版本不好用的問題
目前maste版本的OA通過NCS是可以成功運(yùn)行的,但是devel版本,如果按照readme的方式一步一步安裝的話,插入的硬件是NCS2的話會(huì)報(bào)錯(cuò)
[ERROR] [movidius_ncs_stream]: Error: there is no device at the given index or name如果插入硬件NCS1的話會(huì)報(bào)錯(cuò)
[ERROR] [movidius_ncs_stream]: Error: an unexpected error was encontered during the function call后來了解到OA之后可能不再支持NCS版本,因此我就沒再話時(shí)間在調(diào)試NCS的問題上,轉(zhuǎn)戰(zhàn)OpenVINO.
安裝過程記錄
下面我記錄一的是一臺(tái)新電腦的OA從無到有的一個(gè)可行的安裝步驟,主要是參照ros2_object_analytics
和ros2_openvino_toolkit的readme,中間會(huì)指出一些容易出問題的地方
(1)Install ROS2 desktop packages ros-crystal-desktop
參看ros-crystal-desktop,應(yīng)該不會(huì)有什么問題
(2)Install ROS2 dependences
sudo apt-get install ros-crystal-cv-bridge ros-crystal-object-msgs ros-crystal-image-transport ros-crystal-realsense-camera-msgs(3)Install librealsense SDK2
參考Linux Distribution,應(yīng)該沒什么問題
(4)Install NCS
因?yàn)槲覜]有試沒有不安轉(zhuǎn)NCS會(huì)怎樣,因此我還是按照我原來的步驟安裝
# build ncsdk mkdir ~/code cd ~/code git clone https://github.com/movidius/ncsdk git clone https://github.com/movidius/ncappzoo cd ~/code/ncsdk make install ln -sf ~/code/ncappzoo /opt/movidius/ncappzoo# build ros2_intel_movidius_ncs mkdir ~/ros2_ws/src -p cd ~/ros2_ws/src git clone https://github.com/intel/ros2_intel_movidius_ncs.git cd ~/ros2_ws source /opt/ros/crystal/setup.bash colcon build --symlink-install (Install python3-colcon-common-extensions by apt-get if colcon command not exist)# build CNN model (Please plugin NCS device on the host while compiling) cd /opt/movidius/ncappzoo/caffe/SSD_MobileNet make# Copy object label file to NCSDK installation location. cp ~/ros2_ws/src/ros2_intel_movidius_ncs/data/labels/* /opt/movidius/ncappzoo/data/ilsvrc12/(5)Install OpenCV3 with opencv-contrib
mkdir ${HOME}/opencv cd ${HOME}/opencv git clone https://github.com/opencv/opencv.git -b 3.3.0 git clone https://github.com/opencv/opencv_contrib.git -b 3.3.0 mkdir opencv/build -p cd opencv/build cmake -DOPENCV_EXTRA_MODULES_PATH=${HOME}/opencv/opencv_contrib/modules \ -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_opencv_cnn_3dobj=OFF .. make -j8 sudo make install sudo ldconfig這里補(bǔ)上依賴
sudo apt-get install liblz4-dev下面就屬于安裝OpenVINO的
(6)Install Intel Distribution of OpenVINO toolkit
Download OpenVINO toolkit by following the guide
cd ~/Downloads wget -c http://registrationcenter-download.intel.com/akdlm/irc_nas/15078/l_openvino_toolkit_p_2018.5.455.tgzInstall OpenVINO toolkit by following the guide
cd ~/Downloads tar -xvf l_openvino_toolkit_p_2018.5.455.tgz cd l_openvino_toolkit_p_2018.5.455 # root is required instead of sudo sudo -E ./install_cv_sdk_dependencies.sh sudo ./install_GUI.sh # build sample code under OpenVINO toolkit source /opt/intel/computer_vision_sdk/bin/setupvars.sh cd /opt/intel/computer_vision_sdk/deployment_tools/inference_engine/samples/ mkdir build cd build cmake .. makeConfigure the Neural Compute Stick USB Driver
cd ~/Downloads cat <<EOF > 97-usbboot.rules SUBSYSTEM=="usb", ATTRS{idProduct}=="2150", ATTRS{idVendor}=="03e7", GROUP="users", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1" SUBSYSTEM=="usb", ATTRS{idProduct}=="2485", ATTRS{idVendor}=="03e7", GROUP="users", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1" SUBSYSTEM=="usb", ATTRS{idProduct}=="f63b", ATTRS{idVendor}=="03e7", GROUP="users", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1" EOF sudo cp 97-usbboot.rules /etc/udev/rules.d/ sudo udevadm control --reload-rules sudo udevadm trigger sudo ldconfig rm 97-usbboot.rules(7)Install OpenCL Driver for GPU
cd /opt/intel/computer_vision_sdk/install_dependenciessudo ./install_NEO_OCL_driver.sh(8)(OpenCV)Additional steps are required on ubuntu 18.04
sudo add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main"sudo apt updatesudo apt install libjasper1 libjasper-dev(9)(librealsense SDK2.0)Other Dependencies
#librealsense dependencysudo apt-get install -y libssl-dev libusb-1.0-0-dev pkg-config libgtk-3-devsudo apt-get install -y libglfw3-dev libgl1-mesa-dev libglu1-mesa-dev# numpy and networkxpip3 install numpypip3 install networkx# libboostsudo apt-get install -y --no-install-recommends libboost-all-devcd /usr/lib/x86_64-linux-gnusudo ln -sf libboost_python-py35.so libboost_python3.so(10)Building and Installation
Build sample code under openvino toolkit
# root is required instead of sudosource /opt/intel/computer_vision_sdk/bin/setupvars.shcd /opt/intel/computer_vision_sdk/deployment_tools/inference_engine/samples/mkdir buildcd buildcmake ..makeset ENV CPU_EXTENSION_LIB and GFLAGS_LIB
export CPU_EXTENSION_LIB=/opt/intel/computer_vision_sdk/deployment_tools/inference_engine/samples/build/intel64/Release/lib/libcpu_extension.soexport GFLAGS_LIB=/opt/intel/computer_vision_sdk/deployment_tools/inference_engine/samples/build/intel64/Release/lib/libgflags_nothreads.aInstall ROS2_OpenVINO packages
mkdir -p ~/ros2_overlay_ws/srccd ~/ros2_overlay_ws/srcgit clone https://github.com/intel/ros2_openvino_toolkitgit clone https://github.com/intel/ros2_object_msgsgit clone https://github.com/ros-perception/vision_opencv -b ros2git clone https://github.com/ros2/message_filters.gitgit clone https://github.com/ros-perception/image_common.git -b ros2git clone https://github.com/intel/ros2_intel_realsense.gitBuild package
source ~/ros2_ws/install/local_setup.bashsource /opt/intel/computer_vision_sdk/bin/setupvars.shexport OpenCV_DIR=$HOME/code/opencv/buildcd ~/ros2_overlay_wscolcon build --symlink-installsource ./install/local_setup.bashsudo mkdir -p /opt/openvino_toolkitsudo ln -sf ~/ros2_overlay_ws/src/ros2_openvino_toolkit /opt/openvino_toolkit/ros2_openvino_toolkit(10)Running the Demo
這里雖然是Running the Demo,但是不Running一下,OA就跑不起來,原因是這里會(huì)需要下一個(gè)model,而這些model也是OA需要的
download and convert a trained model to produce an optimized Intermediate Representation (IR) of the model
copy label files (excute once)
sudo cp /opt/openvino_toolkit/ros2_openvino_toolkit/data/labels/emotions-recognition/FP32/emotions-recognition-retail-0003.labels /opt/intel/computer_vision_sdk/deployment_tools/intel_models/emotions-recognition-retail-0003/FP32sudo cp /opt/openvino_toolkit/ros2_openvino_toolkit/data/labels/face_detection/face-detection-adas-0001.labels /opt/intel/computer_vision_sdk/deployment_tools/intel_models/face-detection-adas-0001/FP32sudo cp /opt/openvino_toolkit/ros2_openvino_toolkit/data/labels/face_detection/face-detection-adas-0001.labels /opt/intel/computer_vision_sdk/deployment_tools/intel_models/face-detection-adas-0001/FP16sudo cp /opt/openvino_toolkit/ros2_openvino_toolkit/data/labels/object_segmentation/frozen_inference_graph.labels ~/Downloads/models/mask_rcnn_inception_v2_coco_2018_01_28/outputsudo cp /opt/openvino_toolkit/ros2_openvino_toolkit/data/labels/object_detection/mobilenet-ssd.labels /opt/intel/computer_vision_sdk/deployment_tools/model_downloader/object_detection/common/mobilenet-ssd/caffe/output/FP32sudo cp /opt/openvino_toolkit/ros2_openvino_toolkit/data/labels/object_detection/mobilenet-ssd.labels /opt/intel/computer_vision_sdk/deployment_tools/model_downloader/object_detection/common/mobilenet-ssd/caffe/output/FP16set ENV LD_LIBRARY_PATH and environment
source /opt/intel/computer_vision_sdk/bin/setupvars.shexport LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/intel/computer_vision_sdk/deployment_tools/inference_engine/samples/build/intel64/Release/lib(11)Build ros2_object_analytics
# get code mkdir ~/ros2_ws/src -p cd ~/ros2_ws/src git clone https://github.com/intel/ros2_object_analytics.git -b devel (devel branch is the latest code with 2D tracking features, while master branch is stable for ros2 bloom release)# Build cd ~/ros2_ws source /opt/ros/crystal/setup.bash colcon build --symlink-install(12)Object Analytics with OpenVINO
# Start OA demo with OpenVINO source /opt/ros/crystal/setup.bash source ~/ros2_ws/install/local_setup.bash source /opt/intel/computer_vision_sdk/bin/setupvars.sh export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/intel/computer_vision_sdk/deployment_tools/inference_engine/samples/build/intel64/Release/libOption1: if ros2_openvino_toolkit built from source code ros2 launch object_analytics_node object_analytics_with_openvino_oss.launch.pyOption2: if ros2_openvino_toolkit got from Robotics_SDK ros2 launch object_analytics_node object_analytics_with_openvino_sdk.launch.py注意lanch之前前面四個(gè)必不可少的source和export,后兩個(gè)是和OpenVINO有關(guān)的。
然后
…
就成功啦!!!哈哈哈…
整個(gè)效果看上去還是非常牛逼的,到這一步算是裝好了,主要還是自己太菜,接下來終于可以開心地看源碼了~
總結(jié)
以上是生活随笔為你收集整理的ros2_object_analytics安装过程全记录的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 多视图几何总结——基础矩阵、本质矩阵和单
- 下一篇: 多视图几何总结——等距变换、相似变换、仿