ME5621 Mobile Robot control
ME5621 Mobile Robot control - Điều khiển Robot tự hành
ROS2
Cơ hội việc làm:
Công việc của kỹ sư cơ điện tử
https://phenikaa-x.com/?post_type=awsm_job_openings&p=4741
https://www.topcv.vn/viec-lam/ky-su-thiet-ke-co-khi-robotics/726720.html
https://viettelhightech.vn/tuyen-dung/ky-su-dieu-khien-tu-dong-1
https://viettelhightech.vn/tuyen-dung/ky-su-co-khi
Cơ điện tử gần giống kỹ sư điều phối và lắp ráp hệ thống. TIêu biểu nhất là robot, em ko làm mạch, không design khung cơ khí, cũng không ngồi code từng thư viện cho các modul lập trình robot. Mà em biết chọn mạch nào, công suất, tính năng nào để dùng cho con robot, Biết nêu ra ý tưởng cơ cấu cơ khí, khung cho robot để các kỹ sư cơ khí sẽ thiết kế chi tiết cụ thể cho em . Biết cần lập trình cho robot đạt được các yêu cầu nào, ( Xử lý ảnh, AI, hay di chuyển tìm đường) , sử dụng các thư viện nào, để đưa ra định hướng cho team lập trình thực hiện. Còn cấp cao nhất là kỹ sư cơ điện tử chính là CTO giám đốc công nghệ, phân tích và định hướng cho từng Team Cơ khí, Điện Tử, Lập Trình. Vì Kỹ sư cơ điện tử được đào tạo để nắm bắt cả 3 phần do đó sẽ có cái nhìn tổng hợp,bao quát hơn.
Kỹ sư cơ điện tử cũng hoàn toàn có thể làm chuyên sâu về Cơ khí, Điện tử hay Lập Trình. Sau khi được đào tạo và định hướng năm 2,3 các bạn sẽ biết mình có khả năng chọn phát triển cả 3 mảng hay chỉ nên chuyên sâu 1 mảng để phát triển và tận dụng tư duy tổng quát của kỹ sư cơ điện tử để phát triển nâng cao hơn nữa mảng mà mình hướng tới (Cơ khí, điện tử, lập trình)
Chiều Thứ 5, Tiết 7-9, 12h30-15h00 , Mã lớp học trên team: Teamcode : 8ii2b7m
Chiều Thứ 5, Tiết 10-12, 15h05-17h30 , 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ỳ:
Thiết kế một con Micromouse robot kích thước giới hạn: Dài 16cm X rộng 16 cm X Cao không giới hạn.
Lập trình giải mê cung trong thời gian nhanh nhất. Hướng dẫn có tại :
https://sites.google.com/view/hurosclub/projects/7-micromouse-contest
(Nhóm từ 2-5 thành viên (không nhiều hơn 5, 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:
Chiều Thứ 5, Tiết 7-9, 12h30-15h00 DANH SÁCH ĐỘI ĐĂNG KÝ THI ĐẤU
File google drive
https://docs.google.com/spreadsheets/d/1qCU0RpwRC6Bavey22kLE9Yz-2MQazidbUz0KWgJ7yhg/edit?usp=sharing
Chiều Thứ 5, Tiết 10-12, 15h05-17h30 DANH SÁCH ĐỘI ĐĂNG KÝ THI ĐẤU
https://docs.google.com/spreadsheets/d/1KcGmbXJGvFaoeltpm0s_OG_e75YAKTldtInx-FtybIM/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
- Đăng ký tham gia Micromouse robot tổng điểm 20( Trung bình 5)
- Có cố gắng chế tạo robot nhưng chưa chạy được tổng điểm 40(Trung bình 8)
- Có robot tham gia thi đấu tổng điểm 42.5( Trung bình 8.5)
- Top 8 được tổng điểm 50 ( Trung bình 10)
- Xếp thứ 8 -16 : 47,5 Điểm ( Trung bình 9,5)
- Xếp thứ 17 -trở xuống: 45 Điểm ( Trung bình 9)
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 2
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 22.04:
CÁCH 1: (Khuyến khích) Cài trực tiếp trên máy chạy song song 2 hệ điều hành Window và Ubuntu. Tạo một Partion khoảng 30G ~
https://ubuntuhandbook.org/index.php/2022/04/install-ubuntu-2204-step-by-step/
Chọn Step 5: Manually create system partition để tạo partition cài Ubuntu song song với window, hay ubuntu bản cũ hơn
Tạo USB để boot cài Ubuntu :
https://linux.how2shout.com/how-to-create-ubuntu-22-04-bootable-usb-drive-on-windows/
2. Cài đặt hệ điều hành ROS2 humble:
https://docs.ros.org/en/humble/
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 các bài cơ bản Beginer level trong ROS2
Học bài Beginner: CLI tools , Beginner: Client libraries
https://docs.ros.org/en/iron/Tutorials.html
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:
I. Chạy mô phỏng robot trên Ros2 :
https://automaticaddison.com/how-to-simulate-a-robot-using-gazebo-and-ros-2/
Tới đoạn chạy code:
colcon build --packages-select warehouse_robot_spawner_pkg
cd ~/dev_ws/
Cần khai báo package cho ros biết bằng lệnh:
source install/setup.bash
Type the following command để chạy mô phỏng trên máy của các bạn.
Terminal 1: $ source /opt/ros/humble/setup.bash
ros2 launch warehouse_robot_spawner_pkg gazebo_world.launch.py
Terminal 2: ros2 run teleop_twist_keyboard teleop_twist_keyboard --ros-args --remap /cmd_vel:=/demo/cmd_vel
II. Chạy điều khiển robot mô phỏng trên máy chủ thầy Bá:
Step1: Kiểm tra ROS_DOMAIN_ID bang lệnh:
printenv | grep ROS
Hiện lên:
ROS_VERSION=2
ROS_PYTHON_VERSION=3
ROS_DOMAIN_ID=88
ROS_LOCALHOST_ONLY=0
ROS_DISTRO=humble
Nếu ROS_DOMAIN_ID=0 thì cần đổi lại 88 cùng ID với máy thầy
export ROS_DOMAIN_ID=88
hoặc dùng lệnh : echo "export ROS_DOMAIN_ID=<your_domain_id>" >> ~/.bashrc
Step2: Kiểm tra IP cần có 2 số đầu là 10.13
~$ hostname -I
10.13.xxx.xxx
Sau đó:
Check connection:
$ ping 10.13.82.107
PING 192.168.43.56 (192.168.43.56) 56(84) bytes of data.
64 bytes from 192.168.43.56: icmp_seq=1 ttl=64 time=128 ms
64 bytes from 192.168.43.56: icmp_seq=2 ttl=64 time=136 ms
Step3:
Kiểm tra kết nối tới máy thầy Bá bằng lệnh hiện các topic
bblab2204@bblab2204:~$ ros2 topic list
/clock
/demo/laser/out
/demo/odom
/demo_nhom1/laser/out
/demo_nhom1/odom
/demo_nhom10/laser/out
/demo_nhom10/odom
/demo_nhom2/laser/out
/demo_nhom2/odom
......
Nếu lỗi không hiện topic cần restart lại ros2 daemon
$ ss -tulw
$ ros2 daemon stop $ ros2 daemon start
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
Lỗi gazebo chưa tắt hoàn toàn khi dùng Ctl + Z
~/ros2_ws$ ps aux | grep gzserver
~/kill -2 <pid associated with gzserver>
Step 4: Chạy điều khiển robot của nhóm:
~$ros2 run teleop_twist_keyboard teleop_twist_keyboard --ros-args --remap /cmd_vel:=/demo_nhomx/cmd_vel
dùng nút X và C để giảm tốc độ xuống 0.1 và góc quay xuống 0.1
Kiểm tra đã gửi tín hiệu bằng lệnh:
rbblab2204@bblab2204:~/ros2_ws$ ros2 topic echo /demo_nhom1/cmd_vel
linear:
x: 0.0
y: 0.0
z: 0.0
angular:
x: 0.0
y: 0.0
z: 0.0
---
Bài 4:
Chạy mô phỏng robot trên Ros2 :
https://docs.ros.org/en/iron/Tutorials/Intermediate/URDF/Using-URDF-with-Robot-State-Publisher.html
mkdir -p ~/second_ros2_ws/src # change as needed
cd ~/second_ros2_ws/src
git clone https://github.com/benbongalon/ros2-urdf-tutorial.git
cd ~/second_ros2_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:
sudo apt-get -y install python3-rosdep2
Chạy rosdep init
rosdep install --from-paths src --ignore-src -r -y
https://installati.one/install-python3-rosdep2-ubuntu-22-04/
colcon build
source install/setup.bash
Terminal 1: ros2 launch urdf_tutorial demo.launch.py
Terminal 2: rviz2 -d ~/third_ros2_ws/src/ros2-urdf-tutorial/urdf_tutorial/urdf/r2d2.rviz
Bài 5: Các bài tập học thêm trên Ros2
https://github.com/Tinker-Twins/TurtleBot3
Bài 3: Cài đặt và chạy Turtle bot simulation
Các bạn chụp ảnh màn hình mBeginner: CLI toolsá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:
sudo apt-get -y install python3-rosdep2
Chạy rosdep init
rosdep install --from-paths src --ignore-src -r -y
https://installati.one/install-python3-rosdep2-ubuntu-22-04/
~/ros2_ws/src/urdf_tutorial$ ros2 launch urdf_tutorial display.launch.py model:=urdf/01-myfirst.urdf
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/
5. 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
Bài 4: 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 5: Tìm hiểu thuật toán tìm kiếm RRT
https://github.com/RuslanAgishev/motion_planning
https://www.youtube.com/watch?v=Ob3BIJkQJEw&ab_channel=AaronBecker
RRT, RRT* & Random Trees
Tìm hiểu chỉnh sửa code
Bài 6: 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