Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 114 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
114
Dung lượng
5,57 MB
Nội dung
MINISTRY OF EDUCATION AND TRAINING HO CHI MINH CITY UNIVERSITY OF TECHNOLOGY AND EDUCATION FACULTY FOR HIGH QUALITY TRAINING GRADUATION THESIS AUTOMATION AND CONTROL ENGINEERING DESIGN AN INDOOR HOLONOMIC MOBILE ROBOT USING LIDAR ADVISOR : VU VAN PHONG, PHD STUDENTS: NGUYEN THANH TAM TRAN MINH QUAN SKL011279 Ho Chi Minh City, July 2023 HO CHI MINH CITY UNIVERSITY OF TECHNOLOGY AND EDUCATION FALCUTY OF HIGH-QUALITY TRAINING -⸙∆⸙ - GRADUATION THESIS DESIGN AN INDOOR HOLONOMIC MOBILE ROBOT USING LIDAR Student: NGUYEN THANH TAM ID: 19151086 Student: TRAN MINH QUAN ID: 19151078 Major: AUTOMATION AND CONTROL ENGINEERING Advisor: VU VAN PHONG, PHD Ho Chi Minh City, July 2023 i THE SOCIALIST REPUBLIC OF VIETNAM Independence – Freedom– Happiness -Ho Chi Minh City, July , 2023 GRADUATION PROJECT ASSIGNMENT Student name: Nguyen Thanh Tam Student ID: 19151086 Student name: Tran Minh Quan Student ID: 19151078 Major: Automation and Control Engineering Class: 19151CLA Advisor: Ph.D Vu Van Phong Phone number: 0981479507 Date of assignment: 06/02/2023 Date of submission: 14/07/2023 Project title: DESIGN AN INDOOR HOLONOMIC MOBILE ROBOT USING LIDAR Initial materials provided by the advisor: Raspberry Pi Model B Content of the project: - Research and implement omni wheel into the Mobile Robot - Research and implement ROS into the Mobile Robot - Research a solution to supervise and remotely control robot - Design and build hardware robot - Programming to control the robot’s movement - Experiment and improve robot’s flexibility - Evaluate result and write thesis Final product: The complete indoor holonomic mobile robot with the ability to navigate and avoid obstacle CHAIR OF THE PROGRAM (Sign with full name) ADVISOR (Sign with full name) THE SOCIALIST REPUBLIC OF VIETNAM Independence – Freedom– Happiness -Ho Chi Minh City, July …, 2023 ADVISOR’S EVALUATION SHEET Student name: Nguyen Thanh Tam Student ID: 19151086 Student name: Tran Minh Quan Student ID: 19151078 Major: Automation and Control Engineering Project title: DESIGN AN INDOOR HOLONOMIC MOBILE ROBOT USING LIDAR Advisor: Ph.D Vu Van Phong EVALUATION Content of the project: Strengths: Weaknesses: Approval for oral defense? (Approved or denied) Overall evaluation: (Excellent, Good, Fair, Poor) Ho Chi Minh City, (month day, year) ADVISOR (Sign with full name) THE SOCIALIST REPUBLIC OF VIETNAM Independence – Freedom– Happiness -Ho Chi Minh City, July …, 2023 PRE-DEFENSE EVALUATION SHEET Student name: Nguyen Thanh Tam Student ID: 19151086 Student name: Tran Minh Quan Student ID: 19151078 Major: Automation and Control Engineering Project title: DESIGN AN INDOOR HOLONOMIC MOBILE ROBOT USING LIDAR Name of Reviewer: EVALUATION Content and workload of the project Strengths: Weaknesses: Approval for oral defense? (Approved or denied) Reviewer questions for project valuation Mark:……………….(in words: ) Ho Chi Minh City, (month day, year) REVIEWER (Sign with full name) THANK YOU First of all, we would like to sincerely thank all the teachers at Ho Chi Minh City University of Technology and Education in general, and particularly the faculty members of the High-Quality Engineering Department, and especially Mrs Nguyen Tran Minh Nguyet - the head of the Engineering Technology and Automation Control program, who have dedicatedly imparted valuable knowledge to us over the past four years, not only in terms of expertise but also in terms of experiences and necessary skills to confidently step into the future We extend our heartfelt gratitude to Dr Vu Van Phong, who has provided us with support, encouragement, and closely followed our progress throughout the implementation of this research topic We also express our gratitude to the thesis examiners and the faculty members on the defense committee who have taken the time to provide feedback and assistance during the thesis defense process We would like to express our appreciation to our families, friends, and classmates in the 19151CLA who have supported each other throughout the past four years of study Finally, we would like to send our best wishes to the students, faculty, and staff of Ho Chi Minh City University of Technology and Education, wishing them good health and great achievements in the future development of the university ABSTRACT The thesis project “DESIGN AN INDOOR HOLONOMIC MOBILE ROBOT USING LIDAR” have the main task is to design a mobile robot model with compact design, the ability to build indoor environment maps and move to other areas point on the map Moreover, the robot can avoid obstacles on the way to destination Thanks to the combination of Lidar technology sensor and algorithm to find the shortest path to the destination, build on the platform of ROS – Robot Operating System, which is an open operating system that integrates many tools to assist in building robots Moreover, the researchers have designed an omni wheel robot system with size suitable for indoor movement Set up the PID controller for robot to control speed and rotation angular speed to reach the set speed Programming to integrate ROS on holonomic robot to gain the ability of mapping and obstacle avoiding Other feature is to supervise and control robot’s speed and location manually on local monitor Table of Contents CHAPTER 1.OVERVIEW 1.1 Introduction 1.2 Robot’s objective 1.3 Research method 1.4 Thesis’s content CHAPTER 2.THEORETICAL BASIS 2.1 Holonomic robot 2.1.1 Introduction 2.1.2 Compare omni wheel robot with normal wheel robot 2.1.3 Compare omni wheel with wheels 2.1.4 Dynamic Kinematic of the mobile robot 2.1.4.1 Forward kinematic 2.1.4.2 Inverse kinematic 10 ROS – Robot Operating System 11 2.2 2.2.1 Introduce to ROS [3] 11 2.2.2 ROS structure 12 2.2.2.1 ROS filesystem 12 2.2.2.2 ROS Computation Graph Level 14 2.3 SLAM 15 2.3.1 Introduce to SLAM (Simultaneous localization and mapping) 15 2.3.2 Hector SLAM 15 2.3.3 2D Navigation Stack 15 2.3.3.1 Costmap 2D 16 2.3.3.2 Costmap configuration process 16 2.4 Algorithm for global planner and local planner 18 2.4.1 A* algorithm for global planner 18 2.4.2 Dynamic Window Approach algorithm to avoid object for local planner 21 2.4.2.1 The search spaces 21 2.4.2.2 Optimize 22 i 2.5 Protocol 23 2.5.1 UART 23 2.5.2 ROS communication 25 2.6 Control motor with PID algorithm 26 2.6.1 Introduce PID controller 26 2.6.2 Tunning PID parameters Ziggler – Nichols II 28 2.7 Low-pass Filter 29 2.7.1 Introduce Low-pass Filter 29 2.7.2 Calculation 29 CHAPTER 3.HARDWARE DESIGN 31 3.1 Overview robot hardware 31 3.1.1 General diagram of the system 31 3.1.2 Wiring diagram 31 3.2 Design robot frame 33 3.2.1 Layer 34 3.2.2 Layer 36 3.2.3 Layer 37 3.2.4 Full robot frame 38 3.3 Devices used in the project 39 3.3.1 Motor bracket 39 3.3.2 Copper pillar 39 3.3.3 Calculate power for choosing motor 40 3.3.4 Raspberry Pi – 2GB 43 3.3.5 H bridge L298N 44 3.3.6 Arduino Mega 2560 45 3.3.7 RPLidar A1 47 3.3.8 Battery 48 3.3.9 Omni wheel 48 CHAPTER 4.SOFTWARE DESIGN 49 4.1 Robot control program 49 ii 4.1.1 Robot control program in ROS 49 4.1.2 The PID control program 51 4.2 Integrate system in ROS 52 4.2.1 Mapping 52 4.2.1.1 Hector SLAM mapping algorithm 53 4.2.1.2 Save map (map server) 55 4.2.2 Navigation 56 CHAPTER 5.EXPERIMENTS AND RESULTS 58 5.1 Survey PID controller parameter 58 5.1.1 Motor 58 5.1.2 Motor 59 5.1.3 Motor 60 5.1.4 Motor 61 5.1.5 Full robot base 62 5.2 Low-Pass Filter 63 5.2.1 Choosing cut off frequency 63 5.2.2 The result of motor’s speed after applying lowpass filter 64 5.3 Survey kinetic 66 5.4 Survey navigation 68 5.5 Comment 72 CHAPTER 6.CONCLUSION AND IMPROVEMENT 73 6.1 Conclusion 73 6.2 Improvement 73 REFERENCES 75 APPENDIX 76 iii APPENDIX if (pwr4 > 255) { pwr4 = 255; } omni(); if (v0==0) calculate_s(speed, v1, v2, v3, v4, deltaT1); tinhtoan_quangduong_di(speed,angle); omni_speed.data=float(vFilt * 54.2 / 600000); omni_angle.data=float(angle); omni_distance.data=float(distance); // *45/7/1.2533 // pub_speed.publish(&omni_speed); // pub_angle.publish(&omni_angle); // pub_dis.publish(&omni_distance); if(vFilt!=vFiltt) {pub_speed.publish(&omni_speed);vFiltt=vFilt;} if(angle!=anglet) {pub_angle.publish(&omni_angle);anglet=angle;} if(distance!=distancet) {pub_dis.publish(&omni_distance);distancet=distance;} setMotor(dir1, pwr1, PWM1, IN1, IN2); setMotor(dir2, pwr2, PWM2, IN3, IN4); setMotor(dir3, pwr3, PWM3, IN5, IN6); setMotor(dir4, pwr4, PWM4, IN7, IN8); // Positive angular velocity for clockwise turn around //Print // Serial.print(vt1); // Serial.print(" "); // Serial.print(v1Filt); // Serial.print(" "); 86 APPENDIX // Serial.print(vt2); // Serial.print(" "); // Serial.print(v2Filt); // Serial.print(" "); // Serial.print(v3Filt); // Serial.print(" "); // Serial.print(v4Filt); // Serial.print(" "); // Serial.println(angle); // delay(1); nh.spinOnce(); } void setMotor(int dir, int pwmVal, int pwm, int in1, int in2){ analogWrite(pwm,pwmVal); // Motor speed if(dir == 1){ // Turn one way digitalWrite(in1,HIGH); digitalWrite(in2,LOW); } else if(dir == -1){ // Turn the other way digitalWrite(in1,LOW); digitalWrite(in2,HIGH); } else{ // Or dont turn digitalWrite(in1,LOW); digitalWrite(in2,LOW); } 87 APPENDIX } void readEncoder1(){ // Read encoder B when ENCA rises int b1 = digitalRead(ENCB1); int increment1 = 0; if(b1>0){ // If B is high, increment forward increment1 = 1; } else{ // Otherwise, increment backward increment1 = -1; } pos_i1 = pos_i1 + increment1; } void readEncoder2(){ // Read encoder B when ENCA rises int b2 = digitalRead(ENCB2); int increment2 = 0; if(b2>0){ // If B is high, increment forward increment2 = 1; } else{ // Otherwise, increment backward increment2 = -1; } pos_i2 = pos_i2 + increment2; } void readEncoder3(){ 88 APPENDIX // Read encoder B when ENCA rises int b3 = digitalRead(ENCB3); int increment3 = 0; if(b3>0){ // If B is high, increment forward increment3 = 1; } else{ // Otherwise, increment backward increment3 = -1; } pos_i3 = pos_i3 + increment3; } void readEncoder4(){ // Read encoder B when ENCA rises int b4 = digitalRead(ENCB4); int increment4 = 0; if(b4>0){ // If B is high, increment forward increment4 = 1; } else{ // Otherwise, increment backward increment4 = -1; } pos_i4 = pos_i4 + increment4; } float round_7d(float num) { 89 APPENDIX num *= 10000000; int num_temp = round(num); return num_temp /= 10000000; } void tinhtoan_quangduong_di(int v, float degree)//degree integer number pls { vt1 = v * cos(3.14/4+degree)+v0; vt2 = v * sin(3.14/4+degree)*(-1)+v0; vt3 = v * cos(3.14/4+degree)*(-1)+v0; vt4 = v * sin(3.14/4+degree)+v0; } void calculate_s(float s, float v1, float v2, float v3, float v4, float deltaT) { // v(rpm) v=sqrt(pow((abs(v1)+abs(v3))/2,2)+pow((abs(v2)+abs(v4))/2,2)); vFilt = 0.854*vFilt + 0.0728*v + 0.0728*vPrev; vPrev = v; // distance(count) if (cmd_vel_msg.linear.x < 0) distance = distance - ((vFilt+vFiltPrev)/2 * deltaT) * 54.2 / 10000; else distance = distance + ((vFilt+vFiltPrev)/2 * deltaT) * 54.2 / 10000; // if(deltad!=700-distance) // {Serial.print("Vfilt: ");Serial.print(vFilt);Serial.print("\t");Serial.print("V: ");Serial.print(v);Serial.print("\t");Serial.print("Distance: ");Serial.print(deltad); Serial.print("\t");Serial.print("speed: ");Serial.print(speed); // Serial.print("\tTotal distance: ");Serial.println(distance);} // vFiltPrev=vFilt; } void go(float d, float angle) { float dis=d*50; 90 APPENDIX tinhtoan_quangduong_di(speed,angle); deltad=dis-distance; if (deltad>300) {speed=200;} else if (deltad>250) {speed=150 + (deltad-250) * (200-150)/(300-250);} else if (deltad>150) {speed=100 + (deltad-150) * (150-100)/(250-150);} else if (deltad>50) {speed=50 + (deltad-50) * (100-50)/(150-50);} else if (deltad>0) {speed=0 + (deltad-0) * (50-0)/(50-0);} } void stop_omni() { dir1=0; dir2=0; dir3=0; dir4=0; } void joystick() { v0=0; speed = float(sqrt(cmd_vel_msg.linear.x*cmd_vel_msg.linear.x + cmd_vel_msg.linear.y * cmd_vel_msg.linear.y)*16); if(cmd_vel_msg.linear.x>=0 && cmd_vel_msg.linear.y == 0) angle=1.57; else if (cmd_vel_msg.linear.x 0) angle = float(atan(float(cmd_vel_msg.linear.x/cmd_vel_msg.linear.y))); else angle = float(atan(float(cmd_vel_msg.linear.x/cmd_vel_msg.linear.y))+3.1415); } void teleop() { if (cmd_vel_msg.linear.x > 0.3) speed=float(sqrt(cmd_vel_msg.linear.x*cmd_vel_msg.linear.x + cmd_vel_msg.linear.y * cmd_vel_msg.linear.y)*40); 91 APPENDIX else if(cmd_vel_msg.linear.x > 0) speed = 10; else if(cmd_vel_msg.linear.x < 0) speed = -10; else if (cmd_vel_msg.linear.x < -0.3) speed=float(sqrt(cmd_vel_msg.linear.x*cmd_vel_msg.linear.x + cmd_vel_msg.linear.y * cmd_vel_msg.linear.y)*40); else speed = 0; angle = -cmd_vel_msg.angular.z; } void omni() { if ((cmd_vel_msg.angular.z>0)&&(cmd_vel_msg.linear.x==0)) v0 = 0; else if ((cmd_vel_msg.angular.z 95 APPENDIX name="base_link_to_laser" 96 APPENDIX name="base_link_broadcaster" type="rviz_click_to_2d" pkg="rplidar_ros" value="256000" > type="string" value="laser"/> type="bool" value="false"/>