Software Backend/ros2

oak-d camera & ros2 설치 및 영상 출력

light_meal 2023. 3. 18. 11:07
728x90

소프트웨어 설치

  • 소스 설치
sudo wget -qO- <https://raw.githubusercontent.com/luxonis/depthai-ros/main/install_dependencies.sh> | sudo bash
sudo apt install libopencv-dev
sudo apt install python-rosdep 
# 또는
sudo apt install python3-rosdep

 

  • 로스뎁 초기화
sudo rosdep init

 

  • 에러 발생
ERROR: default sources list file already exists:
	/etc/ros/rosdep/sources.list.d/20-default.list
Please delete if you wish to re-initialize

 

  • 해결방법
sudo rm /etc/ros/rosdep/sources.list.d/20-default.list

 

  • 로스뎁 업데이트
rosdep update

 

설정

  • 설정하기 위한 설치 cmake 버전 >= 3.10.2 및 OpenCV 버전 >= 4.0.0
apt update
apt install cmake python3-pip
pip3 install opencv-python

 

  • 설정
mkdir -p dai_ws/src
cd dai_ws/src
git clone <https://github.com/luxonis/depthai-ros.git>
cd ../..
rosdep install --from-paths src --ignore-src -r -y
# 에러 발생시 rosdep install -i --from-path src --rosdistro foxy -y --os=ubuntu:mint

# ex) source /opt/ros/foxy/setup.bash
source /opt/ros//setup.bash

colcon build
source install/setup.bash

 

  • start example
cd dai_ws (Our workspace)
source install/setup.bash
ros2 launch depthai_examples stereo_inertial_node.launch.py

 

OAK-D Install & Run

  • Check MyriadX
lsusb | grep MyriadX

 

  • Download directory
git clone <https://github.com/luxonis/depthai.git>

 

  • install
apt-get install python3-pip python3-venv
cd depthai
python3 -m venv venv
source venv/bin/activate
pip install -U pip
python3 install_requirements.py

 

  • run
python3 depthai_demo.py
728x90