视觉SLAM算法出错

如果使用如下命令则报错

source /opt/tros/setup.bash

source /opt/tros/local_setup.bash




root@ubuntu:~# ros2 launch realsense2_camera rs_launch.py enable_depth:=false enable_color:=false enable_infra1:=true depth_module.profile:=640x480x15 
[INFO] [launch]: All log files can be found below /root/.ros/log/2023-05-26-14-09-03-777205-ubuntu-3597
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [realsense2_camera_node-1]: process started with pid [3599]
[realsense2_camera_node-1] terminate called after throwing an instance of 'class_loader::LibraryLoadException'
[realsense2_camera_node-1]   what():  Could not load library LoadLibrary error: librealsense2.so.2.51: cannot open shared object file: No such file or directory, at /mnt/disk1/zhuo.wang/cc_ws_dev/tros_ws/src/tros/rcutils/src/shared_library.c:84
[ERROR] [realsense2_camera_node-1]: process has died [pid 3599, exit code -6, cmd '/opt/tros/lib/realsense2_camera/realsense2_camera_node --ros-args --log-level info --ros-args -r __node:=camera -r __ns:=/camera --params-file /tmp/launch_params_os31o9zl'].

如果再

source /opt/ros/foxy/setup.bash
~ ❯ ros2 launch realsense2_camera rs_launch.py enable_depth:=false enable_color:=false enable_infra1:=true depth_module.profile:=640x480x15

[INFO] [launch]: All log files can be found below /root/.ros/log/2023-05-26-14-29-19-858746-ubuntu-5231
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [realsense2_camera_node-1]: process started with pid [5233]
[realsense2_camera_node-1] 2023-05-26 14:29:20.635 [RTPS_TRANSPORT_SHM Error] Failed init_port fastrtps_port7662: open_and_lock_file failed -> Function open_port_internal
[realsense2_camera_node-1] 2023-05-26 14:29:20.638 [RTPS_TRANSPORT_SHM Error] Failed init_port fastrtps_port7663: open_and_lock_file failed -> Function open_port_internal
[realsense2_camera_node-1] [INFO] [1685082560.765841119] [camera.camera]: RealSense ROS v4.51.1
[realsense2_camera_node-1] [INFO] [1685082560.766259815] [camera.camera]: Built with LibRealSense v2.51.1
[realsense2_camera_node-1] [INFO] [1685082560.766361010] [camera.camera]: Running with LibRealSense v2.51.1
[realsense2_camera_node-1] [INFO] [1685082560.813884707] [camera.camera]: Device with serial number 241122071291 was found.
[realsense2_camera_node-1] 
[realsense2_camera_node-1] [INFO] [1685082560.814062267] [camera.camera]: Device with physical ID /sys/devices/platform/soc/b2000000.usb/b2000000.dwc3/xhci-hcd.0.auto/usb2/2-1/2-1:1.0/video4linux/video8 was found.
[realsense2_camera_node-1] [INFO] [1685082560.814134549] [camera.camera]: Device with name Intel RealSense D435 was found.
[realsense2_camera_node-1] [INFO] [1685082560.816456329] [camera.camera]: Device with port number 2-1 was found.
[realsense2_camera_node-1] [INFO] [1685082560.816628723] [camera.camera]: Device USB type: 3.2
[realsense2_camera_node-1] [INFO] [1685082560.822808664] [camera.camera]: getParameters...
[realsense2_camera_node-1] [INFO] [1685082560.824350379] [camera.camera]: JSON file is not provided
[realsense2_camera_node-1] [INFO] [1685082560.824541895] [camera.camera]: Device Name: Intel RealSense D435
[realsense2_camera_node-1] [INFO] [1685082560.824654672] [camera.camera]: Device Serial No: 241122071291
[realsense2_camera_node-1] [INFO] [1685082560.824758409] [camera.camera]: Device physical port: /sys/devices/platform/soc/b2000000.usb/b2000000.dwc3/xhci-hcd.0.auto/usb2/2-1/2-1:1.0/video4linux/video8
[realsense2_camera_node-1] [INFO] [1685082560.824850897] [camera.camera]: Device FW version: 05.13.00.55
[realsense2_camera_node-1] [INFO] [1685082560.824938635] [camera.camera]: Device Product ID: 0x0B07
[realsense2_camera_node-1] [INFO] [1685082560.825023332] [camera.camera]: Sync Mode: Off
[realsense2_camera_node-1] [WARN] [1685082560.864837663] [camera.camera]: re-enable the stream for the change to take effect.
[realsense2_camera_node-1] [INFO] [1685082560.911460145] [camera.camera]: Set ROS param rgb_camera.profile to default: 640x480x30
[realsense2_camera_node-1] [INFO] [1685082560.944055587] [camera.camera]: Stopping Sensor: Stereo Module
[realsense2_camera_node-1] [INFO] [1685082561.002505521] [camera.camera]: Starting Sensor: Stereo Module
[realsense2_camera_node-1] [INFO] [1685082561.064656334] [camera.camera]: Open profile: stream_type: Infra(1), Format: Y8, Width: 640, Height: 480, FPS: 15
[realsense2_camera_node-1] [INFO] [1685082561.069720757] [camera.camera]: RealSense Node Is Up!
[realsense2_camera_node-1] [WARN] [1685082561.198436349] [camera.camera]: 

貌似可以运行但看不到节点-
ros2 topic list 看不到

检查了下应该是 TROS 和 ROS2(FOXY)之间的冲突导致的

我想请问一下 我需要 real sense节点发布图像 codec 进行格式转换 body detect 进行关键点识别 这种情况应该怎么处理

运行前要先:

source /opt/ros/foxy/setup.bash

然后:

source /opt/tros/setup.bash 

运行程序:

ros2 launch realsense2_camera rs_launch.py enable_depth:=false enable_color:=false enable_infra1:=true depth_module.profile:=640x480x15

安装RealSense相关包后再次执行创建软链接命令

cd /opt/tros## 使用/opt/tros目录下的create_soft_link.py创建ROS package至tros.b的软连接sudo python3 create_soft_link.py --foxy /opt/ros/foxy/ --tros /opt/tros/

在/opt目录下使用find命令查找一下librealsense2.so.2.51这个库存在不?

/opt/tros ❯ ros2 launch realsense2_camera rs_launch.py enable_depth:=false enable_color:=true       5s root@ubuntu 14:52:46[INFO] [launch]: All log files can be found below /root/.ros/log/2023-05-26-14-52-58-986080-ubuntu-8989[INFO] [launch]: Default logging verbosity is set to INFO[INFO] [realsense2_camera_node-1]: process started with pid [8991][realsense2_camera_node-1] terminate called after throwing an instance of 'class_loader::LibraryLoadException'[realsense2_camera_node-1]   what():  Could not load library LoadLibrary error: librealsense2.so.2.51: cannot open shared object file: No such file or directory, at /mnt/disk1/zhuo.wang/cc_ws_dev/tros_ws/src/tros/rcutils/src/shared_library.c:84[ERROR] [realsense2_camera_node-1]: process has died [pid 8991, exit code -6, cmd '/opt/tros/lib/realsense2_camera/realsense2_camera_node --ros-args --log-level info --ros-args -r __node:=camera -r __ns:=/camera --params-file /tmp/launch_params_et6vvo07'].