The robotic pill was capable of directed locomotion in complex environments. When placed in the presence of an external magnetic field, the magnetic core embedded in the robotic pill can apply torque force to the whole pill structure to reorient according to the magnetic field lines from the external actuator (Figure 5a). This behavior can actuate the robotic pill in a walking propulsion mechanism, as shown in Figure 5b. The robotic pill is rotated along its longitudinal axis, producing displacement by each magnetic field turn.\cite{Tu2020,Hu2018,Lee2022,Xu2022,Sayed2022,Kosa2019} The robotic pill can be guided through predetermined paths, as illustrated in Figure 5c, which shows the overlap of multiple images taken from Video S3.