Watch Your Callback: Offline Anomaly Detection Using Machine Learning in ROS 2 - Jeonghwan Kang; Kyounghwan Kim; Donghyun Kwon (IEEE Access)
Robotic systems are increasingly prevalent across various fields, necessitating a strong focus on safety and security. The evolution from ROS 1 to ROS 2 has addressed many security concerns; however, it has also introduced new challenges, particularly in anomaly detection due to its decentralized architecture. This shift emphasizes the need for robust methods to monitor and analyze system behavior, as traditional techniques tailored for centralized systems may overlook subtle anomalies. In this paper, we propose an offline anomaly detection using machine learning in ROS 2. Our methodology leverages the widely adopted ros2_tracing framework for efficient and automated data collection, and employs Turtlebot3 running Cartographer SLAM in a Gazebo simulation environment that closely mimics real-world conditions. We further enhance our evaluation by applying controlled fault injection and data augmentation techniques to simulate both malicious and benign anomalies. In our experiments, we utilize multiple machine learning models, including Isolation Forest, OCSVM, and Autoencoder, to analyze the temporal characteristics of callbacks, focusing on response time and invocation frequency. Based on our evaluation, Isolation Forest achieved an F1 score of up to 0.94 with a false positive rate of 1.3%, OCSVM reached an F1 score of up to 0.98 with a false positive rate of around 1.7%, and the Autoencoder attained an F1 score of up to 0.99 with a false positive rate as low as 1.0%.