ME4512 Autonomous Mobile Robot

ME4512 Autonomous Mobile Robot - Robot tự hành

Chiều Thứ 6, Tiết 4-6, 15h05- 17h5530 , Mã lớp học trên team:   Teamcode :  mg3n25c

Link giáo trình bài giảng: https://sites.google.com/view/bblab/teaching/me4512_autonomousrobot

Giáo trình: 

Introduction to Autonomous Mobile Robots, 2004. Roland Siegwart and Illah R. Nourbakhsh

Tài liệu bài giảng tiếng anh:

https://asl.ethz.ch/education/lectures/autonomous_mobile_robots/spring-2020.html

Link tải full google drive: 

https://drive.google.com/drive/folders/1NZaiy-0S4KbtwfU9n9dsiQTA5Hlh65i9?usp=sharing

Bài Tập theo tài liệu bài giảng slide tiếng anh ở trên:

Các bạn copy code file matlab hoặc chụp ảnh minh chứng và nộp  lên  Assignment microsoft team.

Bài 1: Cài đặt Phần mềm mô phòng, chạy test trên Matlab

Tài liệu https://asl.ethz.ch/education/lectures/autonomous_mobile_robots/spring-2020.html

Ex1 25.02.2020   Introduction to V-​Rep Simulator

Exercise 1 (ZIP, 3.3 MB) K. Bodie, L. Schmid

Bài 2:   Giải động học và điều khiển robot Kinematics & Control of a Differential Drive Vehicle

Các bạn copy code file matlab vào nộp  lên  microsoft team.

.....

Project cuối kỳ:  

Tìm hiểu về xe tự lái trong cuộc thi bosch-future-mobility-challenge  

 https://bosch-future-mobility-challenge-documentation.readthedocs-hosted.com/data/hardwaresetupofcar.html


(Nhóm từ 2-3 thành viên (không nhiều hơn 3, không ít hơn 2, bạn nào lẻ phải chủ động tự tìm nhóm để ghép vào):

Các bạn tải file lên Link Google Drive Folder trong đó  cha thuyết minh đồ án, bản vẽ, code lập trình, video chạy thực tế, ....

Chú ý: Đặt tên file hay folder HọTên_MSSV  ví dụ, NguyenVanA_20180012

            Độ dài: 8 - 10 trang, Có trang phân công nhiệm vụ từng thành viên của nhóm.

NHỚ BẬT CHẾ ĐỘ SHARE  sau đó chia sẻ link lên Google sheet sau:

Đăng ký Chia nhóm làm project cuối kỳ theo link sheet: 

https://docs.google.com/spreadsheets/d/1F_J83AqKVq3304xv2I8DKbmldpaG55KcYLo1qu_orDo/edit?usp=sharing

Mẫu báo cáo cuối kỳ:

https://docs.google.com/document/d/1JDUE5Kima3DLZJdCL-pFhql79XD1H6R4n0R3FZappww/edit?usp=sharing

Mẫu Slide: 

2. Yêu cầu

- Tiểu luận báo cáo  8-10  trang  (nộp) 

+ Giới thiệu đề tài 

+ Phương pháp giải quyết vấn đề

+ Các kết quả đạt được

+ Kết luận 

3. Tính điểm


https://bosch-future-mobility-challenge-documentation.readthedocs-hosted.com/data/computer/setup.html


Đăng  ký tham gia Projects  ( Trung bình 5)  

-  Có cố gắng chế tạo robot nhưng chưa chạy được(Trung bình 8)  

-  Có robot tham gia thi đấu ( Trung bình 8.5)  

-  Top 8 được ( Trung bình 10) 

-  Xếp thứ 8 -16 ( Trung bình 9,5)   

-  Xếp thứ 17 -trở xuống ( Trung bình 9)  

Giữa kỳ: Kiểm tra tiến độ hoàn thành Projects 

I. Bài Tập thực hành môn học:

Các bạn copy code file matlab hoặc chụp ảnh minh chứng và nộp  lên  Assignment microsoft team. 

Chú ý: Đặt tên file hay folder HọTên_MSSV  ví dụ, NguyenVanA_20180012

Hướng dẫn cài đặt:

https://sites.google.com/view/bblab/teaching/me5621_mobilerobotcontrol


Bài 1:  Cài đặt UBUNTU và ROS 1

Các bạn chụp ảnh màn hình máy tính đã chạy ubuntu  và ROS Version nộp lên Team


  https://vinasupport.com/huong-dan-cai-dat-hdh-ubuntu-20-04-lts/

https://learn.microsoft.com/en-us/windows/wsl/install-manual#step-4---download-the-linux-kernel-update-package

https://www.virtualbox.org/wiki/Downloads

          Cài Ubuntu trên máy ảo Virtual Box

https://www.linuxvmimages.com/images/ubuntu-1804/

https://www.linuxvmimages.com/images/ubuntu-2004/


 Một số bạn không kết nối được wifi, tìm hiểu cách khắc phục trên mạng nhé. Link tham khảo:

https://www.reddit.com/r/Ubuntu/comments/lbl0l5/can_windows_dual_boot_be_messing_with_my_wifi_card/

https://itsfoss.com/fix-no-wireless-network-ubuntu/

 2. Cài đặt hệ điều hành ROS tương ứng với phiên bản ubuntu 18 hoăc 20 :

http://wiki.ros.org/ROS/Installation

ROS Noetic Ninjemys

Released May, 2020

Latest LTS, supported until May, 2025

Recommended for Ubuntu 20.04 

Tạo thư mục cho các dự án ROS

http://wiki.ros.org/catkin/Tutorials/create_a_workspace

Kiểm tra phiên bản Ubuntu 

~$lsb_release -a 

ROS:   ~$ rosversion -d

Nếu hiện noetic thì chạy lệnh như ở dưới, nếu khác ví dụ melodic thì thay từ noetic -> melodic

Cài đặt ros controller :

sudo apt-get install ros-noetic-ros-control ros-noetic-ros-controllers


Bài2:  Tự học 21 bài cơ bản Beginer level trong ROS

http://wiki.ros.org/ROS/Tutorials

Các bạn chụp ảnh màn hình máy tính đã chạy thành công ít nhất 3 bài trong 21 bài trên và nộp lên Team


Bài 3:  Cài đặt và chạy Turtle bot simulation

Các bạn chụp ảnh màn hình máy tính đã chạy được chương trình vào nộp lên microsoft team.:

Tạo catkin space:

http://wiki.ros.org/catkin/Tutorials/create_a_workspace

$ mkdir -p ~/tenmuondat_ws/src

$ cd ~/catkin_ws/src   

Vào thư mục source để tải package bạn cần chạy về ví dụ turtle bot3 simulation

~/catkin_ws/src$ git clone https://github.com/ROBOTIS-GIT/turtlebot3.git

~/catkin_ws/src$ git clone https://github.com/ROBOTIS-GIT/turtlebot3_simulations.git

Tải xong vào thư mục src thì các bạn ra thư mục work space

$ cd ~/catkin_ws/

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: 

rosdep install --from-paths src --ignore-src -r -y

Sau đó chạy: 

 ~/catkin_ws/$  catkin_make                       (Biên dịch gói turtble bot ra thư mục build và devel để chạy ) 

 ~/catkin_ws/$  source devel/setup.bash     ( Để khai báo với hệ thống gói package vừa cài đặt) 

Muốn hệ thống tự khai báo gói turtle bot các bạn chạy lệnh:

echo "source  ~/catkin_ws/devel/setup.bash" >> ~/.bashrc      (Thêm dòng lệnh vào file bashrc)

Hoặc tương đương với sửa  file : gedit ~/.bashrc 

Thêm dòng: source  ~/catkin_ws/devel/setup.bash vào cuối file. 

Chạy thử : 

Mở 2  command Terminal chạy lệnh 

Terminal 1,2 : 

$ export TURTLEBOT3_MODEL=burger     ( Do có vài loại turtble bot Đặt biến chọn TURTLEBOT3_MODEL là burger ,)

Terminal 1: 

$ roslaunch turtlebot3_gazebo turtlebot3_world.launch

Terminal 2: 

$ roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch

Sau đó điều khiển turtble trên gazebo bằng bàn phím w,s,a,d,x ...

Chụp ảnh chạy Rviz và Gazebo robot đang tự di chuyển và xây dựng bản đồ

Lập trình python chạy giao diện điều khiển robot:

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

B1: 

$ export TURTLEBOT3_MODEL=burger

$ roslaunch turtlebot3_gazebo turtlebot3_world.launch

roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch

B2:

$ export TURTLEBOT3_MODEL=burger

$ roslaunch turtlebot3_navigation turtlebot3_navigation.launch

B3: 

~/PycharmProjects/send_goal_GUI$ python send_goal_GUI.py

Tham khảo:  Keyword: tkiter python gui, Sending Goals to the Navigation Stack - Python

https://realpython.com/python-gui-tkinter/

https://hotblackrobotics.github.io/en/blog/2018/01/29/action-client-py/

Bai 4. Chay xe Bosh:

Chay duoc mo phong xe tu lai BFMC 2024 

https://bosch-future-mobility-challenge-documentation.readthedocs-hosted.com/data/simulator.html

B1: $ mkdir -p ~/tenmuondat_ws/src

$ cd ~/catkin_ws/src   

Vào thư mục source để tải package bạn cần chạy về 

Tai thu muc simulator ve thu muc src trong work space: 

https://drive.google.com/file/d/1IvaaRDnJoXK-7P07hSUjgM3xBcIibdAM/view?usp=sharing

THam khao ban goc : ~/catkin_ws/src$ git clone https://github.com/ECC-BFMC/Simulator.git

catkin_ws$  catkin_make       // de complice chuong trinh

B2: Tìm file catkin_ws/setup.bash, them  2 đường dẫn GAZEBO và MODEL ROS theo đúng địa chỉ trên máy

/home/bblab7490/Documents/02_BFMC_Challenge/catkin_ws/src/Simulator   Thanh dia chi folder o may cua ban:

export GAZEBO_MODEL_PATH="/home/bblab7490/Documents/02_BFMC_Challenge/catkin_ws/src/Simulator/models_pkg:$GAZEBO_MODEL_PATH"

export ROS_PACKAGE_PATH="/home/bblab7490/Documents/02_BFMC_Challenge/catkin_ws/src/Simulator:$ROS_PACKAGE_PATH"

Kiem tra bang lenh : 

echo $ROS_PACKAGE_PATH   //co duong dan den ros

/opt/ros/noetic/share

echo $GAZEBO_MODEL_PATH    //

/home/bblab7490/Documents/02_BFMC_Challenge/catkin_ws/src/Simulator/models_pkg:

B2.1: Tim file : catkin_ws/src/Simulator/models_pkg/track/materials/scripts/bfmc_track.material

Sua noi dung:       thanh texture 2021_VerySmall.png ban do nho giam dung luong

texture_unit

{

  texture 2021_VerySmall.png

}

B3: 

Terminal 1: 

source devel/setup.bash

roslaunch sim_pkg map_with_all_objects.launch    // Hoac 

roslaunch sim_pkg map_with_car.launch     // Cho nhe do nang may

Terminal 2

source devel/setup.bash

rosrun example camera.py

Terminal 3: 

Sua file : control.py

Thay dia chi 2 dong: /home/bblab7490/Documents/02_BFMC_Challenge/catkin_ws/src/Simulator   Thanh dia chi folder o may cua ban:

Line 345 346:

PATH_TO_MODEL = '/home/bblab7490/Documents/02_BFMC_Challenge/catkin_ws/src/Simulator/example/src/detect.tflite'

PATH_TO_LABELS = '/home/bblab7490/Documents/02_BFMC_Challenge/catkin_ws/src/Simulator/example/src/labelmap.txt'

Sau do: 

source devel/setup.bash

rosrun example control.py

Ghi chu: 

Neu bao loi thieu thu vien tensorflow : 

$ pip install tensorflow==2.8.0

May nao chua co Pip cai dat theo google keywords

How to install pip ubuntu


Tham khảo: 

https://automaticaddison.com/how-to-launch-the-turtlebot3-simulation-with-ros/

https://emanual.robotis.com/docs/en/platform/turtlebot3/simulation/

https://emanual.robotis.com/docs/en/platform/turtlebot3/nav_simulation/

https://github.com/ROBOTIS-GIT/turtlebot3.git


 Bài 5:  Điều khiển Xe từ máy  khách  client 

Mở 1 terminal chạy  các lệnh sau:

     ifconfig    // Kiem tra ip  vi du hien la inet 192.168.10.102

      

      echo $ROS_IP   // Kiểm tra biến tham số ROS đã cài chưa

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

      export ROS_HOSTNAME=$ROS_IP

      export ROS_MASTER_URI=http://192.168.10.102:11311 

      Kiem tra ket noi: 

      ping 192.168.10.102    Co ket noi la ok 

64 bytes from 192.168.10.102: icmp_seq=1 ttl=64 time=0.031 ms


     rostopic list 


      rosrun example control_org.py


Bài 6: Tu lap trinh xe chay theo lan duong "Lane navigation" 

Tai file huong dan: Lane navigation.. va DeepPiCar... tu google drive:

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

Tao file chuong trinh Python de xe tu dong chay theo lan duong.

Vi du mau: 

copy 2 file bblab_lane_navigation.py va basic_lane_navigation.py vao thu muc catkin_ws/src/Simulator/example/src

O Bai 4, B3, Terminal 3  chay lenh: 

rosrun example basic_lane_navigation.py    

Tham khao: 

Tu code xu ly nhan dang lan duong

https://pysource.com/2018/03/07/lines-detection-with-hough-transform-opencv-3-4-with-python-3-tutorial-21/

https://www.youtube.com/watch?v=fclTFQQvQFQ&ab_channel=ProgrammingKnowledge


rostopic echo /automobile/localisation  // 



Bài 7:

https://colab.research.google.com/github/EdjeElectronics/TensorFlow-Lite-Object-Detection-on-Android-and-Raspberry-Pi/blob/master/Train_TFLite2_Object_Detction_Model.ipynb


Phu luc cho may chu: 

      echo $ROS_IP   // Kiểm tra biến tham số ROS đã cài chưa

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

      export ROS_HOSTNAME=$ROS_IP

      export ROS_MASTER_URI=http://$ROS_HOSTNAME:11311

$ rostopic info /automobile/command

rostopic pub /automobile/command std_msgs/String "data: '{\"action\": \"1\", \"speed\": 0.09}'"

rostopic pub /automobile/command std_msgs/String "data: '{\"action\": \"1\", \"speed\": 0.00}'"


Kiem tra tin hieu duoc gui chua : 

rostopic echo /automobile/command


 Bài 8: Tìm hiểu các thuật toán tìm kiếm path planning   

https://github.com/RuslanAgishev/motion_planning

Tìm hiểu chỉnh  sửa code 


Làm bài tập HW 1,2,3 

TIm hieu thuat toan A* 

https://www.youtube.com/watch?v=-L-WgKMFuhE&t=146s&ab_channel=SebastianLague

Tìm hiểu thuật toán RRT, RRT * 

https://www.youtube.com/watch?v=Ob3BIJkQJEw&ab_channel=AaronBecker

  Bài 9: Chạy thuật toán tìm kiếm RRT   

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

http://wiki.ros.org/navigation/Tutorials/Writing%20A%20Global%20Path%20Planner%20As%20Plugin%20in%20ROS

192.168.10.102:11311 

Một số mô hình xe tự hành dùng Omni Wheel 

2. 3WD Triangular 100mm omni wheel mobile robotics car C003

3. 4WD Omni Wheel Arduino Robot Car C008

4. 3WD Omni Wheel Arduino Robot Car C008

Một số mô hình xe tự hành  2 bánh

1. Autonomous mobile platform with vacuum cleaning 

2. Autonomous mobile platform with vacuum cleaning