1.カメラを起動します
参照:UbuntuでのZED2SDKの使用法と開発環境の構成\
1.1CUDAダウンロード
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/10.2/Prod/local_installers/cuda-repo-ubuntu1804-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1804-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb
sudo apt-key add /var/cuda-repo-10-2-local-10.2.89-440.33.01/7fa2af80.pub
sudo apt-get update
sudo apt-get -y install cuda
./bashrcファイルを変更します
sudo gedit ./bashrc
最後に追加
export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64
更新する
source ./bashrc
1.2 SDK
SDK
をインストールする際は、SDKとcudaのバージョンの対応に注意してください。また、SDKのバージョンが古く、rosラッパーが新しい場合、rosラッパーのコンパイル時にエラーが報告されることがあります。
cd ~/下载
chmod +x ZED_SDK_Ubuntu18_cuda10.2_v3.5.0.run
./ZED_SDK_Ubuntu18_cuda10.2_v3.5.0.run
エラー1:一部の依存関係が欠落していてインストールされていません
解決策:依存関係を直接インストールするだけです
エラー2:Python APIのインストールに失敗しました
解決策:Pythonのデフォルトバージョンがpython3
確認バージョンであるかどうかを確認します
update-alternatives --list python
エラーが報告された場合:update-alternatives:error:pythonの代替はありません
、それから更新してください。私はubuntu18.04システム、python3.6です。あなた自身のpythonバージョンに注意してください。
update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
update-alternatives --install /usr/bin/python python /usr/bin/python3.6 2
Pythonバージョンのリスト
update-alternatives --list python
Pythonのデフォルトバージョンを変更する
sudo update-alternatives --config python
それでも失敗する場合は、PythonAPIのインストールの詳細
を参照して使用してください
sudo wget -qO- https://cdn.jsdelivr.net/gh/OAKChina/depthai-docs-website@develop/source/_static/install_dependencies.sh | bash
次に、SDKをインストールします。
zed2をテスト実行します。
cd /usr/local/zed/tools
./ZED_Depth_Viewer
ここではエラーを報告しませんでしたが、開いたインターフェイスが黒く、カメラに何も表示されませんでした。zedに付属のプログラムによって検出され、プロセッサが検出できなかったとだけ表示されました。しばらく投げても問題は解決しませんでしたが、ROSでzed2カメラの電源が入ったままでした。つまり、次の方法です。
cd ~/catkin_ws/src
git clone https://github.com/stereolabs/zed-ros-examples.git
cd ../
rosdep install --from-paths src --ignore-src -r -y
catkin_make -DCMAKE_BUILD_TYPE=Release
source ./devel/setup.bash
走る
roslaunch zed_display_rviz display_zed.launch
これで、rvizで結果を確認できます。
1.3ROSでのZEDの使用
cd ~/zed_calibra_ws/src
git clone https://github.com/stereolabs/zed-ros-wrapper.git
cd ..
rosdep install --from-paths src --ignore-src -r -y
catkin_make -DCMAKE_BUILD_TYPE=Release
source ./devel/setup.bash
zed2を実行します
roslaunch zed_wrapper zed2.launch
エラーを報告する
[ INFO] [1619503452.320965252]: Initializing nodelet with 4 worker threads.
[ERROR] [1619503452.339945481]: Failed to load nodelet [/zed2/zed_node] of type [zed_nodelets/ZEDWrapperNodelet] even after refreshing the cache: Failed to load library /home/willingham/zed_calibra_ws/devel/lib//libZEDNodelets.so. Make sure that you are calling the PLUGINLIB_EXPORT_CLASS macro in the library code, and that names are consistent between this macro and your XML. Error string: Could not load library (Poco exception = libturbojpeg.so.0: cannot open shared object file: No such file or directory)
[ERROR] [1619503452.339982271]: The error before refreshing the cache was: Failed to load library /home/willingham/zed_calibra_ws/devel/lib//libZEDNodelets.so. Make sure that you are calling the PLUGINLIB_EXPORT_CLASS macro in the library code, and that names are consistent between this macro and your XML. Error string: Could not load library (Poco exception = libturbojpeg.so.0: cannot open shared object file: No such file or directory)
解決策:長い間チェックした後、解決しませんでした。再インストールしたところ、SDKの警告を無視していることに気づきました。これはとんでもないことでした。python apiを再インストールし、SDKを正常にインストールし、zed2を正常に実行しました。
2.キャリブレーション
kalibrをインストールする
依存関係をインストールする
sudo apt-get install python-setuptools python-rosinstall ipython libeigen3-dev libboost-all-dev doxygen libopencv-dev ros-melodic-vision-opencv ros-melodic-image-transport-plugins ros-melodic-cmake-modules software-properties-common libpoco-dev python-matplotlib python-scipy python-git python-pip ipython libtbb-dev libblas-dev liblapack-dev python-catkin-tools libv4l-dev
そのうちの3つは注意が必要なバージョンです。私は修正されたメロディックで、1つはpython-software-propertiesです。18.04はもう使用されていないと言われています。
このステップはそれほど嫌なことではありませんが、依存関係が不足しています。パッケージのダウングレードには注意を払いませんでしたが、ROSメロディックなどを含む588個のパッケージが削除されたようです。直接バーストします。
sudo pip install python-igraph --upgrade
エラーが報告された場合は、通常、Pythonバージョンの問題が原因であるため、自分で切り替えてください。
ここでのインストールの失敗は、後でカメラパラメータの計算に影響します。私のpython3.6はインストールされておらず、2.7は次のようにインストールされています。
sudo add-apt-repository ppa:igraph/ppa
sudo apt-get update #虽然这步更新的时候显示错误但是下面还是安装成功了,具体原因我也不清楚,但是总算安上了
sudo apt-get install python-igraph
mkdir -p ~/kalibr_workspace/src
cd ~/kalibr_workspace
source /opt/ros/melodic/setup.bash
catkin init
catkin config --extend /opt/ros/melodic
catkin config --merge-devel # Necessary for catkin_tools >= 0.4.
catkin config --cmake-args -DCMAKE_BUILD_TYPE=Release
cd src
git clone https://github.com/ethz-asl/Kalibr.git
コンパイル
cd ..
catkin build -DCMAKE_BUILD_TYPE=Release -j4
コンパイルエラー:suitesparseエラー、この問題
のソースを確認できます
source ~/zed_ws/devel/setup.bash
zed2カメラを起動します
roslaunch zed_wrapper zed2.launch
左右のカメラ可視化機能を起動しますが、問題があります。インターネット上のすべてのコードがこのコードです。兄にも聞いたところ、エラーは報告されていませんが、ノード名が繰り返されていることがわかりました。そこで、ノード名を
元の名前に変更しました。
rosrun image_view image_view image:=/zed2/zed_node/left/image_rect_color & rosrun image_view image_view image:=/zed2/zed_node/right/image_rect_color
変化する:
rosrun image_view image_view __ns:=view1 image:=/zed2/zed_node/left/image_rect_color & rosrun image_view image_view __ns:=view2 image:=/zed2/zed_node/right/image_rect_color
Kalibrには、20Hzに下げることができる記録周波数の要件があります
rosrun topic_tools throttle messages /zed2/zed_node/left/image_rect_color 20 /zed2/zed_node/left/image_rect_color2
rosrun topic_tools throttle messages /zed2/zed_node/right/image_rect_color 20 /zed2/zed_node/right/image_rect_color2
パケットを記録する
rosbag record -O Kalibr_data.bag /zed2/zed_node/imu/data_raw /zed2/zed_node/left/image_rect_color /zed2/zed_node/right/image_rect_color
記録されたデータを表示する
rosbag info Kalibr_data.bag
カメラパラメータを取得する
kalibr_calibrate_cameras --bag Kalibr_data.bag --topics /zed2/zed_node/left/image_rect_color /zed2/zed_node/right/image_rect_color --models pinhole-radtan pinhole-radtan --target april_6x6_50x50cm.yaml
上記のapril_6x6_50x50cm.yamlの私のパラメーターは
target_type: 'aprilgrid' #gridtype
tagCols: 6 #number of apriltags
tagRows: 6 #number of apriltags
tagSize: 0.035 #size of apriltag, edge to edge [m]
tagSpacing: 0.285714 #ratio of space between tags to tagSize