1. Trang chủ
  2. » Giáo Dục - Đào Tạo

Designing and manufacturing a 6 dof delta robot industrial appications and image processing for product classification

169 4 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

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 DESIGNING AND MANUFACTURING A 6-DOF DELTA ROBOT IN INDUSTRIAL APPLICATIONS AND IMAGE PROCESSING FOR PRODUCT CLASSIFICATION ADVISOR : DANG XUAN BA, PH.D STUDENTS: LE MINH TRI NGUYEN GIA HY SKL010847 Ho Chi Minh City, June 2023 HO CHI MINH CITY UNIVERSITY OF TECHNOLOGY AND EDUCATION FACULTY FOR HIGH QUALITY TRAINING GRADUATION THESIS DESIGNING AND MANUFACTURING A 6-DOF DELTA ROBOT IN INDUSTRIAL APPLICATIONS AND IMAGE PROCESSING FOR PRODUCT CLASSIFICATION Student 1: LE MINH TRI ID: 19151088 Student 2: NGUYEN GIA HY ID: 19151058 Major: Automation and Control Engineering Advisor: DANG XUAN BA, Ph.d Ho Chi Minh City, June 30th, 2023 THE SOCIALIST REPUBLIC OF VIETNAM Independence – Freedom– Happiness Ho Chi Minh City, June 30th, 2023 GRADUATION PROJECT ASSIGNMENT Student name: LE MINH TRI Student ID: _19151088 Student name: NGUYEN GIA HY Student ID: _19151058 Student name: Student ID: _ Major: Control and Automation Engineering Class: 19151CLA Advisor: _DANG XUAN BA, Ph.d _ Phone number: 0945 853 990 _ Date of assignment: _ Date of submission: _ Project title: _ Design and manufacture a 6-DOF Delta robot in industrial applications and image processing for product classification _ Initial materials provided by the advisor: Content of the project: Calculation and hardware design of a 6-DOF Delta robot model Researching algorithms and simulating the 6-DOF Delta robot model using Matlab software. _ Constructing a robot using SolidWorks software Applying control algorithms to the physical model, implementing image processing for product shape classification, and subsequently storing the classified products in a warehouse. Designing the user interface using C# in Visual Studio Code, incorporating query and data storage functionality using SQL Server for system login and storing the results of product classification. Comments and conclusions Final product: An experimental model of robot Delta-6 degrees of freedom/ Program control and monitoring/Graduation project report book / CD CHAIR OF THE PROGRAM ADVISOR (Sign with full name) (Sign with full name) THE SOCIALIST REPUBLIC OF VIETNAM Independence – Freedom– Happiness Ho Chi Minh City, June 30 th, 2023 ADVISOR’S EVALUATION SHEET Student name: .LE MINH TRI Student ID: .19151088 Student name: NGUYEN GIA HY Student ID: 19151058 Student name: Student ID: Major: Control and Automation Engineering Project title: …………… Design and manufacture a 6-DOF Delta robot in industrial applications and image processing for product classification Advisor: DANG XUAN BA, Ph.d EVALUATION Content of the project: Strengths: Weaknesses: Approval for oral defense? (Approved or denied) Overall evaluation: (Excellent, Good, Fair, Poor) Mark:………………………… Ho Chi Minh City, June 30th, 2023 ADVISOR (Sign with full name) THE SOCIALIST REPUBLIC OF VIETNAM Independence – Freedom– Happiness Ho Chi Minh City, June 30 th, 2023 PRE-DEFENSE EVALUATION SHEET Student name: LE MINH TRI Student ID: 19151088 Student name: NGUYEN GIA HY Student ID: 19151058… Student name: Student ID: Major: Control and Automation Engineering Project title: Design and experimental a 6-DOF Delta robot in industrial applications and image processing for product classification Name of Reviewer: EVALUATION Content and workload of the project Strengths: Weaknesses: Approval for oral defense? (Approved or denied) Overall evaluation: (Excellent, Good, Fair, Poor) Mark:………………………… Ho Chi Minh City, June 30th, 2023 REVIEWER (Sign with full name) THE SOCIALIST REPUBLIC OF VIETNAM Independence – Freedom– Happiness EVALUATION SHEET OF DEFENSE COMMITTEE MEMBER Student name: LE MINH TRI Student ID: 19151088 Student name: NGUYEN GIA HY Student ID: 19151058 Student name: Student ID: Major: .Control and Automation Engineering Project title: Design and manufacture a 6-DOF Delta robot industrial applications and image processing for product classification Name of Defense Committee Member: EVALUATION Content and workload of the project Strengths: Weaknesses: Overall evaluation: (Excellent, Good, Fair, Poor) Mark:………………………… Ho Chi Minh City, December 27th, 2022 MEMBER (Sign with full name) Author: Le Minh Tri – Nguyen Gia Hy Advisor: Dang Xuan Ba THANK YOU As a devoted Ho Chi Minh City University of Technology and Education student, the graduation thesis is a testament to the knowledge we have cultivated throughout our four years of study While completing this pivotal project, we received wholehearted guidance from Dr DANG XUAN BA First and foremost, we would like to express our heartfelt gratitude and deep appreciation to our advisor, Dr Dang Xuan Ba, who directly guided our graduation thesis Dr Ba gave us guidance, encouragement, and support throughout the research and project implementation processes Our emotions and gratitude flow like mighty rivers, for Dr Ba, have imparted knowledge, passion, and confidence that empowers us to strive in our academic pursuits We will forever hold in our hearts invaluable advice and unwavering support from our advisor, and we will cherish our achievements with profound gratitude and utmost respect for this remarkable mentor In addition, during the four years of study at Ho Chi Minh City University of Technology and Education, we have always received wholehearted support and invaluable knowledge from our esteemed teachers, colleagues who teaches in the Faculty of High Quality Training, Faculty of Electrical and Electronics Engineering, and friends Each lesson served as a precious treasure for our life journeys We express our heartfelt thanks to our respected teachers and companions, who have always created the most favorable conditions for our learning and growth Finally, we are deeply grateful to our beloved family and cherished friends, whose unwavering encouragement, support, and assistance have been our guiding lights throughout the arduous journey of completing our graduation thesis Their boundless love and heartfelt belief in us have been the pillars of strength that propelled us forward, enabling us to overcome obstacles and complete our thesis Words cannot fully capture the depth of our appreciation and the profound bond we share with our family and friends, whose presence and unwavering faith have been a constant source of inspiration and motivation We owe our achievements to our dedication and the steadfast love and support surrounding us Finally, we would like to extend our heartfelt wishes for abundant health and great success to all our respected teachers who have dedicated themselves to the noble profession Author: Le Minh Tri – Nguyen Gia Hy Advisor: Dang Xuan Ba of teaching We also wish our beloved family members and friends good health and prosperity in their lives May their paths be filled with happiness, achievements, and fulfillment Once again, we express our sincere appreciation and gratitude MEMBER (Sign with full name) Le Minh Tri Nguyen Gia Hy Author: Le Minh Tri – Nguyen Gia Hy Advisor: Dang Xuan Ba SUMMARY TOPIC: DESIGNING AND MANUFACTURING A 6-DOF DELTA ROBOT INDUSTRIAL APPLICATIONS AND IMAGE PROCESSING FOR PRODUCT CLASSIFICATION STUDENT IMPLEMENTATION: LE MINH TRI 19151088 19151CLA3 NGUYEN GIA HY 19151058 19151CLA1 CONTENT: Enhancing the Delta robot model to operate within a wider working area necessitates the utilization of color classification image processing and precise angle control to ensure accurate product sorting and storage Following the completion of the project, our team's model successfully met the set requirements Moreover, we acquired knowledge of image processing, stepper motor control, DC servo motor control, and the utilization of Arduino controllers Author: Le Minh Tri – Nguyen Gia Hy Advisor: Dang Xuan Ba ABSTRACT In our project, we propose a novel 6-DOF Delta robot and present a comprehensive analysis of its kinematics and dynamics The robot design consisted of a traditional 3-DOF Delta mechanism combined with a 3-DOF serial mechanism Forward kinematics is established using a geometric method, whereas inverse kinematics are derived using the DenavitHartenberg (D-H) matrix method In addition, we utilized a PID controller to control the three DC servo motors of the Delta robot, aiming to enhance the precision and response time during control The Blob detection method was employed to identify the shape of the object to be classified and determine its position relative to the center of the image frame In addition, the team also handles objects deviating from the plane's horizontal plane to place the object in the warehouse position in the most accurate way Based on this information, the end-effector position of the Delta robot was determined to perform suction and subsequently move the object to the corresponding storage location based on its shape Simulation and experimental results were provided to demonstrate the feasibility and advantages of the proposed Delta robot model Keywords: Delta robot, SQL Database server, Parallel robots, Blob detection, geometric method 10 CHAPTER 7: RESULTS Figure 7.15 After the object is brought to the bottom of the warehouse, the robot moves back to the waiting position 7.4 Experiment With The Robot Delta 6-DOF Under Different Lighting Conditions The team experimented with different lighting conditions for the robot to work, thereby deducing the appropriate light level for the workspace of the delta robot with degrees of freedom The process is done with stages, which are separate brightness levels, including normal light, dim light, and dark The stages will include 20 attempts with patterns square, round, triangle, and special cases The table below is a summary of the group's delta robot's percentage of successful execution Table 7.2 Testing Result Lightning level Lamp light Dim light Normal light Dark Sum of product 20 20 20 20 Rectangl e N/A Circle 5 N/A Triangl e N/A Pas s 18 18 17 Fail Efficienc y 90% 90% 85% 20 0% In concluding, After testing our 6-DOF Delta robot operating under different light levels, the team concluded that the robot works best in room light and normal light In a maximum of minute, the robot can identify and return to the warehouse position up to objects and the execution time for each object is 25 seconds The reason why it takes so long to each step is because it takes seconds to send the signal from C# to the adruino to avoid signal interference, so the robot can't perform fast steps continuously 155 CHAPTER 8: CONCLUSION CHAPTER 8: CONCLUSION 8.1 Conclusion 8.1.1 Objectives Accomplished During basically nearly months of implementing the project, we generally have achieved the following specific results:  Connect, as well as, for the most part, perform communication between Arduino and electronic components pretty, such as Stepper motors, Servo motors, conveyors, sensors, and cameras  Basically, simulate and demonstrate the dynamics for delta robot degrees of freedom on Matlab application  Design essentially calculates as well as minimizes construction costs for the 6step delta robot model, generally contrary to popular belief  Process images through the AForge library on the visual studio in C# language  Give time and regulations for the robot to perform with opacity, which is mostly quite significant  Data transfer has been done day by day on the SQL server to kind of facilitate monitoring of robot activities, which is quite significant  Essentially ensure the best and most convenient movement for the robot in the process of defining and classifying products, particularly contrary to popular belief 8.1.2 Limitations Of The Topic With the project implementation time not fairly long enough, after the system essentially was completed, the group also really noticed several shortcomings that could not kind of be mostly overcome as follows:  The kind of signal sent from the Arduino through the electronic components as well as the motor kind of is not continuous in a particularly big way  The motor speed cannot be synchronized between the Servo motor, Step motor, and conveyor; this greatly generally affects the time of tensioning, measuring the time of picking up, the time of receiving the general next object as well as determining the time, which for the most part is fairly significant The center position of the object, or so they thought  Because the source of the conveyor is using an adapter, after a period of use, it is likely particularly be lost, so it mostly needs to kind of be adjusted, which is also significant  Picking and dropping objects cannot be placed with basically absolute accuracy in a fairly big way  It takes time to particularly find materials to really make the model, plus, to constantly change accessories to, for most part, achieving sort of better results, but still cannot fully optimize the 6-level Delta robot mode subtly 156 CHAPTER 8: CONCLUSION 8.2 Development Direction With the kind of potential of this topic, the system still mostly has particularly many development directions that can be achieved in the future, very such as:  Instead of using a timer to time the determination as well as the kind of pick up the object, it is possible to literally in the range before the pickup position to optimize the accuracy in determining the center of the object  Use the cruise switch that has been set up on the Delta robot model, particularly contrary to popular belief Currently, the limit switch only works for actual manual “SetHome”, so it essentially is not optimized in a big way It is possible to wire the limit switch with the Arduino so that when the motor generally runs over the allowable limit, we can easily, for all intents and purposes, determine through the Arduino fairly signal returned by the limit switch, which will be for kind of more model in a subtle way But that will be quite difficult because it is most difficult for Arduino to both essentially receive and send signals to the Visual Code interface, which can cause ignorance and damage the system, showing how currently the limit switch only works for pretty manual “SetHome”, so it is not optimized in many ways  It is possible to upgrade the image processing feature one more step, which is, for the most part, color classification because, in our model, we have already classified products by shape in a major way that can make sense, so they thought  Instead of using Arduino essentially be replaced with a PLC to essentially facilitate the transmission and reception of signals continuously for fairly easy management, making the system essentially operate pretty much more smoothly and difficult to encounter interference during operation 157 REFERENCES REFERENCES You Wu, Zhen Yang, Zhuang Fu, Jian Fei and Hui Zheng, Kinematics and dynamics analysis of a novel five-degrees-of-freedom hybrid robot International Journal of Advanced Robotic Systems, May-June 2017 [1] [2] Minglei Zhu, Control-based design of Robots Automatic École centrale de Nantes, 2020 [3] Robert L Williams II, Ph.D., The Delta Parallel Robot: Kinematics Solutions Ohio University, October 2016 Fu-Shin Lee, Chen-I Lin, Controller Design for a Delta Robot Using Lagrangian Multipliers This work is licensed under a CC BY 4.0 License, September 23rd, 2021 [4] A Klimchik, A Gribok, and J Law, Design and Control of a Delta Robot with High-Load Capacity Journal of Robotic Systems, vol 23, no 12, pp 1165-1172, 2006 [5] J Angeles and C López-Cajún, Delta robot: kinematics, statics and design optimization Mechanism and Machine Theory, vol 33, no 7, pp 849-870, 1998 [6] M H Korayem and M H Korayem, A comprehensive review on delta robot manipulators Robotics and Autonomous Systems, vol 99, pp 135-160, 2018 [7] [8] P Wenger, Theoretical aspects of the Delta parallel robot The International Journal of Robotics Research, vol 13, no 6, pp 523-534, 1994 L Wu, Y Luo, and Q Xu, Dynamic Modeling and Analysis of a Delta Parallel Robot Robotica, vol 34, no 10, pp 2325-2339, 2016 [9] A Klimchik, A Gribok, and V Glazunov, Identification of kinematic parameters of a Delta robot using least squares method in Proceedings of the 2006 IEEE International Conference on Robotics and Automation, Orlando, FL, USA, 2006, pp 2831-2836 [10] [11] H Xin, F Gao, and T Wang, Motion Control of a 3-DOF Delta Robot in Proceedings of the 2009 International Conference on Advanced Mechatronics, Singapore, 2009, pp 109-114 M R Khedekar, A C Rao, and S M Shirsat, Forward kinematics analysis of Delta robot using D-H method in Proceedings of the 2017 International Conference on Computing, Communication and Automation, Greater Noida, India, 2017, pp 12711276 [12] 158 REFERENCES J Caro, J Gallardo, and P Jiménez, Delta robot control for surface following tasks using contact force measurements Robotics and Computer-Integrated Manufacturing, vol 28, no 6, pp 729-739, 2012 [13] H Cheng, D Wang, and S Shi, A new trajectory tracking control of a parallel Delta robot In Proceedings of the 2009 IEEE International Conference on Information and Automation, Zhuhai, China, 2009, pp 1995-1999 [14] R H Peer and R R Murphy, Trajectory Planning for a Degree-of-Freedom Delta Robot Journal of Mechanical Design, vol 119, no 4, pp 481-485, 1997 [15] C R Boier-Martin, R Stefan, and D V Sangeorzan, Kinematic Analysis of a Degrees of Freedom Parallel Robot In Proceedings of the 11th International Conference on Optimization of Electrical and Electronic Equipment (OPTIM), Brasov, Romania, 2008, pp 1061-1066 [16] M Zoppi, A Porta, and A Legnani, On the Design of a DOF Delta Parallel Robot with a Prismatic Actuation System In Proceedings of the ASME 2014 International Design Engineering Technical Conferences and Computers and Information in Engineering Conference, Buffalo, New York, USA, 2014, pp V005T06A018 [17] G J Ren and L W Tsai, Parallel Delta Robots with Flexible Chains: A Comparative Study Mechanism and Machine Theory, vol 37, no 6, pp 589-607, 2002 [18] Y Lu and D Wang, Visual Tracking Control of a Delta Robot Based on Color and Shape Information In Proceedings of the 2014 IEEE International Conference on Robotics and Biomimetics (ROBIO), Bali, Indonesia, 2014, pp 219-224 [19] Y K Wong, R Nakajima, and T Hasegawa, Vision-Based Shape Recognition and Pose Estimation of Objects for Robot Manipulation In Proceedings of the 2012 IEEE International Conference on Robotics and Biomimetics (ROBIO), Guangzhou, China, 2012, pp 2511-2516 [20] Z Zhang, L Zhang, and G Qiu, A Visual Servo System for Robot Manipulation Using Shape Recognition In Proceedings of the 2011 International Conference on Advanced Mechatronic Systems, Tokyo, Japan, 2011, pp 1-6 [21] J Zhang, W R Huang, and J Liu, A Vision-Based Shape Recognition System for Robot Grasping In Proceedings of the 2009 International Conference on Information Engineering and Computer Science (ICIECS), Wuhan, China, 2009, pp 14 [22] 159 APPENDIX APPENDIX: Image processing coding program by C# language: #region detecting Rectangle if (_shapeChecker.IsQuadrilateral(_edgePoint, out _corners))//Hàm sử dụng để kiểm tra xem đối tượng có hình tứ giác hay không { //Drawing the reference point of the picturebox _g.DrawEllipse(_PictureboxPen, (float)(blobdetect_image.Size.Width), (float)(blobdetect_image.Size.Height), (float)10, (float)10); // Tạo mảng Rectangle[] chứa tọa độ đối tượng phát vẽ hình chữ nhật bao quanh chúng (_g.DrawPolygon) Rectangle[] _rects = _blobCounter.GetObjectsRectangles(); System.Drawing.Point[] _coordinates = ToPointsArray(_corners); Pen _pen = new Pen(Color.Blue, ipenWidth); Pen redPen = new Pen(Color.Red, ipenWidth);//sua 962023 int _x = _coordinates[0].X; int _y = _coordinates[0].Y; /// Drawing outline of detected object string _shapeString = "" + _shapeChecker.CheckShapeType(_edgePoint); _g.DrawString(_shapeString, _font, _brush, _x, _y); _g.DrawPolygon(_pen, _coordinates); // Drawing setting for centroid of detected object if (_coordinates.Length == && !hasFirstCentroid_rectangle && !hasProcessedQuadrilateral) { int _centroid_X = (int)_blobPoints[0].CenterOfGravity.X; int _centroid_Y = (int)_blobPoints[0].CenterOfGravity.Y; // Vẽ hình trịn tâm blob _g.DrawEllipse(redPen, _centroid_X, _centroid_Y, 10, 10); 160 APPENDIX //Position calculation int _pos_x = (int)_centroid_X - blobdetect_image.Size.Width; _real_x = _pos_x * ptcm; int _pos_y = blobdetect_image.Size.Height - (int)_centroid_Y; _real_y = _pos_y * ptcm; // Hiển thị giá trị tâm position_txt.Text = ("Position: (" + _real_x + ", " + _real_y + ")"); // khiem tra goc lech cua vật if (_corners != null && _corners.Count == 4) { IntPoint bottomLeft = _corners[0]; IntPoint bottomRight = _corners[3]; // Tính tốn độ lệch theo trục Ox baseAngle = Math.Atan2(bottomRight.Y bottomRight.X - bottomLeft.X) * 180 / Math.PI; - bottomLeft.Y, // Vẽ vector cạnh đáy hình vng _g.DrawLine(redPen, bottomLeft.X, bottomLeft.Y, bottomRight.X, bottomRight.Y); // Vẽ đường thẳng phương ngang từ điểm bottom left int horizonEndX = blobdetect_image.Size.Width; // Điểm kết thúc bên phải hình ảnh int horizonEndY = bottomLeft.Y; // Giữ nguyên độ cao bottom left _g.DrawLine(redPen, bottomLeft.X, bottomLeft.Y, horizonEndX, horizonEndY); } // Hiển thị giá trị góc lệch baseangle_autovalue.Text = Convert.ToString(baseAngle); // Hiển thị giá trị góc xoay theta6 deviationangle = 90 - baseAngle; 161 APPENDIX deviationangle_autovalue.Text = Convert.ToString(deviationangle); // Đánh dấu lấy giá trị tâm hasFirstCentroid_rectangle = true; hasProcessedQuadrilateral = true; //Đếm sản phẩm hình tứ giác thu ObjectsCount++; QuadrilateralCount++; txt_numberofobjects.Text = Convert.ToString(ObjectsCount); txt_rextangleobj.Text = Convert.ToString(QuadrilateralCount); PassObjectsCount++; txt_objpass.Text = Convert.ToString(PassObjectsCount); //check vi tri kho vitrikho = 3; warehouse_valueauto.Text = Convert.ToString(vitrikho); //phần tính tốn động học nghịch để di chuyển robot Double Z1 = -68; x_position_auto.Text = Convert.ToString(_real_x); y_position_auto.Text = Convert.ToString(_real_y); z_position_auto.Text = Convert.ToString(Z1); StorageSquareObject();//dua toi vi tri luu kho bấm thả Sensor_Value(); } //size of rectange foreach (Rectangle rc in _rects) { ///for debug //System.Diagnostics.Debug.WriteLine( // string.Format("Rect size: ({0}, {1})", rc.Width, rc.Height)); iFeatureWidth = rc.Width; //check the FindDistance method 162 APPENDIX double dis = FindDistance(iFeatureWidth); _g.DrawString(dis.ToString("N2") + "cm", _font, _brush, _x, _y + 60); } } else if (_shapeChecker.IsCircle(_edgePoint, out _center, out _radius) || _shapeChecker.IsTriangle(_edgePoint, out _corners)) { hasFirstCentroid_rectangle = false; hasProcessedQuadrilateral = false; // khơng phải hình tứ giác reset lại biến hasProcessedQuadrilateral} } #endregion #region detecting Circle /// /// _center: the center of circle /// _radius: the radius of circle /// if (_shapeChecker.IsCircle(_edgePoint, out _center, out _radius)) { //Drawing the reference point _g.DrawEllipse(_PictureboxPen, (float)(blobdetect_image.Size.Width), (float)(blobdetect_image.Size.Height), (float)10, (float)10); // Drawing setting for outline of detected object Rectangle[] _rects = _blobCounter.GetObjectsRectangles(); Pen _pen = new Pen(Color.Blue, ipenWidth); string _shapeString = "" + _shapeChecker.CheckShapeType(_edgePoint); int _x = (int)_center.X; int _y = (int)_center.Y; /// 163 APPENDIX /// Drawing outline of detected object /// _g.DrawString(_shapeString, _font, _brush, _x, _y); _g.DrawEllipse(_pen, (float)(_center.X - _radius), (float)(_center.Y - _radius), (float)(_radius * 2), (float)(_radius * 2)); //sửa tối 4/4/2023 if (!hasFirstCentroid_circle && !hasProcessedCircle) { //Drawing the centroid point of object int _centroid_X = (int)_blobPoints[0].CenterOfGravity.X; int _centroid_Y = (int)_blobPoints[0].CenterOfGravity.Y; _g.DrawEllipse(_pen, (float)10, (float)10); (float)(_centroid_X), (float)(_centroid_Y), //Position calculation int _pos_x = _centroid_X - blobdetect_image.Size.Width; _real_x = _pos_x * ptcm; int _pos_y = blobdetect_image.Size.Height - _centroid_Y; _real_y = _pos_y * ptcm; // Hiển thị giá trị tâm position_txt.Text = ("Position: (" + _real_x + ", " + _real_y + ")"); // Đánh dấu lấy giá trị tâm hasFirstCentroid_circle = true; hasProcessedCircle = true; //Đếm sản phẩm hình trịn thu ObjectsCount++; CircleCount++; txt_numberofobjects.Text = Convert.ToString(ObjectsCount); 164 APPENDIX txt_circleobj.Text = Convert.ToString(CircleCount); PassObjectsCount++; txt_objpass.Text = Convert.ToString(PassObjectsCount); //check vi tri kho vitrikho = 180; warehouse_valueauto.Text = Convert.ToString(vitrikho); //phần tính tốn động học nghịch để di chuyển robot Double Z1 = -68; x_position_auto.Text = Convert.ToString(_real_x); y_position_auto.Text = Convert.ToString(_real_y); z_position_auto.Text = Convert.ToString(Z1); StorageCircleObject();//dua toi vi tri luu kho bấm thả Sensor_Value(); } //size of rectange foreach (Rectangle rc in _rects) { ///for debug //System.Diagnostics.Debug.WriteLine( // string.Format("Circle size: ({0}, {1})", rc.Width, rc.Height)); iFeatureWidth = rc.Width; double dis = FindDistance(iFeatureWidth); _g.DrawString(dis.ToString("N2") + "cm", _font, _brush, _x, _y + 60); } } else if (_shapeChecker.IsQuadrilateral(_edgePoint, _shapeChecker.IsTriangle(_edgePoint, out _corners)) out _corners) || { hasFirstCentroid_circle = false; 165 APPENDIX hasProcessedCircle = false; // khơng phải hình tứ giác reset lại biến hasProcessedCircle} } #endregion #region detecting Triangle if (_shapeChecker.IsTriangle(_edgePoint, out _corners)) { //Drawing the reference point _g.DrawEllipse(_PictureboxPen, (float)(blobdetect_image.Size.Width), (float)(blobdetect_image.Size.Height), (float)10, (float)10); // Tạo mảng Rectangle[] chứa tọa độ đối tượng phát vẽ tam giác bao quanh chúng (_g.DrawPolygon) Rectangle[] _rects = _blobCounter.GetObjectsRectangles(); System.Drawing.Point[] _coordinates = ToPointsArray(_corners); Pen _pen = new Pen(Color.Blue, ipenWidth); Pen redPen = new Pen(Color.Red, ipenWidth);//sua 1062023 int _x = _coordinates[0].X; int _y = _coordinates[0].Y; /// /// Drawing outline of detected object /// string _shapeString = "" + _shapeChecker.CheckShapeType(_edgePoint); _g.DrawString(_shapeString, _font, _brush, _x, _y); _g.DrawPolygon(_pen, ToPointsArray(_corners)); /// if (_coordinates.Length == && !hasFirstCentroid_triangle && !hasProcessedTriangle) { // Drawing setting for centroid of detected object int _centroid_X = (int)_blobPoints[0].CenterOfGravity.X; 166 APPENDIX int _centroid_Y = (int)_blobPoints[0].CenterOfGravity.Y; //Drawing the centroid point of object _g.DrawEllipse(_pen, (float)10, (float)10); (float)(_centroid_X), (float)(_centroid_Y), //Position calculation int _pos_x = (int)_centroid_X - blobdetect_image.Size.Width; _real_x = _pos_x * ptcm; int _pos_y = blobdetect_image.Size.Height - (int)_centroid_Y; _real_y = _pos_y * ptcm; // Hiển thị giá trị tâm position_txt.Text = ("Position: (" + _real_x + ", " + _real_y + ")"); // khiem tra goc lech cua vật if (_corners != null && _corners.Count == 3) { IntPoint point1 = _corners[0]; IntPoint point2 = _corners[1]; IntPoint point3 = _corners[2]; // Vẽ vector cạnh đáy hình vng _g.DrawLine(redPen, point1.X, point1.Y, point3.X, point3.Y); // Tính toán vẽ vector phương ngang điểm đáy bên trái IntPoint bottomLeft = _corners.OrderBy(p => p.Y).Last(); IntPoint horizontalPoint = new IntPoint(bottomLeft.X + 200, bottomLeft.Y); _g.DrawLine(redPen, horizontalPoint.X, horizontalPoint.Y); bottomLeft.X, bottomLeft.Y, // Tính tốn độ lệch theo trục Ox baseAngle = Math.Atan2(point3.Y - point1.Y, point3.X - point1.X) * 180 / Math.PI; absoluteAngle = Math.Abs(baseAngle); } // Hiển thị giá trị góc lệch 167 APPENDIX baseangle_autovalue.Text = Convert.ToString(absoluteAngle); // Hiển thị giá trị góc xoay theta6 deviationangle = 90 - baseAngle; deviationangle_autovalue.Text = Convert.ToString(deviationangle); // Đánh dấu lấy giá trị tâm hasFirstCentroid_triangle = true; hasProcessedTriangle = true; //Đếm sản phẩm hình tam giác thu ObjectsCount++; TriangleCount++; txt_numberofobjects.Text = Convert.ToString(ObjectsCount); txt_triobj.Text = Convert.ToString(TriangleCount); PassObjectsCount++; txt_objpass.Text = Convert.ToString(PassObjectsCount); //check vi tri kho vitrikho = 91; warehouse_valueauto.Text = Convert.ToString(vitrikho); //phần tính tốn động học nghịch để di chuyển robot Double Z1 = -68; x_position_auto.Text = Convert.ToString(_real_x); y_position_auto.Text = Convert.ToString(_real_y); z_position_auto.Text = Convert.ToString(Z1); StorageTriangleObject();//dua toi vi tri luu kho bấm thả Sensor_Value(); } //size of rectange foreach (Rectangle rc in _rects) { ///for debug 168 S K L 0

Ngày đăng: 28/12/2023, 18:51

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN