要实现多realsense相机视频录制,需要用到多线程,决定使用ROS
Windows 10安装realsense-ros比Ubuntu安装realsense-ros要复杂一些。
首先按照教程在Windows 10上安装ROS 1?
Step 1: Install the ROS distribution
Step 2: to install realsense2_camera
????????Method 2: The RealSense? distribution:
????????????????Step 1: Install the latest Intel? RealSense? SDK 2.0
vcpkg install realsense2:x64-windows
我安装的是ros noetic版本,自带的vcpkg工具,默认安装realsense2 v 2.34.0 现在一直这个版本有问题,vcpkg安装软件不支持选择版本,可以通过更改vcpkg版本,解决安装的realsense2的版本,通过官网安装最新版vcpkg,替换C:\opt\ros\noetic\x64\tools\vcpkg目录下得vcpkg 工具。
使用下面命令vcpkg search realsense 查看当前版本vcpkg 对应的realsense版本,我安装时最新版vcpkg对应的realsense版本为2.42.0,对应的realsense-ros版本为2.2.22。
????????????????Step 2: Install Intel? RealSense? ROS from Sources
mkdir c:\catkin_ws\src
cd c:\catkin_ws\src
?
git clone https://github.com/IntelRealSense/realsense-ros.git
cd realsense-ros/
git checkout 2.2.22
cd ..
?下载ddynamic_reconfigure?
https://github.com/pal-robotics/ddynamic_reconfigure/tree/kinetic-devel
在网页上直接Download ZIP,然后解压到C:\catkin_ws\src下面,并把文件夹名修改为如下图。
?
catkin_init_workspace
cd ..
catkin_make clean
catkin_make -DCATKIN_ENABLE_TESTING=False -DCMAKE_BUILD_TYPE=Release
catkin_make install
激活环境:
devel\setup.bat
Start the camera node
To start the camera node in ROS:
roslaunch realsense2_camera rs_camera.launch
启动一个新ros终端使用rostopic list 命令可以查看当前发布了哪些topic
使用rviz工具可以实时查看相机图像。
结果展示:
roslaunch日志:
c:\catkin_ws>roslaunch realsense2_camera rs_camera.launch
... logging to C:\Users\IME\.ros\log\70b32e3d-13c1-11ec-804a-8cec4b7d9227\roslaunch-DESKTOP-SI41QI1-15644.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server http://127.0.0.1:50422/
SUMMARY
========
PARAMETERS
* /camera/realsense2_camera/accel_fps: -1
* /camera/realsense2_camera/accel_frame_id: camera_accel_frame
* /camera/realsense2_camera/accel_optical_frame_id: camera_accel_opti...
* /camera/realsense2_camera/align_depth: False
* /camera/realsense2_camera/aligned_depth_to_color_frame_id: camera_aligned_de...
* /camera/realsense2_camera/aligned_depth_to_fisheye1_frame_id: camera_aligned_de...
* /camera/realsense2_camera/aligned_depth_to_fisheye2_frame_id: camera_aligned_de...
* /camera/realsense2_camera/aligned_depth_to_fisheye_frame_id: camera_aligned_de...
* /camera/realsense2_camera/aligned_depth_to_infra1_frame_id: camera_aligned_de...
* /camera/realsense2_camera/aligned_depth_to_infra2_frame_id: camera_aligned_de...
* /camera/realsense2_camera/allow_no_texture_points: False
* /camera/realsense2_camera/base_frame_id: camera_link
* /camera/realsense2_camera/calib_odom_file:
* /camera/realsense2_camera/clip_distance: -2.0
* /camera/realsense2_camera/color_fps: -1
* /camera/realsense2_camera/color_frame_id: camera_color_frame
* /camera/realsense2_camera/color_height: -1
* /camera/realsense2_camera/color_optical_frame_id: camera_color_opti...
* /camera/realsense2_camera/color_width: -1
* /camera/realsense2_camera/confidence_fps: -1
* /camera/realsense2_camera/confidence_height: -1
* /camera/realsense2_camera/confidence_width: -1
* /camera/realsense2_camera/depth_fps: -1
* /camera/realsense2_camera/depth_frame_id: camera_depth_frame
* /camera/realsense2_camera/depth_height: -1
* /camera/realsense2_camera/depth_optical_frame_id: camera_depth_opti...
* /camera/realsense2_camera/depth_width: -1
* /camera/realsense2_camera/device_type:
* /camera/realsense2_camera/enable_accel: False
* /camera/realsense2_camera/enable_color: True
* /camera/realsense2_camera/enable_confidence: True
* /camera/realsense2_camera/enable_depth: True
* /camera/realsense2_camera/enable_fisheye1: False
* /camera/realsense2_camera/enable_fisheye2: False
* /camera/realsense2_camera/enable_fisheye: False
* /camera/realsense2_camera/enable_gyro: False
* /camera/realsense2_camera/enable_infra1: False
* /camera/realsense2_camera/enable_infra2: False
* /camera/realsense2_camera/enable_infra: False
* /camera/realsense2_camera/enable_pointcloud: False
* /camera/realsense2_camera/enable_pose: False
* /camera/realsense2_camera/enable_sync: False
* /camera/realsense2_camera/filters:
* /camera/realsense2_camera/fisheye1_frame_id: camera_fisheye1_f...
* /camera/realsense2_camera/fisheye1_optical_frame_id: camera_fisheye1_o...
* /camera/realsense2_camera/fisheye2_frame_id: camera_fisheye2_f...
* /camera/realsense2_camera/fisheye2_optical_frame_id: camera_fisheye2_o...
* /camera/realsense2_camera/fisheye_fps: -1
* /camera/realsense2_camera/fisheye_frame_id: camera_fisheye_frame
* /camera/realsense2_camera/fisheye_height: -1
* /camera/realsense2_camera/fisheye_optical_frame_id: camera_fisheye_op...
* /camera/realsense2_camera/fisheye_width: -1
* /camera/realsense2_camera/gyro_fps: -1
* /camera/realsense2_camera/gyro_frame_id: camera_gyro_frame
* /camera/realsense2_camera/gyro_optical_frame_id: camera_gyro_optic...
* /camera/realsense2_camera/imu_optical_frame_id: camera_imu_optica...
* /camera/realsense2_camera/infra1_frame_id: camera_infra1_frame
* /camera/realsense2_camera/infra1_optical_frame_id: camera_infra1_opt...
* /camera/realsense2_camera/infra2_frame_id: camera_infra2_frame
* /camera/realsense2_camera/infra2_optical_frame_id: camera_infra2_opt...
* /camera/realsense2_camera/infra_fps: -1
* /camera/realsense2_camera/infra_height: -1
* /camera/realsense2_camera/infra_rgb: False
* /camera/realsense2_camera/infra_width: -1
* /camera/realsense2_camera/initial_reset: False
* /camera/realsense2_camera/json_file_path:
* /camera/realsense2_camera/linear_accel_cov: 0.01
* /camera/realsense2_camera/odom_frame_id: camera_odom_frame
* /camera/realsense2_camera/ordered_pc: False
* /camera/realsense2_camera/pointcloud_texture_index: 0
* /camera/realsense2_camera/pointcloud_texture_stream: RS2_STREAM_COLOR
* /camera/realsense2_camera/pose_frame_id: camera_pose_frame
* /camera/realsense2_camera/pose_optical_frame_id: camera_pose_optic...
* /camera/realsense2_camera/publish_odom_tf: True
* /camera/realsense2_camera/publish_tf: True
* /camera/realsense2_camera/rosbag_filename:
* /camera/realsense2_camera/serial_no:
* /camera/realsense2_camera/tf_publish_rate: 0.0
* /camera/realsense2_camera/topic_odom_in: odom_in
* /camera/realsense2_camera/unite_imu_method:
* /camera/realsense2_camera/usb_port_id:
* /rosdistro: noetic
* /rosversion: 1.15.9
NODES
/camera/
realsense2_camera (nodelet/nodelet)
realsense2_camera_manager (nodelet/nodelet)
auto-starting new master
process[master]: started with pid [12092]
ROS_MASTER_URI=http://127.0.0.1:11311
setting /run_id to 70b32e3d-13c1-11ec-804a-8cec4b7d9227
process[rosout-1]: started with pid [16120]
started core service [/rosout]
process[camera/realsense2_camera_manager-2]: started with pid [17824]
process[camera/realsense2_camera-3]: started with pid [3640]
[ERROR] [1631448214.717357700]: Skipped loading plugin with error: XML Document 'c:\opt\ros\noetic\x64\share\test_nodelet_topic_tools/test/test_nodelets.xml' has no Root Element. This likely means the XML is malformed or missing..
[ERROR] [1631448214.717722900]: Skipped loading plugin with error: XML Document 'c:\opt\ros\noetic\x64\share\test_nodelet/test_nodelet.xml' has no Root Element. This likely means the XML is malformed or missing..
[ INFO] [1631448214.730791700]: Initializing nodelet with 8 worker threads.
[ INFO] [1631448215.012386700]: RealSense ROS v2.2.22
[ INFO] [1631448215.012636500]: Built with LibRealSense v2.42.0
[ INFO] [1631448215.013698300]: Running with LibRealSense v2.42.0
[ INFO] [1631448215.054243700]:
[ INFO] [1631448215.390062900]: Device with serial number 025522062091 was found.
[ INFO] [1631448215.390289500]: Device with physical ID \\?\usb#vid_8086&pid_0ad3&mi_00#6&114a0d1f&0&0000#{e5323777-f976-4f5b-9b55-b94699c46e44}\global was found.
[ INFO] [1631448215.391172400]: Device with name Intel RealSense D415 was found.
[ WARN] [1631448215.391729000]: Error extracting usb port from device with physical ID: \\?\usb#vid_8086&pid_0ad3&mi_00#6&114a0d1f&0&0000#{e5323777-f976-4f5b-9b55-b94699c46e44}\global
Please report on github issue at https://github.com/IntelRealSense/realsense-ros
[ INFO] [1631448215.392044300]: Device USB type: 3.2
[ INFO] [1631448215.394284900]: getParameters...
[ INFO] [1631448215.488541900]: setupDevice...
[ INFO] [1631448215.488764600]: JSON file is not provided
[ INFO] [1631448215.489762600]: ROS Node Namespace: camera
[ INFO] [1631448215.491575400]: Device Name: Intel RealSense D415
[ INFO] [1631448215.491945900]: Device Serial No: 025522062091
[ INFO] [1631448215.492179300]: Device physical port: \\?\usb#vid_8086&pid_0ad3&mi_00#6&114a0d1f&0&0000#{e5323777-f976-4f5b-9b55-b94699c46e44}\global
[ INFO] [1631448215.492581700]: Device FW version: 05.12.15.50
[ INFO] [1631448215.492786100]: Device Product ID: 0x0AD3
[ INFO] [1631448215.493131300]: Enable PointCloud: Off
[ INFO] [1631448215.493395100]: Align Depth: Off
[ INFO] [1631448215.493586000]: Sync Mode: Off
[ INFO] [1631448215.493929000]: Device Sensors:
[ INFO] [1631448215.547986400]: Stereo Module was found.
[ INFO] [1631448215.584185000]: RGB Camera was found.
[ INFO] [1631448215.584841700]: (Confidence, 0) sensor isn't supported by current device! -- Skipping...
[ INFO] [1631448215.586316100]: num_filters: 0
[ INFO] [1631448215.587014200]: Setting Dynamic reconfig parameters.
[ INFO] [1631448218.364607200]: Done Setting Dynamic reconfig parameters.
[ INFO] [1631448218.365826600]: depth stream is enabled - width: 1280, height: 720, fps: 30, Format: Z16
[ INFO] [1631448218.366719300]: color stream is enabled - width: 1280, height: 720, fps: 30, Format: RGB8
[ INFO] [1631448218.366916900]: setupPublishers...
[ INFO] [1631448218.370861300]: Expected frequency for depth = 30.00000
[ INFO] [1631448218.396451400]: Expected frequency for color = 30.00000
[ INFO] [1631448218.415688200]: setupStreams...
[ INFO] [1631448218.493543800]: insert Depth to Stereo Module
[ INFO] [1631448218.493726700]: insert Color to RGB Camera
[ INFO] [1631448218.679498100]: SELECTED BASE:Depth, 0
[ INFO] [1631448218.697409700]: RealSense Node Is Up!
[ WARN] [1631448218.818102000]:
[ WARN] [1631448220.414026900]: Hardware Notification:Depth stream start failure,1.63145e+12,Error,Hardware Error
12/09 20:04:38,398 ERROR [14368] (ds5-options.cpp:86) Asic Temperature value is not valid!
12/09 20:04:39,411 ERROR [14368] (ds5-options.cpp:86) Asic Temperature value is not valid!
12/09 20:04:40,427 ERROR [14368] (ds5-options.cpp:86) Asic Temperature value is not valid!
?rviz 日志:
C:\Windows\System32>rostopic list
/camera/color/camera_info
/camera/color/image_raw
/camera/color/image_raw/compressed
/camera/color/image_raw/compressed/parameter_descriptions
/camera/color/image_raw/compressed/parameter_updates
/camera/color/image_raw/compressedDepth
/camera/color/image_raw/compressedDepth/parameter_descriptions
/camera/color/image_raw/compressedDepth/parameter_updates
/camera/depth/camera_info
/camera/depth/image_rect_raw
/camera/depth/image_rect_raw/compressed
/camera/depth/image_rect_raw/compressed/parameter_descriptions
/camera/depth/image_rect_raw/compressed/parameter_updates
/camera/depth/image_rect_raw/compressedDepth
/camera/depth/image_rect_raw/compressedDepth/parameter_descriptions
/camera/depth/image_rect_raw/compressedDepth/parameter_updates
/camera/extrinsics/depth_to_color
/camera/realsense2_camera_manager/bond
/camera/rgb_camera/auto_exposure_roi/parameter_descriptions
/camera/rgb_camera/auto_exposure_roi/parameter_updates
/camera/rgb_camera/parameter_descriptions
/camera/rgb_camera/parameter_updates
/camera/stereo_module/auto_exposure_roi/parameter_descriptions
/camera/stereo_module/auto_exposure_roi/parameter_updates
/camera/stereo_module/parameter_descriptions
/camera/stereo_module/parameter_updates
/diagnostics
/rosout
/rosout_agg
/tf
/tf_static
C:\Windows\System32>rviz
[ INFO] [1631430467.583476600]: rviz version 1.14.4
[ INFO] [1631430467.596688900]: compiled against Qt version 5.15.0
[ INFO] [1631430467.596937000]: compiled against OGRE version 1.12.7 (Rhagorthua)
[ INFO] [1631430467.622766800]: Forcing OpenGl version 0.
[ INFO] [1631430478.436704600]: Stereo is NOT SUPPORTED
[ INFO] [1631430478.437623900]: OpenGl version: 4.6 (GLSL 4.6).
[ERROR] [1631430480.561072400]: rviz/glsl120/black.frag
GLSL link result :
Validation successful.
[ERROR] [1631430480.608051800]: Error prior to using GLSL Program Object : GL_INVALID_OPERATION
Validation successful.
[ERROR] [1631430480.613912200]: Error prior to using GLSL Program Object : GL_INVALID_OPERATION
?
参考文献:
1.https://github.com/IntelRealSense/realsense-ros
2.https://github.com/microsoft/vcpkg
3.ERROR [5016] (types.h:307) get_device_time_ms() took too long · Issue #1509 · IntelRealSense/realsense-ros · GitHub
4.Git报错解决:OpenSSL SSL_read: Connection was reset, errno 10054
|