The Optimization of PID Controller and Color Filter Parameters with a Genetic Algorithm for Pineapple Tracking Using an ROS2 and MicroROS-Based Robotic Head
Abstract
:1. Introduction
2. Proposed System
- Hardware: This layer interfaces with the PTU and the webcam, both of which are part of the robot’s head, to capture the visual information and the angular position of the PTU in the x-y axes. The robot head (Figure 2) is a 3D-printed box with ABS material, containing the webcam, the PTU (Figure 2), and two servo motors. Additionally, it has two LED screens that display the animation of two human eyes. The Logitech C270 HD webcam, mounted on a pan–tilt unit, has a resolution of 1280 × 720 pixels and captures visual information at a maximum rate of 30 frames per second (FPS). The PTU was interfaced with a high-performance 32-bit ARM core Arduino Due microcontroller IT. The range of motion of the PTU is 180 degrees in the x-axis and 130 degrees in the y-axis. The servomotors used to drive the PTU are RDS5160 SSG, capable of a maximum torque of 7 Nm, with each motor powered by 8.4 V and 2.5 A.
- Software: An image processing module was implemented to receive an RGB image, segment the object of interest using a color filter, smooth the image with a 3 × 3 Gaussian filter, and calculate the centroid of the bounding box surrounding the segmented object. OpenCV libraries were employed for image processing task [33]. To effectively segment objects with composite colors, such as the body of a pineapple, a multivariate Gaussian filter (MGF) was developed and trained to detect the pineapple, excluding the crown. The MGF parameters were optimized with a genetic algorithm. The position (x, y) of the centroid of the segmented object in the image plane is published. Subsequently, the PID control evaluates whether the received coordinates match the center of the image plane. If they do not align, the control action is executed on the pan–tilt unit to adjust the position of the webcam and track the object. The graph generated in ROS2 is shown in Figure 4, which includes a node responsible for processing the images, sending the output of the PID controller in the form of coordinates (x, y), and another node that communicates with the Arduino Due board through microROS and receives the data and sends control signals to move the servomotors.
3. Optimization of MG Filter and PID Controller Parameters with a GA
3.1. Multivariate Gaussian Filter (MGF)
Algorithm 1 Genetic Algorithm |
|
3.2. PID Controller
4. Experiments and Results
- Experiment 1: Evaluate the response of the PID controller with the parameters optimized by the GA and tuned manually. The robot head tracked a green-colored object.
- Experiment 2: Evaluate the tracking of a pineapple, using the multivariate Gaussian filter, with parameters optimized by the GA.
4.1. Experiment 1
4.2. Experiment 2
5. Discussion
6. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
References
- Feidakis, M.; Gkolompia, I.; Marnelaki, A.; Marathaki, K.; Emmanouilidou, S.; Agrianiti, E. NAO robot, an educational assistant in training, educational and therapeutic sessions. In Proceedings of the 2023 IEEE Global Engineering Education Conference (EDUCON), Kuwait, Kuwait, 1–4 May 2023; pp. 1–6. [Google Scholar] [CrossRef]
- Sulistijono, I.A.; Rois, M.; Yuniawan, A.; Binugroho, E.H. Teleoperated Food and Medicine Courier Mobile Robot for Infected Diseases Patient. In Proceedings of the TENCON 2021—2021 IEEE Region 10 Conference (TENCON), Auckland, New Zealand, 7–10 December 2021; pp. 620–625. [Google Scholar] [CrossRef]
- Sunardi, M.; Perkowski, M. Behavior Expressions for Social and Entertainment Robots. In Proceedings of the 2020 IEEE 50th International Symposium on Multiple-Valued Logic (ISMVL), Miyazaki, Japan, 9–11 November 2020; pp. 271–278. [Google Scholar] [CrossRef]
- Fischer, K. Defining Interaction as Coordination Benefits both HRI Research and Robot Development: Entering Service Interactions. In Proceedings of the 2023 32nd IEEE International Conference on Robot and Human Interactive Communication (RO-MAN), Busan, Republic of Korea, 28–31 August 2023; pp. 213–219. [Google Scholar] [CrossRef]
- Christensen, H.; Amato, N.; Yanco, H.; Mataric, M.; Choset, H.; Drobnis, A.; Goldberg, K.; Grizzle, J.; Hager, G.; Hollerbach, J.; et al. A roadmap for us robotics—From internet to robotics 2020 edition. Found. Trends Robot. 2021, 8, 307–424. [Google Scholar] [CrossRef]
- Siciliano, B.; Khatib, O.; Kröger, T. Springer Handbook of Robotics; Springer: Berlin/Heidelberg, Germany, 2008; Volume 200. [Google Scholar]
- Cao, Y.; Ke, Z.; Li, S.; Zhao, S.; Wang, J.; Xu, S. Data-Driven Trajectory Tracking Control Algorithm Design for Fast Migration to Different Autonomous Vehicles. In Proceedings of the 2024 IEEE Intelligent Vehicles Symposium (IV), Jeju Island, Republic of Korea, 2–5 June 2024; pp. 2709–2716. [Google Scholar] [CrossRef]
- Ayranci, A.A.; Erkmen, B. Edge Computing and Robotic Applications in Modern Agriculture. In Proceedings of the 2024 International Congress on Human-Computer Interaction, Optimization and Robotic Applications (HORA), Istanbul, Turkey, 23–25 May 2024; pp. 1–6. [Google Scholar] [CrossRef]
- Duca, O.; Minca, E.; Filipescu, A.; Cernega, D.; Solea, R.; Filipescu, A. Flexible Manufacturing with Integrated Robotic Systems in the Context of Industry 5.0. In Proceedings of the 2023 IEEE 28th International Conference on Emerging Technologies and Factory Automation (ETFA), Sinaia, Romania, 12–15 September 2023; pp. 1–7. [Google Scholar] [CrossRef]
- Ariza-Sentís, M.; Vélez, S.; Martínez-Peña, R.; Baja, H.; Valente, J. Object detection and tracking in Precision Farming: A systematic review. Comput. Electron. Agric. 2024, 219, 108757. [Google Scholar] [CrossRef]
- Tang, Y.; Chen, M.; Wang, C.; Luo, L.; Li, J.; Lian, G.; Zou, X. Recognition and Localization Methods for Vision-Based Fruit Picking Robots: A Review. Front. Plant Sci. 2020, 11, 510. [Google Scholar] [CrossRef] [PubMed]
- Hu, N.; Su, D.; Wang, S.; Nyamsuren, P.; Qiao, Y.; Jiang, Y.; Cai, Y. LettuceTrack: Detection and tracking of lettuce for robotic precision spray in agriculture. Front. Plant Sci. 2022, 13, 1003243. [Google Scholar] [CrossRef] [PubMed]
- Su, F.; Fang, G. Moving object tracking using an adaptive colour filter. In Proceedings of the 2012 12th International Conference on Control Automation Robotics & Vision (ICARCV), Guangzhou, China, 5–7 December 2012; IEEE: Piscataway, NJ, USA, 2012; pp. 1048–1052. [Google Scholar]
- Clark, M.; Feldpausch, D.; Tewolde, G.S. Microsoft kinect sensor for real-time color tracking robot. In Proceedings of the IEEE International Conference on Electro/Information Technology, Milwaukee, WI, USA, 5–7 June 2014; IEEE: Piscataway, NJ, USA, 2014; pp. 416–421. [Google Scholar]
- Terven, J.; Córdova-Esparza, D.M.; Romero-González, J.A. A Comprehensive Review of YOLO Architectures in Computer Vision: From YOLOv1 to YOLOv8 and YOLO-NAS. Mach. Learn. Knowl. Extr. 2023, 5, 1680–1716. [Google Scholar] [CrossRef]
- Chen, Y.; Xu, H.; Chang, P.; Huang, Y.; Zhong, F.; Jia, Q.; Chen, L.; Zhong, H.; Liu, S. CES-YOLOv8: Strawberry Maturity Detection Based on the Improved YOLOv8. Agronomy 2024, 14, 1353. [Google Scholar] [CrossRef]
- Ukida, H.; Terama, Y.; Ohnishi, H. Object tracking system by adaptive pan-tilt-zoom cameras and arm robot. In Proceedings of the 2012 Proceedings of SICE Annual Conference (SICE), Akita, Japan, 20–23 August 2012; IEEE: Piscataway, NJ, USA, 2012; pp. 1920–1925. [Google Scholar]
- Saragih, C.F.D.; Kinasih, F.M.T.R.; Machbub, C.; Rusmin, P.H.; Rohman, A.S. Visual Servo Application Using Model Predictive Control (MPC) Method on Pan-tilt Camera Platform. In Proceedings of the 2019 6th International Conference on Instrumentation, Control, and Automation (ICA), Bandung, Indonesia, 31 July–2 August 2019; pp. 1–7. [Google Scholar] [CrossRef]
- Yosafat, S.R.; Machbub, C.; Hidayat, E.M.I. Design and implementation of Pan-Tilt control for face tracking. In Proceedings of the 2017 7th IEEE International Conference on System Engineering and Technology (ICSET), Shah Alam, Malaysia, 2–3 October 2017; pp. 217–222. [Google Scholar] [CrossRef]
- Chen, J.; Tian, G. A Tuning Method for Speed Tracking Controller Parameters of Autonomous Vehicles. Appl. Sci. 2024, 14, 10209. [Google Scholar] [CrossRef]
- Li, K.; Bai, Y.; Zhou, H. Research on Quadrotor Control Based on Genetic Algorithm and Particle Swarm Optimization for PID Tuning and Fuzzy Control-Based Linear Active Disturbance Rejection Control. Electronics 2024, 13, 4386. [Google Scholar] [CrossRef]
- Liang, H.; Zou, J.; Zuo, K.; Khan, M.J. An improved genetic algorithm optimization fuzzy controller applied to the wellhead back pressure control system. Mech. Syst. Signal Process. 2020, 142, 106708. [Google Scholar] [CrossRef]
- Chen, Y.S.; Hung, Y.H.; Lee, M.Y.J.; Chang, J.R.; Lin, C.K.; Wang, T.W. Advanced Study: Improving the Quality of Cooling Water Towers’ Conductivity Using a Fuzzy PID Control Model. Mathematics 2024, 12, 3296. [Google Scholar] [CrossRef]
- Wang, D.; Tan, D.; Liu, L. Particle swarm optimization algorithm: An overview. Soft Comput. 2018, 22, 387–408. [Google Scholar] [CrossRef]
- Arulkumaran, K.; Deisenroth, M.P.; Brundage, M.; Bharath, A.A. Deep reinforcement learning: A brief survey. IEEE Signal Process. Mag. 2017, 34, 26–38. [Google Scholar] [CrossRef]
- Goldberg, D.E. The Design of Innovation: Lessons from and for Competent Genetic Algorithms; Springer Science & Business Media: Berlin/Heidelberg, Germany, 2013; Volume 7. [Google Scholar]
- Lambora, A.; Gupta, K.; Chopra, K. Genetic algorithm—A literature review. In Proceedings of the 2019 International Conference on Machine Learning, Big Data, Cloud and Parallel Computing (COMITCon), Faridabad, India, 14–16 February 2019; IEEE: Piscataway, NJ, USA, 2019; pp. 380–384. [Google Scholar]
- Hernandez-Mendez, S.; Maldonado-Mendez, C.; Marin-Hernandez, A.; Rios-Figueroa, H.V. Detecting falling people by autonomous service robots: A ROS module integration approach. In Proceedings of the 2017 International Conference on Electronics, Communications and Computers (CONIELECOMP), Cholula, Mexico, 22–24 February 2017; pp. 1–7. [Google Scholar] [CrossRef]
- Quigley, M.; Conley, K.; Gerkey, B.; Faust, J.; Foote, T.; Leibs, J.; Wheeler, R.; Ng, A.Y. ROS: An open-source Robot Operating System. In Proceedings of the ICRA Workshop on Open Source Software, Kobe, Japan, 12–17 May 2009; Volume 3, p. 5. [Google Scholar]
- Yang, Y.; Azumi, T. Exploring real-time executor on ros 2. In Proceedings of the 2020 IEEE International Conference on Embedded Software and Systems (ICESS), Shanghai, China, 10–11 December 2020; IEEE: Piscataway, NJ, USA, 2020; pp. 1–8. [Google Scholar]
- Hossain, M. World pineapple production: An overview. Afr. J. Food Agric. Nutr. Dev. 2016, 16, 11443–11456. [Google Scholar] [CrossRef]
- Peng, G.; Lam, T.L.; Hu, C.; Yao, Y.; Liu, J.; Yang, F. Introduction to ROS 2 and Programming Foundation. In Introduction to Intelligent Robot System Design: Application Development with ROS; Springer: Berlin/Heidelberg, Germany, 2023; pp. 541–566. [Google Scholar]
- Sigut, J.; Castro, M.; Arnay, R.; Sigut, M. OpenCV Basics: A Mobile Application to Support the Teaching of Computer Vision Concepts. IEEE Trans. Educ. 2020, 63, 328–335. [Google Scholar] [CrossRef]
- Prince, S.J. Computer Vision: Models, Learning, and Inference; Cambridge University Press: Cambridge, UK, 2012. [Google Scholar]
- Adhilpk. Pineapple Dataset. 2023. Available online: https://www.kaggle.com/datasets/adhilpk/pineapple (accessed on 21 February 2025).
- Borase, R.P.; Maghade, D.; Sondkar, S.; Pawar, S. A review of PID control, tuning methods and applications. Int. J. Dyn. Control 2021, 9, 818–827. [Google Scholar] [CrossRef]
- Tu, Y.H.; Wang, R.F.; Su, W.H. Active Disturbance Rejection Control—New Trends in Agricultural Cybernetics in the Future: A Comprehensive Review. Machines 2025, 13, 111. [Google Scholar] [CrossRef]
- Wang, S.; Wang, M. The strong connectivity of bubble-sort star graphs. Comput. J. 2018, 62, 715–729. [Google Scholar] [CrossRef]
- Pan, C.H.; Qu, Y.; Yao, Y.; Wang, M.J.S. HybridGNN: A Self-Supervised Graph Neural Network for Efficient Maximum Matching in Bipartite Graphs. Symmetry 2024, 16, 1631. [Google Scholar] [CrossRef]
Metric | Value |
---|---|
Mean | 73.12% |
Median | 71.5% |
Standard Deviation | 14.7 |
Best Fit | 98% |
Worst Fit | 53% |
Metric | IAE | Individual |
---|---|---|
Mean | 202.32 | |
Median | 201.50 | |
Standard Deviation | 63.08 | |
Best PanFit | 88 | = 0.20 = 0.010 = 0.534 |
Best Tilt Fit | = 0.23 = 0.008 = 0.535 |
Average Absolute Error (Pixels) | Standard Deviation (Pixels) | |||
---|---|---|---|---|
Optimization Method | Pan | Tilt | Pan | Tilt |
AG | 1.59 | 1.15 | 1.6 | 1.74 |
Manually | 2.64 | 2.32 | 3.82 | 2.81 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Maldonado-Mendez, C.; Ruiz-Paz, S.F.; Machorro-Cano, I.; Marin-Hernandez, A.; Hernandez-Mendez, S. The Optimization of PID Controller and Color Filter Parameters with a Genetic Algorithm for Pineapple Tracking Using an ROS2 and MicroROS-Based Robotic Head. Computation 2025, 13, 69. https://doi.org/10.3390/computation13030069
Maldonado-Mendez C, Ruiz-Paz SF, Machorro-Cano I, Marin-Hernandez A, Hernandez-Mendez S. The Optimization of PID Controller and Color Filter Parameters with a Genetic Algorithm for Pineapple Tracking Using an ROS2 and MicroROS-Based Robotic Head. Computation. 2025; 13(3):69. https://doi.org/10.3390/computation13030069
Chicago/Turabian StyleMaldonado-Mendez, Carolina, Sergio Fabian Ruiz-Paz, Isaac Machorro-Cano, Antonio Marin-Hernandez, and Sergio Hernandez-Mendez. 2025. "The Optimization of PID Controller and Color Filter Parameters with a Genetic Algorithm for Pineapple Tracking Using an ROS2 and MicroROS-Based Robotic Head" Computation 13, no. 3: 69. https://doi.org/10.3390/computation13030069
APA StyleMaldonado-Mendez, C., Ruiz-Paz, S. F., Machorro-Cano, I., Marin-Hernandez, A., & Hernandez-Mendez, S. (2025). The Optimization of PID Controller and Color Filter Parameters with a Genetic Algorithm for Pineapple Tracking Using an ROS2 and MicroROS-Based Robotic Head. Computation, 13(3), 69. https://doi.org/10.3390/computation13030069