BBLAB Facebook - Ba roBotics Lab
Tài liệu lập trình:
https://drive.google.com/drive/folders/1Y4YTGSxzGTCXdKqHomPSifgLwRHjYLqq?usp=sharing
Thông tin về cuộc thi xe tự lái:
Video ví dụ nội dung cuộc thi bên Lạc Hồng: https://www.youtube.com/watch?v=oZCAft02yx
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:
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/
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 20.04 :
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
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://www.youtube.com/watch?v=fclTFQQvQFQ&ab_channel=ProgrammingKnowledge
rostopic echo /automobile/localisation //
Bài 7:
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
3WD Omni Wheel Arduino Robot Car C008
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
1. Autonomous mobile platform with vacuum cleaning
2. Autonomous mobile platform with vacuum cleaning