
realsense-viewer 작동시키기 및 기본 환경 구성하기
sudo apt-get update
sudo apt-get install git libssl-dev libusb-1.0-0-dev pkg-config libgtk-3-dev cmake
workspace로 이동
git clone <https://github.com/IntelRealSense/librealsense.git>
cd librealsense
git fetch --all --tags
git checkout v2.50.0
(이때, build파일있다면 제거하고 다시)
mkdir build && cd build
cmake ..
## -> 이 경고는 무시해도 괜찮음 이 버전에서 생기는 오류로 보임
CMake Warning (dev) at /usr/share/cmake-3.22/Modules/FindOpenGL.cmake:315 (message):
Policy CMP0072 is not set: FindOpenGL prefers GLVND by default when
available. Run "cmake --help-policy CMP0072" for policy details. Use the
cmake_policy command to set the policy and suppress this warning.
FindOpenGL found both a legacy GL library:
OPENGL_gl_LIBRARY: /usr/lib/x86_64-linux-gnu/libGL.so
and GLVND libraries for OpenGL and GLX:
OPENGL_opengl_LIBRARY: /usr/lib/x86_64-linux-gnu/libOpenGL.so
OPENGL_glx_LIBRARY: /usr/lib/x86_64-linux-gnu/libGLX.so
OpenGL_GL_PREFERENCE has not been set to "GLVND" or "LEGACY", so for
compatibility with CMake 3.10 and below the legacy GL library will be used.
Call Stack (most recent call first):
CMake/opengl_config.cmake:1 (find_package)
tools/CMakeLists.txt:32 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
###
make -j$(nproc)
sudo make install
한칸 아래로 올라와서
sudo cp config/99-realsense-libusb.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules
sudo udevadm trigger
realsense-viewer
realsense에서 imu데이터 뽑기
git clone <https://github.com/IntelRealSense/realsense-ros.git> -b ros2-development
cd realsense-ros
git fetch --tags
git checkout tags/3.2.0 -b v3.2.0 //이렇게 버전 맞게설정
ros2_ws 폴더라인까지 올라와서
rosdep update
rosdep install --from-paths src --ignore-src -r -y
ros2 launch realsense2_camera rs_launch.py
CMAKE error
CMake Error at CMakeLists.txt:134 (message): Unsupported ROS Distribution: humble
라고 뜨면서 humble 지원안한다고 한다. 이거 아래와 같이 수정바람.
해당하는 부분의 Cmake중에서
if(NOT DEFINED ENV{ROS_DISTRO})
message(FATAL_ERROR "ROS_DISTRO is not defined." )
endif()
if("$ENV{ROS_DISTRO}" STREQUAL "dashing")
...
elseif("$ENV{ROS_DISTRO}" STREQUAL "eloquent")
...
elseif("$ENV{ROS_DISTRO}" STREQUAL "foxy")
...
else()
message(FATAL_ERROR "Unsupported ROS Distribution: " "$ENV{ROS_DISTRO}")
endif()
이부분이 있을 것이다. 이를 아래에 코드를 추가해서 가능하게 수정
elseif("$ENV{ROS_DISTRO}" STREQUAL "humble")
message(STATUS "Build for ROS2 Humble")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DFOXY") # 보통 foxy와 호환
set(SOURCES "${SOURCES}" src/ros_param_backend_foxy.cpp)
를 추가해서 humble도 동일하게 해주자.
Permission denied error 이건 가볍게 무시 ㅋ
/sbin/ldconfig.real: Can't create temporary cache file /etc/ld.so.cache~: Permission denied
/sbin/ldconfig.real: Can't create temporary cache file /etc/ld.so.cache~: Permission denied
base_realsense_node error
foxy로 맞춰진 노드이다보니, 이에 따라 문법적 규칙차이로 인한 에러가 있다. 아래와 같이 수정해주자.
ROS_WARN(msg); 를 ROS_WARN(msg.c_str());rclcpp::Duration(elapsed_camera_ns) 를 return rclcpp::Time(_ros_time_base + rclcpp::Duration(std::chrono::nanoseconds(static_cast<int64_t>(elapsed_camera_ns))));#include <algorithm> 추가