Saturday, July 5, 2008

My First Project: NXTSegway Initial Release

Now, before I write anything else, I know this is nothing new, exciting, or revolutionary. However, this idea is what prompted me to get back into Mindstorms - I saw a video of one on Youtube and thought it was cool. This is my first attempt at a self-balancing, two-wheeled robot in ROBOTC (I couldn't do it in NXT-G) using a light sensor. To run it, one must first calibrate it, storing the values of the light sensor when vertical and when tilted to both sides. Then, the robot reads the value of the light sensor continuously, calculating the direction of error and compensating by using motors to rotate the wheels in the direction opposite the error. It is extremely jerky and unstable due to its lack of complexity (I wrote the program today just to see if this simple idea would be enough to stabilize the robot). My next revision will probably include dynamic adjustment of the midValue, which determines when the robot is vertical, because in its present state the robot moves around a lot and the midValue is not adjusted accordingly (the amount of light directly underneath the robot changes as it moves around). My ultimate goal is to purchase a Gyro sensor from and implement some sort of motion control system (probably PID) that would produce (ideally) a very stable robot. Ryo Watanabe did something like this and his project, NXTWay-G, is documented completely at his website. Anyway, here's a video of my sorry robot and the code that runs it:

Source file can be downloaded here (4KB)

1 comment:

Felcy said...

Thanks for sharing, I will bookmark and be back again

Robotics Project