LEGO Balancing Robot
This is a balancing robot loosely based on the "HTWay" robot. You can find the parts list, assembly instructions, drivers and demo program for the HTWay on the HiTechnic site.
Of course, one of the main benefits of building from a kit is that you can alter the design without having do any fabrication. Here are the changes to the base model I did right away:
- Use the power pack instead of batteries. This shifts the center of gravity a little but, but it did not seem to affect the operation in any way. Some minor changes to the plan had to be made to accomodate the pack.
- Use the larger wheels. The blueprints show the medium-sized NXT 1.0 wheels. I also tried out the smaller NXT 2.0 wheels and the 8 cm RCX wheels. The larger wheels made the robot more stable so I stayed with them. Also, the larger wheels are narrower, which increases the accuracy of turns because of less friction. (Most of the youtube videos of the HTWay also use the RCX wheels.)
- The demo program provided by HiTechnic prompts for wheel size every time you run it. This gets irritating really fast. I deleted the menu code for that and hard-coded it for large wheels. If I change wheels at some point, I'll change the constant.
- I don't have all the short cables asked for in the instructions, so I used what I have. The robot is a little "hairy"...
There is a picture of the stock HTWay with these modifications on the LEGO vs. fischertechnik page. This configuration makes a pretty good base platform for mobile projects.
One thing I noticed, the robot is more stable on a deep pile carpet than it is on office carpet or linoleum. This seems to be true for all wheel sizes. It could be partly how the program is tuned. I like to run the robot on carpet anyway, to cushion it when it falls.
Project: Return to Start
My first project with it was pretty straightforward. The robot drives straight until it encounters and obstacle, turns around, then returns (as best it can) to the spot where it started. The distance travelled to the obstacle, the 180° turn and the trip back are all dead reckoned. The result is surprisingly good at short distances, as seen in the video. This take is pretty typical:
The short distance is shown to keep it in frame and to keep the video clip short. As the distance increases, the error increases very quickly. The turn is much more consistent on shag carpet than it is on harder surfaces.
The robot has the LEGO ultrasonic sensor mounted on it to detect the wall, set to a distance of 12". The robot needs plenty of room after it stops driving to recover its balance. Then after it turns it needs to recover its balance again.
The distance travelled to the wall as well as the distance travelled back are measured with odometry. However, in this case it's kind of a funny concept. The direct readings off the encoders are not useful, as the platform is contantly pitching to maintain balance.