i'm in a lot of trouble right now. i have a basic idea here but everything from the coding to which sensor to select, im very confused. the working of the bot is that of a segway i.e inverted pendulum.
im hoping to connect a 9 dof sensor to the pi (clueless on how) and have a code running in the pi (have no idea about the code since im a no vice in coding) and have the motors run using a h-bridge setup. the basic block diagram is attached. the robot will also have a camera (raspberry pi camera) which will stream videos vai wifi dongle to my laptop ( or so i hope). lets just say i was counting on this person from college but turns out he's more clueless than me. please help !!! 

.jpg-15x200.jpg?sv=2016-05-31&sr=b&sig=ewC%2BJOp%2F8SN195Neknt5%2FhAEFPLuiL9itD2dVZqOyPQ%3D&se=2026-04-02T23%3A59%3A59Z&sp=r&_=JcrSbAko3009qWYiNMpnsQ==)
.jpg-15x200.jpg?sv=2016-05-31&sr=b&sig=rAjdsUoTTaOjsjifKakSwv7%2BO1kV%2BTDhi%2FEMCZjft3w%3D&se=2026-04-02T23%3A59%3A59Z&sp=r&_=M3/rR691xgMHQSStS3nKLw==)
.jpg-15x200.jpg?sv=2016-05-31&sr=b&sig=Hxk2IWALY42wVzwUcAjjq0YmoNq72RZ7o4LSvb4%2BD18%3D&se=2026-04-02T23%3A59%3A59Z&sp=r&_=Vx1VS5VJN0w1ul2u9qQOPA==)



