Abstract Soft millirobot has attracted significant attention and demonstrated tremendous potential in human-robot interactions and safety inspections. Locomotion and perception are two crucial features for achieving effective gait and practical applications of robots. Inspired by nature, this research reports a magnetic soft millirobot that integrates locomotion and sensing capacities simultaneously. Microconical matrix with rich and regular surface morphologies are constructed directly inside the millirobot as both multilegged and triboelectric-enhanced sensing structures via cooperation of jet printing and magnetization-induction method with high-speed and high-precision. The robot can both recognize its current body state across various application scenarios and identify terrains through a machine learning strategy. Our work presents a customizable approach for smart millirobots to perform tasks in nonmagnetic structured environments and provides embedded sensing capability for next-generation soft robots.