下载库 网址: jiangchao / ros2_astra_camera · GitLab
● Install dependencies
sudo apt-get install ros-foxy-camera-info-manager
sudo apt-get install ros-foxy-cv-bridge
sudo apt-get install ros-foxy-image-geometry
apt install udev
sudo apt install libgflags-dev nlohmann-json3-dev \
ros-foxy-image-transport ros-foxy-image-publisher
● Install glog
wget -c https://github.com/google/glog/archive/refs/tags/v0.6.0.tar.gz -O glog-0.6.0.tar.gz
tar -xzvf glog-0.6.0.tar.gz
cd glog-0.6.0
mkdir build && cd build
cmake .. && make -j4
sudo make install
sudo ldconfig # Refreshing the link library
● Install magic_enum
wget -c https://github.com/Neargye/magic_enum/archive/refs/tags/v0.8.0.tar.gz -O magic_enum-0.8.0.tar.gz
tar -xzvf magic_enum-0.8.0.tar.gz
cd magic_enum-0.8.0
mkdir build && cd build
cmake .. && make -j4
sudo make install
sudo ldconfig
● Install libuvc
git clone https://github.com/libuvc/libuvc.git
cd libuvc
mkdir build && cd build
cmake .. && make -j4
sudo make install
sudo ldconfig # Refreshing the link library
● Install usb-drive
apt-get install libusb-1.0-0-dev
● Create a new ros2 workspace ,下载代码
mkdir -p ~/ros2_ws/src
cd ~/ros2_ws/src/
git clone http://10.0.1.65/15988821760/ros2_astra_camera.git
sudo bash install.sh
sudo udevadm control --reload-rules && sudo udevadm trigger
● Compiling
cd ~/ros2_ws
source /opt/ros/foxy/setup.bash
colcon build
Starting the camera
ros2 launch astra_camera dabai.launch.py
CMake Error at CMakeLists.txt:19 (find_package):
By not providing "Findcamera_info_manager.cmake" in CMAKE_MODULE_PATH this
project has asked CMake to find a package configuration file provided by
"camera_info_manager", but CMake did not find one.
Could not find a package configuration file provided by
"camera_info_manager" with any of the following names:
camera_info_managerConfig.cmake
camera_info_manager-config.cmake
sudo apt-get install ros-foxy-camera-info-manager
sudo apt-get install ros-foxy-cv-bridge
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install ros-foxy-image-geometry
Could not find a package configuration file provided by "image_publisher"
with any of the following names:
image_publisherConfig.cmake
image_publisher-config.cmake
sudo apt install libgflags-dev nlohmann-json3-dev \ ros-foxy-image-transport ros-foxy-image-publisher
注意:1.编译出现下面这个问题
--- stderr: astra_camera
/usr/bin/ld: /lib/aarch64-linux-gnu/libpng16.so.16: undefined reference to `inflateValidate@ZLIB_1.2.9'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/list_devices_node.dir/build.make:343: list_devices_node] Error 1
make[1]: *** [CMakeFiles/Makefile2:107: CMakeFiles/list_devices_node.dir/all] Error 2
经过仔细回忆,想起来可能是zlib的版本问题,因为这里指出是ZLIB1.2.9,所以我一查,我安装的是zlib1.2.8,还有一个apt安装的zlib1.2.11,遂从官网下载,安装,解决了问题,指令代码如下:
1 wget http://www.zlib.net/fossils/zlib-1.2.9.tar.gz
2 tar -xvf zlib-1.2.9.tar.gz
3 cd zlib-1.2.9
4 mkdir build
5 cd build
6 cmake ..
7 make
8 make install
2。运行出现下面的问题:
[component_container-1] [ERROR] [1672732120.567795111] [astra_camera_container]: Failed to load library: Could not load library LoadLibrary error: /root/rcsconn/lib/aarch64/libz.so.1: version `ZLIB_1.2.9' not found (required by /lib/aarch64-linux-gnu/libpng16.so.16), at /tmp/binarydeb/ros-foxy-rcutils-1.1.4/src/shared_library.c:84
[ERROR] [launch_ros.actions.load_composable_nodes]: Failed to load node 'camera' of type 'astra_camera::OBCameraNodeFactory' in container '/astra_camera_container': Failed to load library: Could not load library LoadLibrary error: /root/rcsconn/lib/aarch64/libz.so.1: version `ZLIB_1.2.9' not found (required by /lib/aarch64-linux-gnu/libpng16.so.16), at /tmp/binarydeb/ros-foxy-rcutils-1.1.4/src/shared_library.c:84
[component_container-1] [ERROR] [1672732120.577070404] [astra_camera_container]: Failed to find class with the requested plugin name 'astra_camera::PointCloudXyzNode' in the loaded library
[ERROR] [launch_ros.actions.load_composable_nodes]: Failed to load node 'point_cloud_xyz' of type 'astra_camera::PointCloudXyzNode' in container '/astra_camera_container': Failed to find class with the requested plugin name.
[component_container-1] [ERROR] [1672732120.583860405] [astra_camera_container]: Failed to find class with the requested plugin name 'astra_camera::PointCloudXyzrgbNode' in the loaded library
[ERROR] [launch_ros.actions.load_composable_nodes]: Failed to load node 'point_cloud_xyzrgb' of type 'astra_camera::PointCloudXyzrgbNode' in container '/astra_camera_container': Failed to find class with the requested plugin name.
ln -s -f /usr/local/lib/libz.so.1.2.9 /root/rcsconn/lib/aarch64/libz.so.1
参考:
(123条消息) linux系统:共享库问题之如version `ZLIB_1.2.9‘ not found_robot.zhoy的博客-优快云博客
或者直接把/usr/local/lib/libz.so.1.2.9拷贝到/root/rcsconn/lib/aarch64/libz.so.1并改名成libz.so.1