在 Raspberry Pi 4 上的 Raspbian (Buster) 上安装 Ros Noetic

Use*_*erK 4 installation raspberry-pi ros catkin

我正在尝试在 Raspberry Pi 4 上安装 ROS Noetic,在执行官方指南中的此命令时遇到此错误:

userk@dopamine:~/development/ros_catkin_ws $ ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release
[...]
File "~/development/ros_catkin_ws/build_isolated/rosbash/catkin_generated/generate_cached_setup.py", line 12, in <module>
    from catkin.environment_cache import generate_environment_script
ModuleNotFoundError: No module named 'catkin'
Run Code Online (Sandbox Code Playgroud)

Ros Noetic 支持 Ubuntu Focal 和 Debian Buster。

userk@dopamine:~/development/ros_catkin_ws $ lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 10 (buster)
Release:    10
Codename:   buster
Run Code Online (Sandbox Code Playgroud)

你有什么建议吗?

小智 6

我也有这个错误并解决了。它来自于构建过程中 python2 和 python3 的混合。使用 ROS_PYTHON_VERSION 环境变量强制使用特定版本的 python 进行构建。

Debian Buster 是 noetic 支持的操作系统,但不是主要的操作系统 Ubuntu Buster。OP 不需要被告知“Noetic 不应安装在此操作系统上”,他/她需要帮助来解决他/她的问题。在我看来,解决问题比逃避问题要好。

我的设置有点棘手:

  • 硬件:树莓派4
  • 操作系统: Raspberry Buster
  • 在 docker 映像中安装 ROS noetic(当前为 1.15.7),其客户操作系统也是 raspbian buster,因此它应该与直接在主机操作系统上安装相同。
  • 使用python3安装ROS

说明如下。我希望它会有所帮助。

mkdir ~/catkin_ws && cd ~/catkin_ws
export ROS_DISTRO="noetic"
# I very strongly advise to set Python version used by ROS
# otherwise the packages will mix up python2 and python3 during build
# finally leading to the error you encountered (just like me before)
export ROS_PYTHON_VERSION="3"
# disable languages that I don't need
export ROS_LANG_DISABLE="geneus:genlisp:gennodejs"
sh -c 'echo "deb http://packages.ros.org/ros/ubuntu buster main" > /etc/apt/sources.list.d/ros-latest.list'
apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
apt-get update
apt-get install python3-rosdep python3-rosinstall-generator python3-vcstool build-essential
apt-get install -y ca-certificates && rosdep init && rosdep update
# Remove/add packages to get an installation covering your needs.
rosinstall_generator --rosdistro noetic --deps --tar \
        ros_comm             \
        actionlib            \
        sensor_msgs          \
        image_common         \
        vision_opencv        \
        > noetic-computervision.rosinstall
mkdir ./src && vcs import --input noetic-computervision.rosinstall ./src
rosdep install --from-paths ./src --ignore-packages-from-source --rosdistro noetic -y
python3 ./src/catkin/bin/catkin_make_isolated --install --install-space /opt/ros/noetic -DCMAKE_BUILD_TYPE=Release
Run Code Online (Sandbox Code Playgroud)