01. Build Ros Robot

02. Hướng dẫn chạy Pibot Rp4 dùng chương trình sẵn có Turtle bot 3

Link code pibotRpi4:

https://drive.google.com/drive/folders/1y8DLla9Q8x07zO5ntRBlmzxdOkWPdePt?usp=sharing

Link code Jetsonbot:

https://drive.google.com/drive/folders/1wYArzfHJDGa-9k14IIuLeCmYYatZJ928?usp=sharing

Bỏ hỏi pasword :

sudo visudo

Add this line to the end of file:

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d

your_user_name ALL=(ALL) NOPASSWD: ALL

  1. Cài đặt gói turtlebot3 và chạy được mô phỏng slam và navigation :

    • Tạo working space: $ mkdir -p ~/tenmuondat_ws/src

    • $ cd ~/tenmuondat_ws/ sau đó $ catkin_make để khởi tạo workspace trống.

    • Tải package turtlebot3 ở địa chỉ https://github.com/ROBOTIS-GIT/turtlebot3 về:

    • Vào thư mục source : $cd src sau đó tải package về:

    • ~/tenmuondat_ws/src git clone https://github.com/ROBOTIS-GIT/turtlebot3.git

    • $cd .. ra thư mục ~/tenmuondat_ws$ catkin_make

    • Bạn nào báo lỗi thiếu package thì chạy lệnh sau để tự động cài package còn thiếu:

    • ~/tenmuondat_ws$ rosdep install --from-paths src --ignore-src -r -y

    • Sau đó chạy lại : ~/tenmuondat_ws$ catkin_make

    • Khai báo các gói vừa cài đặt cho ros biết: ~/tenmuondat_ws$ source devel/setup.bash

    • https://emanual.robotis.com/docs/en/platform/turtlebot3/slam_simulation/

  2. Cài đặt gói laser_scan_matcher , teleop_twist_keyboard từ web hoặc google drive:

  3. Copy file turtlebot3_navigationpi4.launch và move_base.launch trong google drive :

  4. Đồng bộ thời gian client (máy tính của các bạn) và master (Máy tính của thầy):

Truy cập terminal Pibot, mở terminal mới và đánh lệnh: ssh bblab@192.168.1.100 password codientu

      • sudo apt autoremove ntp // Gỡ bỏ trình đồng bộ thời gian ntp đã cài

      • sudo apt install chrony -y

      • sudo nano /etc/chrony/chrony.conf

        • Bỏ cập nhật thời gian từ internet ở pool , pool 1 ... bằng cách thêm # vào trước dòng lệnh , và thêm dòng lệnh cập nhật ở IP máy thầy Bá vô:

        • #pool ntp.ubuntu.com iburst maxsources 4

        • #pool 0.ubuntu.pool.ntp.org iburst maxsources 1

        • #pool 1.ubuntu.pool.ntp.org iburst maxsources 1

        • #pool 2.ubuntu.pool.ntp.org iburst maxsources 2

        • server 192.168.1.101 iburst prefer // ip máy thầy bá

        • Bấm ctl + x để thoát chọn y để lưu file đã edit.

    • Server ( Labtop thầy bá hoặc labtop sinh viên (Trong trường hợp máy thầy Bá offline) )

      • Server:

      • Add at last lines: sudo nano /etc/chrony/chrony.conf

      • # Step the system clock instead of slewing it if the adjustment is larger than

      • # one second, but only in the first three clock updates.

      • makestep 1 3

      • local stratum 10

      • #manual

      • allow 192.168.1.0/24

      • smoothtime 400 0.01

    • sudo systemctl restart chrony // Khởi động lại chrony service để cập nhật theo ip

      • chronyc tracking // Kiểm tra đã cập nhật chưa nếu hiện như sau là ok :

        • Reference ID : C0A80165 (192.168.1.101)

        • Stratum : 11

        • Hiện như thế này là ok

  1. Xây dựng bản đồ:

    • Login wifi : d8503robot2g pass codientu

    • Trên PC tất cả các terminal cần chạy cách lệnh thiết lập môi trường sau:

      • export ROS_IP=$(hostname -I | awk '{print $1;}')

      • export ROS_HOSTNAME=$ROS_IP

      • export TURTLEBOT3_MODEL=burger // Tên con robot chọn là burger

      • export ROS_MASTER_URI=http://192.168.1.100:11311 // Địa chỉ Master ros là robot pibot

    • Chú ý: Cài đặt các gói navigation chạy lệnh :

    • $sudo apt install ros-noetic-dwa-local-planner ros-noetic-amcl ros-noetic-navigation ros-noetic-map-server ros-noetic-move-base ros-noetic-slam-gmapping

    • Terminal_1 :

    • roslaunch turtlebot3_slam turtlebot3_slampi4.launch slam_methods:=gmapping

    • Chú ý: Bạn nào thiếu gói slam gmapping chạy lệnh : $ sudo apt-get install ros-noetic-slam-gmapping

    • Teminal 2: rosrun teleop_twist_keyboard teleop_twist_keyboard.py

    • Hoặc $ roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch

    • Sau đó điều khiển robot để di chuyển giúp xây dựng toàn bộ bản đồ

    • Lưu bản đồ:

    • Trên PC : Termial 3: ( Địa chỉ lưu ở máy các bạn có thể khác )

    • cd /home/bblab7490/robot_ws/src/turtlebot3/turtlebot3_navigation/maps/

    • rosrun map_server map_saver -f hoten_mssv_map

  2. Chạy navigation:

    • Kiểm tra kết nối trên Robot:


    • Trên PC

    • Terminal_1 : export TURTLEBOT3_MODEL=burger

    • export ROS_IP=$(hostname -I | awk '{print $1;}')

    • export ROS_HOSTNAME=$ROS_IP

    • $export ROS_MASTER_URI=http://pibot.local:11311

    • export ROS_MASTER_URI=http://192.168.1.100:11311 // Địa chỉ Master ros là robot pibot

    • roslaunch turtlebot3_navigation turtlebot3_navigationpi4.launch map_file:=$(rospack find turtlebot3_navigation)/maps/hoten_mssv_map.yaml

    • roslaunch rrt-global-planner rrt_turtlebot_pibot.launch map_file:=$(rospack find turtlebot3_navigation)/maps/hoten_mssv_map.yaml

    • Để khởi động hệ thống navigation và chọn vị trí chính xác của robot sau đó chọn vị trí cần di chuyển đến.

  3. Chạy giao diện python GUI:

03. Hướng dẫn chạy Pibot Rp4 dùng chương trình sẵn có Turtle bot 3 và RRT Global Planner theo link:

https://github.com/mech0ctopus/rrt-global-planner

  1. Cài đặt bước 1 và 2 ở trên.

  2. Copy file rrt_turtlebot_pibot.launch trong google drive :

  3. Xây dựng bản đồ như bước 4 ở hướng dẫn 1.

  4. Chạy navigation

    • Trên PC

    • Terminal_1 : export TURTLEBOT3_MODEL=burger

    • export ROS_MASTER_URI=http://pibot.local:11311

    • export ROS_MASTER_URI=http://192.168.1.100:11311 // Địa chỉ Master ros là robot pibot

    • roslaunch rrt-global-planner rrt_turtlebot_pibot.launch map_file:=$(rospack find turtlebot3_navigation)/maps/hoten_mssv_map.yaml

    • Để khởi động hệ thống navigation và chọn vị trí chính xác của robot sau đó chọn vị trí cần di chuyển đến.

IV. Optional utility:

  1. How to Stop Ubuntu From Asking for Your sudo Password