TY - JOUR
T1 - Feasibility Study for a Python-Based Embedded Real-Time Control System
AU - Cho, Se Yeon
AU - Delgado, Raimarius
AU - Choi, Byoung Wook
N1 - Publisher Copyright:
© 2023 by the authors.
PY - 2023/3
Y1 - 2023/3
N2 - Because of its simplicity and the support of numerous useful libraries, Python has become one of the most popular programming languages for application development, even in embedded systems. However, in existing control systems where specific tasks must meet specific temporal deadlines and support schedulability with proper priority assignments, the Python interpreter may not satisfy real-time requirements, owing to features such as the global interpreter lock and garbage collector. This paper addresses these constraints with an approach that executes periodic real-time tasks under the fixed-priority preemptible scheduler of RT-Preempt. First, we implemented a Python real-time module that allows users to create and execute periodic tasks with fixed priorities based on Python. Then, we conducted experiments on an open embedded system, in this case, a Raspberry Pi 4. We evaluated the real-time performance, focusing on test metrics for control systems, such as task periodicity, responsiveness, and interrupt response. The results were then compared to those of conventional real-time tasks developed using the C language to validate the feasibility of the proposed method. Finally, we performed experimental validation by tracking the position of EtherCAT servo motors to demonstrate the feasibility of a Python-based real-time control system in a practical application.
AB - Because of its simplicity and the support of numerous useful libraries, Python has become one of the most popular programming languages for application development, even in embedded systems. However, in existing control systems where specific tasks must meet specific temporal deadlines and support schedulability with proper priority assignments, the Python interpreter may not satisfy real-time requirements, owing to features such as the global interpreter lock and garbage collector. This paper addresses these constraints with an approach that executes periodic real-time tasks under the fixed-priority preemptible scheduler of RT-Preempt. First, we implemented a Python real-time module that allows users to create and execute periodic tasks with fixed priorities based on Python. Then, we conducted experiments on an open embedded system, in this case, a Raspberry Pi 4. We evaluated the real-time performance, focusing on test metrics for control systems, such as task periodicity, responsiveness, and interrupt response. The results were then compared to those of conventional real-time tasks developed using the C language to validate the feasibility of the proposed method. Finally, we performed experimental validation by tracking the position of EtherCAT servo motors to demonstrate the feasibility of a Python-based real-time control system in a practical application.
KW - EtherCAT
KW - Python
KW - RT-Preempt
KW - embedded systems
KW - real-time
UR - http://www.scopus.com/inward/record.url?scp=85152364030&partnerID=8YFLogxK
U2 - 10.3390/electronics12061426
DO - 10.3390/electronics12061426
M3 - Article
AN - SCOPUS:85152364030
SN - 2079-9292
VL - 12
JO - Electronics (Switzerland)
JF - Electronics (Switzerland)
IS - 6
M1 - 1426
ER -