Existing Solutions
 
This is the video of an already existing solution: a drink holder that can move on two axes in order to keep the drink horizontal. However, we think that it is not well suited for bikes or even cars for simple reasons: it is too big and too high: it takes too much space. The structure of the holder would probably hit either your leg or the wheel of the bike. Hence it is not feasible for most people.

                Below: Example of shipboard compasses mounted on gimbals