ME5621 Mobile Robot control
ME5621 Mobile Robot control - Điều khiển Robot tự hành
Chiều Thứ 4, Tiết 7-9 12h30-15h00 , Mã lớp học trên team: Teamcode : 6tg9n9e
TỔNG HỢP TÀI LIỆU GOOGLE DRIVE : https://drive.google.com/drive/folders/1jGV8k945jdnORT2_e1FR3VAYauOunl0J?usp=sharing
Project cuối kỳ:
Tìm hiểu về xe tự lái trong cuộc thi bosch-future-mobility-challenge
(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):
NỘP ONLINE BÁO CÁO và ký xác nhận:
Các bạn tải file lên Link Google Drive Folder trong đó chứa 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:
D9 -204, Chiều Thứ 4, Tiết 7-9, 12h30-15h00 DANH SÁCH NHÓM TÌM HIỂU XE TỰ LÁI
File google drive
https://docs.google.com/spreadsheets/d/1NFPeTyS1XX-VEXMwno1XZ_GA3CGfTPBXMNRgEiCNduE/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 giua ky va cuoi ky
Cài đặt Ubuntu 20.04
Cài đặt chương trình trên máy tính để đọc thông tin từ robot
- Chay full BFMC file control.py, ket noi dieu khien tu may tinh 30 ( Trung bình 10)
- Chay full BFMC file control.py 27 (Trung bình 9)
- Chay mo phong turtle bot 24 (Trung bình 8)
- Cai dat chay Ubuntu va Ros 21 (Trung bình 7)
Diem danh tich cuc di hoc + 0.5
Giữa kỳ: Kiểm tra tiến độ hoàn thành Micromouse Robot
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
Cài đặt hệ điều hành Ubuntu 20.04:
CÁCH 1: KHUYẾN NGHỊ: Cài trực tiếp trên máy chạy song song 2 hệ điều hành Window và Ubuntu
https://vinasupport.com/huong-dan-cai-dat-hdh-ubuntu-20-04-lts/
CÁCH 2: Cài app Ubuntu trên window
CÁCH 3: Cài đặt dùng máy ảo trên Virtual box:
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/
Các bạn chạy máy ảo thiết lập trong Virtual machine:
menu/ edit/ Networksetting -> Advanced setting : Bridge network : VmA0
In Ubuntu machine file: Select connect to VmA0
Set manual IP in Ubuntu system:
IP4 Manual Adress 10.13.82.xxx Netmask 255.255.255.0
trong VirtualBox
Chọn Devices/Networks/ Network Setttings
Adapter1/ Attached to : Bridged Adapter
Name :..... wireless
Advanced: Allow all, Cable Connected
Sau đó Chọn Devices/Networks/Connect Network Adapter
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
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
Kiem tra bien moi truong:
$ printenv | grep ROS
$ source /opt/ros/noetic/setup.bash
Sửa file : gedit ~/.bashrc
Thêm dòng: source /opt/ros/noetic/setup.bash
Bài2: Tự học 21 bài cơ bản Beginer level trong ROS De hieu ban chat cua 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 luu lai thay kiem tra
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 luu lai thay kiem tra
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 ~/xetulai_ws/src
$ cd ~/xetulai_ws/src // Vao thu muc src de copy code tai tu google drive ve
Tai thu muc simulator dua vao thu muc src trong work space:
https://drive.google.com/drive/folders/1Y4YTGSxzGTCXdKqHomPSifgLwRHjYLqq?usp=sharing
Ve lai thu muc : xetulai_ws$ catkin_make // de compile chuong trinh
Chu y: Ai bi loi "utils/IMU/h" not found thi chay them lenh:
xetulai_ws$ catkin_make --pkg utils
xetulai_ws$ catkin_make
B2: Sửa file : gedit ~/.bashrc
Them 2 đường dẫn GAZEBO và MODEL ROS theo đúng địa chỉ trên máy cua ban:
export GAZEBO_MODEL_PATH="/home/bblab7490/Documents/02_BFMC_Challenge/xetulai_ws/src/Simulator/models_pkg:$GAZEBO_MODEL_PATH"
export ROS_PACKAGE_PATH="/home/bblab7490/Documents/02_BFMC_Challenge/xetulai_ws/src/Simulator:$ROS_PACKAGE_PATH"
Kiem tra bang lenh, mo terminal moi :
echo $ROS_PACKAGE_PATH //co duong dan den ros
/opt/ros/noetic/share
echo $GAZEBO_MODEL_PATH //
/home/bblab7490/Documents/02_BFMC_Challenge/xetulai_ws/src/Simulator/models_pkg:
B2.1: Tim file : xetulai_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, dang bi loi
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/xetulai_ws/src/Simulator Thanh dia chi folder o may cua ban:
Line 345 346:
PATH_TO_MODEL = '/home/bblab7490/Documents/02_BFMC_Challenge/xetulai_ws/src/Simulator/example/src/detect.tflite'
PATH_TO_LABELS = '/home/bblab7490/Documents/02_BFMC_Challenge/xetulai_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
Reset car position:
rosservice call /gazebo/reset_simulation
May nao chua co Pip cai dat theo google keywords
How to install pip ubuntu
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:
De chay chuong trinh mau
https://github.com/dctian/DeepPiCar
Tim hieu code xe tu lai
https://www.youtube.com/watch?v=sOPgdIMUC0Y&ab_channel=WaabiAI
https://github.com/qiaoxu123/Self-Driving-Cars/tree/master
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
Bai 7: Cài đặt và chạy pibot:
Chay ban do cả 3 terminal cần chạy các dòng lệnh sau:
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
export TURTLEBOT3_MODEL=burger
export ROS_MASTER_URI=http://192.168.1.101:11311
Terminal 1: Chạy điều khiển
rosrun teleop_twist_keyboard teleop_twist_keyboard.py
roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch
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
Tham khao ban goc : ~/catkin_ws/src$ git clone https://github.com/ECC-BFMC/Simulator.git
Bài 8: Thiết kế mô hình different drive bot trên gazebo và thêm plugin điều khiển từ ROS
https://www.theconstructsim.com/how-to-build-a-differential-drive-simulation/
https://classic.gazebosim.org/tutorials?tut=build_robot&cat=build_robot
Mo hinh co san: https://github.com/devanshdhrafani/diff_drive_bot
Đọc hiểu các dòng lệnh trong file sdf
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.
Bài 9: 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 10: Chạy thuật toán tìm kiếm RRT
II. Bài tập thuật toán theo giáo trình
HW1 after Lecture 2 : Làm bài tập theo hướng dẫn, chụp ảnh màn hình kết quả nộp lên team
https://drive.google.com/file/d/1QIRH1KrWhcG6FSj_z8g2TAnIqdqlfrHk/view?usp=sharing
HW2
HW3
Một số mô hình xe tự hành dùng Omni Wheel
How to choose the right AMR (MiR's Autonomous Mobile Robots)
2. Autonomous Navigation Mobile Robot using ROS | Jetson Nano | RPLidar | Differential Drive Kinematics
3. NVIDIA JetBot: Jetson Nano Vision-Controlled AI Robot
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