Jamming again!

One week before Pi Wars and Angus and I headed off to Manchester Raspberry Jam again for the day, with Glitterator II. We had built a minimal maze course for last year’s competition, and thinking that it would be unlikely to be the same course in subsequent years, donated it as a practice course after the competition. Of course it is the same this year, so we were able to pull it out of the store and use it ourselves. This was also a great way to inspire some of the newcomers to the Jam about what is possible with a Raspberry Pi, so bonus both ways!

Pulling out the maze allowed us to refine the algorithm used for the maze, and now rather than using exactly the same code as for the straight-line speed test, we’ve got a slightly modified function that is strictly about following the left wall. We don’t want to strictly follow the left wall for the straight-line speed test, because the chicanes would mean that it wouldn’t be a straight line at all. (It’s not exactly straight anyway, but hey-ho, it’s something approximating it!)

Why this decision? Well, in the test course that I’d mocked up at home, I’d forgotten that some of the angles are 45 degrees rather than 90 degrees… and testing with the algorithm I’d implemented on the proper test course revealed that this was a significant problem! The robot had a tendency, when it reached this region after the first straight stretch, to wander about, get confused, and half the time end up going back the way from whence it had come. Not good!

So I removed Glitterbrain (the pi 3 with the autonomous controls) from Glitterdriver (the pi zero controlling the motors), allowing Angus to practice (or show off) his driving skills while I made the changes. And since I was working off the robot, I decided to save my batteries and work on mains power. And discovered a problem:

Remember that authentication problem I was having a couple of weeks ago, where I just couldn’t log in to the pi? Well it happened again. At least now, with the expertise available at the Jam, I had some help in diagnosing the problem. The long and the short of it was that with the Lipo Zero on the pi, and no battery connected to it, when booting from mains, the Lipo Zero asserted low battery, which in turn lead to the daemon performing an automatic shutdown of the pi. And part of that process meant that the authentication services were shut down before it got fully running… or something like that, I think. Anyway, problem isolated. One solution would be to disable the daemon before shutting down on battery power, when I knew that I wanted to reboot on mains power. But a quick interaction with the folks at Pimoroni on Twitter provided another alternative: boot with lipo and mains power connected. The lipo (assuming charged) would prevent the low battery warning, while the power should be supplied by the mains. And this solution worked.

IMG_20180414_140413826Seeing me working like this, Angus said “Wouldn’t it be great if the battery was charging while you did this?” I relayed this via Twitter to those pirates, and received this in response:


Anyway, this problem out of the way, I was able to mod my maze code as described, and returned to the stage I was in my last post: everything up to the “sticky-outy bit”. But then, having identified my intended solution in that last post, continuing was fairly straightforward. First I worked out an appropriate motor power ratio to get a nice curve to bring it round a the sticky-outy bit, given the maze corridor spaces. Then, keep it on this curve until 1) there is a wall on the right and 2) there is a clear space detected ahead. Next, move forward along the right hand wall until there is a wall on the left again. Finally, revert to the left-hand rule that got us to the sticky-outy bit in the first place.

And beautifully, it worked. It’s not perfect – still some minor wall touches – but we feel that the basic algorithm is right, and it’s just parameters (such as minimum distance we should keep from the wall) that need adjusting.

So… the one remaining challenge that needs to be properly tested is Over the Rainbow. And our problem here is that we don’t have a test course. But I hope we’ll figure something out!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s