目 录CONTENT

文章目录

ROS2 DEMOS

GrantLi
2022-12-08 / 0 评论 / 0 点赞 / 341 阅读 / 6387 字 / 正在检测是否收录...

一、环境

Ubuntu: 20.04
ROS2: Foxy

Foxy安装

1.Set locale

locale  # check for UTF-8

sudo apt update && sudo apt install locales
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

locale  # verify settings

2.Setup Sources

sudo apt install software-properties-common
sudo add-apt-repository universe

sudo apt update && sudo apt install curl
sudo curl -sSL http://www.aigrantli.com:1080/GrantLi/rosdistro/-/raw/d007eb8f3ffab518312a8cfc47e039137cdb5593/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null

sudo apt update
  1. 安装ROS2 Foxy
sudo apt install ros-foxy-desktop python3-argcomplete
  1. 安装依赖
sudo apt install ros-dev-tools
  1. 配置环境
    打开.bashrc在文件后面添加:
# Replace ".bash" with your shell if you're not using bash
# Possible values are: setup.bash, setup.sh, setup.zsh
source /opt/ros/foxy/setup.bash
  1. 测试
# 终端1
source /opt/ros/foxy/setup.bash
ros2 run demo_nodes_cpp talker

# 终端2
source /opt/ros/foxy/setup.bash
ros2 run demo_nodes_py listener

二、DEMO1:Nav2

(一)安装功能包
  1. 通过命令行安装功能包
sudo apt install ros-foxy-navigation2
sudo apt install ros-foxy-nav2-bringup

sudo apt install ros-foxy-turtlebot3*
  1. 配置环境
    在.bashrc下面添加:
export TURTLEBOT3_MODEL=waffle
export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:/opt/ros/foxy/share/turtlebot3_gazebo/models
(二)建图测试
ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py
ros2 launch turtlebot3_cartographer cartographer.launch.py use_sim_time:=True
ros2 run turtlebot3_teleop teleop_keyboard
ros2 run nav2_map_server map_saver_cli -f ~/map
(三)导航测试
  1. 官方demo
ros2 launch nav2_bringup tb3_simulation_launch.py headless:=False
  1. 测试demo
ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py
ros2 launch turtlebot3_navigation2 navigation2.launch.py use_sim_time:=True map:=/home/ubuntu/map.yaml
(四)自主探索建图
  1. 安装源码
mkdir -p ~/nav2_ws/src
cd ~/nav2_ws/src
git clone https://github.com/charlielito/slam_gmapping.git --branch feature/namespace_launch
cd ..
colcon build --symlink-install --packages-up-to slam_gmapping
cd ~/nav2_ws/src
git clone https://github.com/robo-friends/m-explore-ros2.git
cd ..
colcon build --symlink-install 
  1. 测试
# 终端1
ros2 run explore_lite explore --ros-args --params-file ~/nav2_ws/src/m-explore-ros2/explore/config/params.yaml

# 终端2
export TURTLEBOT3_MODEL=waffle
export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:/opt/ros/${ROS_DISTRO}/share/turtlebot3_gazebo/models
ros2 launch nav2_bringup tb3_simulation_launch.py slam:=True

# 终端3
ros2 launch explore_lite explore.launch.py
(五)多机仿真

多机仿真

DEMO2:moveit2

DEMO3: YOLOV5

参考链接
1. navigation2源码地址
2. Nav2官方教程
3. 中文文档
4. Robotics-Nav2-SLAM-Example
5. Robotics-Warehouse
6. moveit2源码地址
7. moveit2官方说明文档

0

评论区