ROS2安装serial库

场景及问题描述:

今天在使用ros2读取IMU数据的时候,他需要用到一个serial的包,由于我使用的是Ubuntu20.04+ROS2humble,并且没有安装这个包,所以出现了以下报错

  Could not find a package configuration file provided by "serial" with any
  of the following names:

    serialConfig.cmake
    serial-config.cmake

  Add the installation prefix of "serial" to CMAKE_PREFIX_PATH or set
  "serial_DIR" to a directory containing one of the above files.  If "serial"
  provides a separate development package or SDK, be sure it has been
  installed.

如果是在ros1中,他可以直接使用以下命令安装包

sudo apt install ros-melodic-serial

但是在ROS2中,serial的包并没有放入到ROS2的官网当中,所以搜索包库后,找不到这个对应的serial包,经过搜索,找到答案,需要自己去编译源码并安装

参考博客
https://blog.csdn.net/slampai/article/details/127876015


解决方案:

原git库

进入源码网页

http://wjwwood.io/serial/doc/1.1.0/index.html

根据原网页提示信息进行安装

  git clone git://github.com/wjwwood/serial.git
  cd serial
  sudo make install

国内git库

https://github.com/ZhaoXiangBox/serial

根据README安装serial库即可

猜你喜欢

转载自blog.csdn.net/scarecrow_sun/article/details/128656341