A Gait Events Detection Algorithm Based on the Invariant Characteristic of Hip Joint Kinematics