I would not argue that it is difficult. Certainly well past my grade level so how can I judge? That said, motor speed is handled by a servo pulse and I think tilt sensors are manageable - certainly there are many "balancing" robots based on PICs. As Jerson says, it may be impossible, but how impossible? Cars that drive themselves impossible or warp engine impossible? That, my friend, is left as an exercise for the bold of heart.