Saturday, March 28, 2015

Trials and Tribulations

I haven't posted in a while. This is mostly due to my busy life. I don't always get the time to work on Robie as I'd like. But when I do get to work on this project things don't always go as planned. Such is the nature of hardware hacking.

I hit a bit of a stumbling block a few days back when I was working on the bump-n-go code. Robie is supposed to move forward until he detects an obstacle, then back up, change direction and press ahead. But for some strange reason the control code was crashing. I.e. when Robie detected an obstacle and tried to back up, the python code would inexplicably exit. This seemed to happen at random. Maybe one in every 5 times.

After a fair amount of Google-fu I began to suspect transient voltage fluctuations. A motor is a relatively high-current draw. So when they turn on, naturally there is a drop in voltage for a split second. There is a capacitor across the motor lead which is supposed to help in these situations. But for whatever reason it didn't appear to be working.

The direct control mode (i.e. controlling Robie from the mobile phone) doesn't suffer from this problem. It was only present in the bump-n-go mode. So after wearing my thinking cap for a bit I came to the conclusion that there must be a brown-out during the instantaneous transition from forward to backward. When controlling via the phone, you are forced to slow down before changing directions, so it doesn't happen.

So to test this hypothesis I just needed slow down the transition from forward to reverse (and vice-versa). So basically I introduced a sleep of 0.2 seconds when changing directions. And low and behold, no more crashes! At least not yet... (knock on silicon?) But I've done a number of trials now. So I'm feeling more confident.

Updated motor control code will be posted soon...

No comments:

Post a Comment