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=AvYO90zZnO70EDl9nGA%2Fi68lzYQjUrpU7nbPwCFAXWs%3D&se=2026-04-03T23%3A59%3A59Z&sp=r&_=JcrSbAko3009qWYiNMpnsQ==)
.jpg-15x200.jpg?sv=2016-05-31&sr=b&sig=F8jTIQO3mvhLe%2FFylN3ZCgTOk1PApEoaRGV2QvzYp44%3D&se=2026-04-03T23%3A59%3A59Z&sp=r&_=M3/rR691xgMHQSStS3nKLw==)
.jpg-15x200.jpg?sv=2016-05-31&sr=b&sig=MzJPOzHPMPKMjG%2BYyDJX05Ad7hKZWgTktL4ykBO5KJc%3D&se=2026-04-03T23%3A59%3A59Z&sp=r&_=Vx1VS5VJN0w1ul2u9qQOPA==)

