일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
- anisotropicgaussianlearning #gaussiansplatting #nonisotropicrenderinㅎ
- siggraph #3dsceneunderstanding #highquality3drendering #fastrendering
- 3dcontentcreation
- 3dscanning #digitaltwintechnology #3dcontentcreation
- advancedrenderingtechniques #neuralscenerepresentation
- 3dsceneunderstanding #pointcloudrendering #neuralscenerepresentation
- splatrendering #3dpointcloud #differentiablerendering
- 3drenderingtools #pointcloudsoftware #3dvisualizationsoftware
- 3dscenerepresentation #covariancematrixoptimization #adaptivegaussians
- gaussiansplatting #3dgaussiansplatting #pointbasedrendering
- machinelearning3d #deeplearninggraphics #airendering
- turtlebot3 #터틀봇
- gpuacceleration #aigraphics #virtualreality #augmentedreality #gamedevelopment
- nextgengraphics #futureof3drendering #innovativerenderingtechniques
- computervisionresearch #3dreconstructiontechniques #graphicsresearch
- nerf (neural radiance fields) #3dreconstruction
- highfidelityreconstruction #sceneunderstanding #computationalgraphics
- nerf (neural radiance fields) #3dreconstruction #pointcloudrendering #volumerendering
- pointbasedrendering #computergraphics #3dmodeling #volumerendering
- computergraphics #3dmodeling #virtualreality #augmentedreality #gamedevelopment
- realtimerendering #highquality3d #fastrendering
- optimizationalgorithms
- differentiablerendering #machinelearning3d #deeplearninggraphics
- gaussianprojection #covariancematrix3d #anisotropicgaussians #ellipsoidalsplatting
- realtimerendering #machinelearning3d #deeplearninggraphics #computervision
- geometrylearning #shapeoptimization #gpuacceleration #realtimerendering
- anisotropickernels #ellipsoidalsplatting #orientedsplats #gradientbasedlearning
- 3dpointcloud #differentiablerendering #3dscenerepresentation #neuralrendering
- siggraphtechniques #aigraphics #3dmodelingalgorithms
- gaussiansplatting #3dgaussiancovariance #nerf #3dreconstruction
- Today
- Total
Wiredwisdom
USB 카메라 이미지를 Raspberry Pi에서 PC로 스트리밍 및 RViz에 표시하는 방법 본문
USB 카메라 이미지를 Raspberry Pi에서 PC로 스트리밍 및 RViz에 표시하는 방법
Duke_Wisdom 2024. 7. 8. 15:03Raspberry Pi 설정
1. Raspberry Pi에 ROS Noetic 설치
1.1 Ubuntu 20.04에 ROS Noetic을 설치합니다:
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
sudo apt update
sudo apt install ros-noetic-desktop-full
full 설치 안됨
이미 ros -noetic 은 기본 설치가 되었으므로 패스
1.2 ROS 의존성 초기화:
sudo rosdep init
rosdep update
rodep (ROS dependency) : 이 패키지들이 의존하는 다른 라이브러리나 패키지들의 설치를 관리하는 도구
sudo rosdep init : rosdep을 사용할 준비를 하기 위해 초기화 하는 명령어 (내부 rosdep 설치)
기본 설정 파일 생성 : 기본 설정 파일 생성 - 의존성 정보 포함
데이터베이스를 설정 : 패키지들과 라이브러리 정보
환경변수 설정: ROS 안정 동작, 의존성 패키지들 정상 설치 백업
rodep update : 데이터베이스 최신 상태 유지.
1.3 ROS 환경 변수를 셸에 추가:
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
echo: 화면에 텍스트를 출력하는 명령어입니다.
source /opt/ros/noetic/setup.bash : ROS 패키지와 환경 변수를 설정하기 위한 스크립트 파일의 경로
>> ~/.bashrc: 리다이렉션 연산자(>>)를 사용하여 /opt/ros/noetic/setup.bash의 내용을 ~/.bashrc 파일에 추가
~/.bashrc 파일은 사용자의 홈 디렉토리에 위치한 Bash shell 설정 파일로, 사용자가 로그인할 때마다 실행
source: 지정된 스크립트 파일을 현재 shell 환경에서 실행하는 명령어
~/.bashrc: 사용자의 홈 디렉토리에 위치한 Bash shell 설정 파일
1.4 빌드 도구 설치:
sudo apt install python3-rosinstall python3-rosinstall-generator python3-wstool build-essential
1.5 usb_cam 패키지 설치
USB 카메라에서 이미지를 캡처하기 위해 usb_cam 패키지를 설치합니다.
sudo apt-get install ros-noetic-usb-cam
1.6 ROS 워크스페이스 및 패키지 생성
워크스페이스가 없으면 생성합니다:
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/
catkin_make
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc
1. 작업 공간 디렉토리 생성
mkdir -p : -p 옵션은 부모 디렉토리가 없는 경우에도 디렉토리를 생성합니다.
~/catkin_ws/src : ~/는 홈 디렉토리를 의미하며, catkin_ws 디렉토리 아래에 src 디렉토리를 생성합니다.
src 디렉토리는 소스 코드가 저장될 곳입니다.
2. catkin_make을 통한 빌드
cd ~/catkin_ws/ : ~/catkin_ws/ 디렉토리로 이동합니다.
catkin_make : ROS 작업 공간을 빌드하고, 빌드 시스템을 설정합니다.
catkin_make는 ROS에서 사용하는 빌드 도구로, src 디렉토리에 있는 패키지들을 컴파일하고
실행 가능한 ROS 노드 및 라이브러리를 생성합니다.
3. 환경 변수 설정
ROS 패키지를 실행하거나 사용할 때마다 ROS 시스템에 대한 정보가 필요하므로,
~/.bashrc 파일에 ROS 환경 변수를 설정해야 합니다.
4. 환경 변수 적용
source ~/.bashrc : ~/.bashrc 파일을 다시 읽어서 적용합니다.
이 명령어를 실행하면 새로운 셸에서 설정한 ROS 환경 변수가 즉시 사용됩니다.
패키지 생성 (이미 패키지가 없는 경우):
cd ~/catkin_ws/src
catkin_create_pkg turtlebot3_custom rospy std_msgs sensor_msgs
cd ~/catkin_ws
catkin_make
source devel/setup.bash
1.7 USB 카메라를 위한 런치 파일 생성
~/catkin_ws/src/turtlebot3_custom/launch/에 usb_cam.launch 파일을 생성합니다:
mkdir -p ~/catkin_ws/src/turtlebot3_custom/launch
nano ~/catkin_ws/src/turtlebot3_custom/launch/usb_cam.launch
1. ROS 작업 공간 및 패키지 준비
먼저, ROS 작업 공간을 설정합니다. 이 예시에서는 catkin_ws 디렉토리를 사용하며, 이 디렉토리 내에 패키지를 생성하고 런치 파일을 저장할 디렉토리를 준비
mkdir -p : -p 옵션은 부모 디렉토리가 없는 경우에도 디렉토리를 생성합니다.
~/catkin_ws/src/turtlebot3_custom/launch : turtlebot3_custom 패키지의 launch 디렉토리를 생성합니다.
이 디렉토리는 런치 파일들이 저장될 곳입니다.
2. 런치 파일 생성
생성한 launch 디렉토리에 usb_cam.launch 파일을 생성합니다.
이 파일은 USB 카메라를 ROS에서 실행하기 위한 설정을 담고 있습니다.
nano : 텍스트 편집기 중 하나로, 콘솔에서 텍스트 파일을 수정할 수 있습니다.
~/catkin_ws/src/turtlebot3_custom/launch/usb_cam.launch : turtlebot3_custom 패키지의 launch 디렉토리에 usb_cam.launch 파일을 생성하고 엽니다.
usb_cam.launch에 다음 내용을 추가합니다
<launch>
<node name="usb_cam" pkg="usb_cam" type="usb_cam_node" output="screen">
<param name="video_device" value="/dev/video0" />
<param name="image_width" value="640" />
<param name="image_height" value="480" />
<param name="pixel_format" value="yuyv" />
<param name="camera_frame_id" value="usb_cam" />
</node>
</launch>
1.8 스트리밍 시작
USB 카메라 노드를 실행합니다:
roslaunch turtlebot3_custom usb_cam.launch
PC 설정
- PC에 ROS Noetic 설치
- PC에 ROS Noetic을 설치합니다.
- 네트워크 설정 구성
- Raspberry Pi와 PC가 같은 네트워크에 있고 서로 통신할 수 있는지 확인합니다. 두 머신 모두에 ~/.bashrc에 다음 줄을 추가합니다:
export ROS_MASTER_URI=http://<Raspberry_Pi_IP>:11311
export ROS_HOSTNAME=<Raspberry_Pi_IP> # 라즈베리파이에서
export ROS_HOSTNAME=<PC_IP> # PC에서
- <Raspberry_Pi_IP>와 <PC_IP>를 라즈베리파이와 PC의 실제 IP 주소로 교체합니다.
- ROS 설정 파일 소싱
source /opt/ros/noetic/setup.bash
source ~/catkin_ws/devel/setup.bash # PC에 워크스페이스가 있는 경우
RViz 실행
PC에서 RViz를 실행합니다:
rviz
RViz에서 이미지 표시
- RViz에서 "Add"를 클릭합니다.
- "By Topic"을 선택합니다.
- /usb_cam/image_raw 토픽을 확장합니다.
- "OK"를 클릭합니다.
'Autonomous Driving > Turtlebot3' 카테고리의 다른 글
LiDAR Base Coordinate & Convert (0) | 2024.07.08 |
---|---|
[depth_image_proc] package (0) | 2024.07.08 |
SLAM (0) | 2024.07.04 |
Ros Structure (0) | 2024.07.03 |
Sensor Fusion (0) | 2024.07.03 |