turtlebot3_simulations/turtlebot3_gazebo/README.md
2018-12-09 23:51:43 +09:00

2.2 KiB

TurtleBot3

How to run TB3 in Gazebo

Setup

$ mkdir -p ~/turtlebot3_ws/src
$ cd ~/turtlebot3_ws/src
$ git clone -b ros2 https://github.com/ROBOTIS-GIT/turtlebot3.git
$ git clone -b ros2 https://github.com/ROBOTIS-GIT/turtlebot3_msgs.git
$ git clone -b ros2 https://github.com/ROBOTIS-GIT/turtlebot3_simulations.git
$ git clone -b master https://github.com/ros2/cartographer.git
$ git clone -b master https://github.com/ros2/cartographer_ros.git
$ git clone https://github.com/ros2/pcl_conversions.git
$ sudo apt install -y \
    clang \
    g++ \
    git \
    google-mock \
    libboost-all-dev \
    libcairo2-dev \
    libeigen3-dev \
    libgflags-dev \
    libgoogle-glog-dev \
    liblua5.2-dev \
    libsuitesparse-dev \
    ninja-build \
    python-sphinx \
    libpcl-conversions-dev \
    libpcl-dev \
$ cd ~/turtlebot3_ws && colcon build

Run Gazebo

$ export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:~/turtlebot3_ws/src/turtlebot3_simulations/turtlebot3_gazebo/models
$ cd ~/turtlebot3_ws/src/turtlebot3_simulations/turtlebot3_gazebo/worlds
$ gazebo --verbose turtlebot3_ros2_demo.world -s libgazebo_ros_init.so

Run tf2_monitor

$ ros2 run tf2_ros tf2_monitor

Run teleop node

$ ros2 run turtlebot3_teleop turtlebot3_teleop_key

Run Rviz

$ ros2 launch turtlebot3_bringup turtlebot3_robot.launch.py
$ rviz2

Useful Commands

  • Try sending commands:
$ ros2 topic pub /tb3/cmd_vel geometry_msgs/Twist '{linear: {x: 1.0}}' -1

$ ros2 topic pub /tb3/cmd_vel geometry_msgs/Twist '{angular: {z: 0.1}}' -1
  • Try listening to odometry:
$ ros2 topic echo /demo/odom_demo
  • Try listening to TF:
$ ros2 run tf2_ros tf2_echo odom base_link

$ ros2 run tf2_ros tf2_echo base_footprint wheel_right_wheel

$ ros2 run tf2_ros tf2_echo base_footprint wheel_left_wheel

Run Cartographer

$ launch `ros2 pkg prefix turtlebot3_cartographer`/share/turtlebot3_cartographer/launch/turtlebot3_cartographer.py
$ ros2 param set /cartographer_node /use_sim_time true