OrangePi&RaspberryPi安装ROS及MAVROS

 
  发表于:2021-01-31 12:11  
  更新于:2021-02-02 18:27  

笔者在armbian-Bionic下安装通过,理论上所有基于Ubuntu-Bionic的系统都可照此步骤安装

调整swap大小

  • armbian

    sudo vim /etc/default/armbian-zram-config
    ZRAM_PERCENTAGE=XXX     
    MEM_LIMIT_PERCENTAGE=XXX
    ZRAM_MAX_DEVICES=XXX
  • raspios

    sudo vim /etc/dphys-swapfile
    # 将100改为1024,单位MB
    CONF_SWAPSIZE=1024
    # save and exit 
    #开关一下,使之生效
    sudo /etc/init.d/dphys-swapfile stop
    sudo /etc/init.d/dphys-swapfile start

安装ROS Melodic

参照

树莓派4b 安装buster系统 安装ROS与MAVROS 连接pixhawk飞控
在树莓派上ROS MAVROS的安装使用

  • 加入ROS源(使用清华镜像源)

    sudo sh -c 'echo "deb http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
  • 添加GPG Key

    sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
  • sudo apt update&&sudo apt upgrade

  • 安装Bootstrap依赖

    sudo apt install python-rosdep python-rosinstall-generator python -wstool python-rosinstall build-essential cmake
  • 安装rosdep(包管理器)

    sudo rosdep init
    rosdep update
  • 创建一个catkin工作区

    mkdir~ / ros_catkin_ws
    cd~ / ros_catkin_w
  • 构建包和库

    选择安装ROS-Comm以实现最小化安装。
    ROS-Comm:ROS包,构建和通信库。没有GUI工具。

    rosinstall_generator ros_comm --rosdistro melodic --deps --tar > melodic-ros_comm.rosinstall
    wstool init -j8 src melodic-ros_comm.rosinstall
    wstool update -j4 -t src

    额外的软件安装

    mkdir -p ~/ros_catkin_ws/external_src
    cd ~/ros_catkin_ws/external_src
    wget    http://sourceforge.net/projects/assimp/files/assimp-3.1/assimp-3.1.1_no_test_models.zip/download -O assimp-3.1.1_no_test_models.zip
    unzip assimp-3.1.1_no_test_models.zip
    cd assimp-3.1.1
    cmake .
    make
    sudo make install

    安装ROS

    cd ~/ros_catkin_ws
    rosdep install --from-paths src --ignore-src --rosdistro melodic -y
    sudo ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/melodic -j1
  • 将ROS环境导入到bashrc

    echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
    source ~/.bashrc
  • 输入 roscore 查看安装结果

安装MAVROS Melodic

参考

官方教程
NaiveWizard的博客

  • 安装

    sudo apt-get install python-catkin-tools python-rosinstall-generator -y
    
    mkdir -p ~/mavros_catkin_ws/src
    cd ~/mavros_catkin_ws
    
    catkin init
    wstool init src
    
    rosinstall_generator --rosdistro melodic mavlink | tee /tmp/mavros.rosinstall
    rosinstall_generator --upstream-development mavros mavros_extras mavros_msgs test_mavros sensor_msgs  control_toolbox realtime_tools tf tf2_ros python_orocos_kdl urdf |tee -a /tmp/mavros.rosinstall
    
    wstool merge -t src /tmp/mavros.rosinstall
    wstool update -t src -j4
    rosdep install --from-paths src --ignore-src -y
    
    sudo ./src/mavros/mavros/scripts/install_geographiclib_datasets.sh
    
    catkin build -j1 #多线程orangePiZeroPlus顶不住
  • 连接飞控

    cd ~/mavros_catkin_ws
    source devel/setup.bash
    roslaunch mavros px4.launch fcu_url:=/dev/ttyACM0:57600

添加新评论