What would you like the 'unstuck code' to do? Resetting the moving model to a different position will look weird I think, so instead you'd be looking for code that prevents getting stuck in the first place, right?
Perhaps you should try to add a certain amount of upward force when moving forward, while still tracing the ground distance and so on to keep the model on the ground. It's probably a bit of an ugly solution, but it seems to work for me,
Cheers