This paper presents a real-time trajectory planning method for highly dynamic tracking control of wheeled inverted pendulum (WIP) systems. A generic form of dynamic inversion problem for the class of WIPs is defined by combining a set of kinematic and dynamic differential constraints related to the system's output expressed by the state variables, whose time evolution is to be sought as the solution of the trajectory planning. Instead of simply integrating forward the set of differential equations, which would lead only to an unbounded solution due to its non-minimum phase nature, an asymptotic expansion technique, transforming the original differential equations into a sequence of algebraic equations parameterized by the system's characteristic constant, is used to allow for a stable and asymptotically exact solution of the dynamic inversion problem. To implement the proposed method to a real-time application where the reference command is not known a priori, a command input filter is designed and applied to adjust the realtime input into a sufficiently differentiable reference command suitable for the inversion. Simulation and experimental studies are provided to validate the proposed method using our experimental WIP system.INDEX TERMS Wheeled inverted pendulum, dynamic inversion, real-time trajectory planning, singular perturbation technique, balancing robot, underactuated system.