• Turtlebot3 Ubuntu18.04 安装ROS2 Dashing


     设置UTF-8编码

    sudo locale-gen en_US en_US.UTF-8
    sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
    export LANG=en_US.UTF-8
    

     

    更新软件源

    sudo apt update && sudo apt install curl gnupg2 lsb-release
    curl http://repo.ros2.org/repos.key | sudo apt-key add -
    sudo sh -c 'echo "deb [arch=amd64,arm64] http://packages.ros.org/ros2/ubuntu `lsb_release -cs` main" > /etc/apt/sources.list.d/ros2-latest.list'
    

      

    安装ROS2

    sudo apt install ros-dashing-desktop
    

      

     安装依赖包

    安装编译工具Colcon

    sudo apt install python3-colcon-common-extensions
    

      

    curl -sSL http://get.gazebosim.org | sh
    

      

    sudo apt remove gazebo11 libgazebo11-dev
    sudo apt install gazebo9 libgazebo9-dev
    sudo apt install ros-dashing-gazebo-ros-pkgs
    

      

    sudo apt install ros-dashing-cartographer
    sudo apt install ros-dashing-cartographer-ros
    

      

    sudo apt install ros-dashing-navigation2
    sudo apt install ros-dashing-nav2-bringup
    

      

    sudo apt install python3-vcstool
    

     

     安装Turtlebot3包

    cd ~/colcon_ws/src/
    git clone -b dashing-devel https://gitee.com/kay2020/DynamixelSDK.git
    git clone -b dashing-devel https://gitee.com/kay2020/turtlebot3_msgs.git
    git clone -b dashing-devel https://gitee.com/kay2020/turtlebot3.git
    colcon build --symlink-install
    

      

    机器人端编译指令

    colcon build --symlink-install --parallel-workers 1
    

      

    安装雷达包

    sudo apt install ros-dashing-hls-lfcd-lds-driver
    

      

    其他包

    sudo apt install python3-argcomplete python3-colcon-common-extensions libboost-system-dev build-essential
    

      

     OpenCR USB端口设置

    sudo cp `ros2 pkg prefix turtlebot3_bringup`/share/turtlebot3_bringup/script/99-turtlebot3-cdc.rules /etc/udev/rules.d/
    sudo udevadm control --reload-rules
    sudo udevadm trigger
    

      

     配置环境变量

    echo 'source ~/colcon_ws/install/setup.bash' >> ~/.bashrc
    echo 'export ROS_DOMAIN_ID=30 #TURTLEBOT3' >> ~/.bashrc
    source ~/.bashrc
    

      

    一键脚本

    #!/bin/bash
    # Apache License 2.0
    # Copyright (c) 2019, ROBOTIS CO., LTD.
    
    echo ""
    echo "[Note] OS version  >>> Ubuntu 18.04 (Bionic Beaver) or Linux Mint 19.x"
    echo "[Note] Target ROS version >>> ROS 2 Dashing Diademata"
    echo "[Note] Colcon workspace   >>> $HOME/colcon_ws"
    echo ""
    echo "PRESS [ENTER] TO CONTINUE THE INSTALLATION"
    echo "IF YOU WANT TO CANCEL, PRESS [CTRL] + [C]"
    read
    
    echo "[Set the target ROS version and name of colcon workspace]"
    name_ros_version=${name_ros_version:="dashing"}
    name_colcon_workspace=${name_colcon_workspace:="colcon_ws"}
    
    echo "[Setup Locale]"
    sudo locale-gen en_US en_US.UTF-8
    sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
    export LANG=en_US.UTF-8
    
    echo "[Setup Sources]"
    sudo rm -rf /var/lib/apt/lists/* && sudo apt update && sudo apt install -y curl gnupg2 lsb-release
    sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key  -o /usr/share/keyrings/ros-archive-keyring.gpg
    sudo sh -c 'echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null'
    
    echo "[Install ROS 2 packages]"
    sudo apt update && sudo apt install -y ros-$name_ros_version-desktop
    
    echo "[Environment setup]"
    source /opt/ros/$name_ros_version/setup.sh
    sudo apt install -y python3-argcomplete python3-colcon-common-extensions python3-vcstool git
    
    echo "[Make the colcon workspace and test colcon build]"
    mkdir -p $HOME/$name_colcon_workspace/src
    cd $HOME/$name_colcon_workspace
    colcon build --symlink-install
    
    echo "[Set the ROS evironment]"
    sh -c "echo \"alias nb='nano ~/.bashrc'\" >> ~/.bashrc"
    sh -c "echo \"alias sb='source ~/.bashrc'\" >> ~/.bashrc"
    sh -c "echo \"alias gs='git status'\" >> ~/.bashrc"
    sh -c "echo \"alias gp='git pull'\" >> ~/.bashrc"
    
    sh -c "echo \"alias cw='cd ~/$name_colcon_workspace'\" >> ~/.bashrc"
    sh -c "echo \"alias cs='cd ~/$name_colcon_workspace/src'\" >> ~/.bashrc"
    sh -c "echo \"alias cb='cd ~/$name_colcon_workspace && colcon build --symlink-install && source ~/.bashrc'\" >> ~/.bashrc"
    
    sh -c "echo \"source /opt/ros/$name_ros_version/setup.bash\" >> ~/.bashrc"
    sh -c "echo \"source ~/$name_colcon_workspace/install/local_setup.bash\" >> ~/.bashrc"
    
    exec bash
    
    echo "[Complete!!!]"
    exit 0
    

      

  • 相关阅读:
    【阅读笔记】《C程序员 从校园到职场》第四章 变量和函数
    【阅读笔记】《C程序员 从校园到职场》第三章 程序的样式(大括号)
    睡眠呼吸机-相关检测算法的实现原理
    电磁学5.场能密度、电容与介电常数
    电磁学4.高压击穿
    电磁学3.静电屏蔽
    电磁学2.静电势能和电势
    电磁学1.高斯定律
    BLDC开发笔记8.过流保护与电流采样要点
    BLDC开发笔记7.转速和扭矩的影响因素和开关管的热分析概述
  • 原文地址:https://www.cnblogs.com/kay2018/p/15700896.html
Copyright © 2020-2023  润新知