Design and development of a real-time localisation algorithm for the magnetic manipulation of the Magnetic Flexible Endoscope

Colorectal cancer (CRC) is the third leading cause of cancer related death worldwide, and its incidence is constantly rising in developing nations. It usually starts as a benign tumour in the form of a gastrointestinal polyp, which becomes cancerous over time. Colonoscopy is the most common recommended screening procedure. During this exam, a semi-rigid endoscope with diagnostic and therapeutic capabilities is inserted in the colon via the rectum and pushed forward through the large intestine by the physician. However, owing to the method of actuation, traditional colonoscopy often requires long training sessions for the physician and causes patient discomfort. In the past twenty years, a wide range of tethered and wireless devices have been developed to mitigate these limitations, so to decrease the risk associated with the colonoscopy. In this area of research, magnetically actuated and controlled mesoscale capsules have shown to have the potential both to reduce the pain of the patient and simplify the colonoscopy procedure, so to revolutionize GI endoscopy. Among these devices, the Magnetic Flexible Endoscope (MFE), designed and developed by the Science and Technologies Of Robotics in Medicine (STORM) Lab UK and USA, uses a purpose-built magnetic system mounted on the end-effector of a robotic manipulator to control a tethered capsule endoscope. To apply the necessary forces and torques to the endoscopic tip and to enable a precise polyps’ detection, the accurate real-time pose estimation of the device is crucial. Two generations of localization algorithms have been developed. The current version solves the singularity problems faced by the first generation but, being based on the particle filter, is computationally cumbersome. This last feature represents a constraint for real-time performance. The work presented in this Master Thesis is focused on the design of a new localisation algorithm for the MFE based on Kalman Filters. A preliminary research is carried out to identify the most suitable version according to the nonlinear mathematical models used for the prediction of the capsule pose. Special attention is given to the Kalman Filter (KF), Extended Kalman Filter (EKF) and Unscented Kalman Filter (UKF). This preliminary study highlights the impossibility to use traditional EKF and UKF with the currently used magnetic field models and suggests a feasible algorithm based on a Kalman Filter. The estimation method developed hereby represents a proof of concept for the application of this widely used estimator to achieve robust and real-time performances with a lower computational effort. Although static and dynamic tests have been performed to verify the correctness of the algorithm, this localisation method needs to be optimized on the robotic platform. In fact, due to the containment measures against the spread of the new coronavirus COVID-19, the physical Magnetic Flexible Endoscope has not been employed in the project. To overcome this limitation, a detailed ROS simulator of the MFE has been developed in Python and used for the design of the new localisation algorithm. The main target of the simulator, which involves the use of an IMU module and an STM32 Nucleo board, is to generate at 100Hz a set of inertial and magnetic field data as similar as possible to the ones retrieved by the sensors embedded in the physical capsule.