Tuesday, 16 July 2019

Competition Day


A bit of a delayed blog post this - but with the plans for next year's Pi Wars going ahead, I thought it was a good time to go back to it. I actually wrote the blog a few weeks after the competition, but didn't have the photos and videos to hand, so never posted it.



Well - we did it. We designed and built a robot for Pi Wars - and, as it turned out - did rather well.

In the beginner's category, we won the Canyons of Mars challenge, got the fastest time on a single run in the Blast Off challenge - and came 3rd overall, which exceeded all our expectations. In fact, bar a couple of operational issues, we had a robot capable of winning the beginner's category - which we were very proud of for our first attempt.


The Morning

We drove up to Cambridge the day before the event and booked into the Premier Inn. It takes just over an hour to get to Cambridge from our home in Berkhamsted, and we didn't fancy doing that on the Sunday morning. 

The boys struggled to wake up in the morning due to the clocks going forward, and after a short Mother's day card and present giving, we headed down to breakfast. I think we must have missed the other competitors - it was a bit late by the time we went down. 

Getting to the venue we were allocated a small room. Although this was apart from other competitors, this was good for the boys to just chill in between events when we weren't looking at other robots. The Diddybot team were next door so we did manage to have a quick chat with them. And - with our team T-Shirts on - we were recognised by a couple of teams we had chatted with on Twitter and the Discord channels.  

The Challenges

Space Invaders

Space invaders was our first challenge - and probably the one we were most worried about - our attachment for aiming was a little hit and miss (quite literally!) and we had mixed results in testing.
Anton - our 8 year old driver - was very nervous - he was a bit worried about driving the robot with people watching. I said that we could take turns if he felt uncomfortable, but in the end he had a great time. He was using the wrong joystick though for the 1st couple of rounds (we had one joystick for full speed movement and the other restricted to 60% power for more control) so a couple of the balls got knocked forward - but when we did get a ball aligned - it generally went in a straight line, following the laser sight and hit the targets. We think we got at least 2 targets in each round and finished in 9th place in the beginner's - which was as good as we could have expected really. 


Apollo 13 Obstacle Course

Again - another nervous wait for Anton. He was worried about the treadmill. But on every run he timed it perfectly - waiting for it to slow down just enough that Sputnik could make progress. Not once did we end up in the pit. Our fastest run was about 1m 37s with no rescues which gave us 3rd place in that event. We were very happy with this and were starting to believe we had a decent robot on our hands.



Pi Noon 

We were given a bye in the 1st round of Pi-Noon - so went straight into the 2nd round where we faced 'CodeBreaker' another beginner - so 5 balloons each.

Another bit of great driving by Anton and towards the end we had 2 balloons to their 1 with not much time to go. I'm ashamed to say I advised Anton to run away and let the clock go down for the win. However, to his credit, he ignored my advice and went for the knockdown. Unfortunately we lost first one balloon to make it one all - and then the final balloon near the end. 

We were out - but I'm proud of the way Anton drove and how he really went for the victory. It's an event where luck counts for quite a lot - and we had no preconceptions of how well we would do in this event.


Blast Off - the Straightish Line Speed Test

Next up - the first automated test. We were using ultrasonic sensors only for this challenge. The ones on the side were used to keep us centred within the 2 walls and the front ones mounted at 45 degrees were used to see the approaching bend and do a quick turn at the right place. 

Max - our 5 year old - was the official starter on this one. He started the run and it went round the bends perfectly getting towards the end and then - it stopped! The judges were suggesting giving it a push to get it over the line - but I managed to get Max to press the start button again and it carried on over the line. We realised that when practising at home the runs were a lot shorter - and once it got past any bends we had set up, we stopped it. On this run, Max saw it had got to the end, so he pressed the stop button, not realising it hadn't crossed the finish line. At least we knew the reason so I told him to just let it crash the next time and not to try and stop it at all. 

The next run was our fastest - at just under 10 seconds. The final run was similar, but had a bit of a wobble towards the end as it did a couple of extra turns - so was a little slower. 

Our second run was actually the fastest of all the beginners, so we were very happy with that. We came 2nd overall in the beginners at this event. Another great result.



Judging

With an hour before our next event, it was time to meet the judges. There was a bit of a queue, so had to wait some time. When it was our turn the judges had some appreciative comments about the looks and the build quality. 

We weren't expecting too much here to be honest - we really went for simplicity - and although we had cut out a nice shape for the top and sprayed it with metallic paint (a lot of people were surprised to find it was actually made of wood, not metal) - it was really just 3 pieces of wood with the motors and components screwed on. 

With joint 18th in technical merit and joint 7th in artistic merit, we couldn't complain about that. 

We also found out later we came joint 3rd place in the blogging competition - so that's another good result. I think it really pays to put in the time with the blogging - and its a great reference point looking back. 

Spirit of Curiosity 

This was the big unknown. But we had put big wheels on Sputnik specifically for this event and, with the powerful motors we were quite quick over the course. 

A bit of suspension may have helped us, but again, some great driving by Anton and we safely got 7 little stones to the other side - getting us joint 2nd in this event. Another great result.



Hubble Nebula Challenge

We were really looking forward to this event having done a lot of testing up to the day before the competition and had got some really good times. 

I went to the room about 30 minutes before the event to calibrate the Pixy2 camera on the calibration course. It was a bit harder than I thought to differentiate between the colours but by the time I had finished it was able to distinguish between them. 

So - on the first run we were very pleased to see Sputnik look around at the colours and then head straight for red. It went back to the centre and turned again - but then disaster - it went to the green instead of the blue. After that it couldn't find the next colour. 

We tried to recalibrate the camera using the button on the top - but after that it couldn't find any colour it was all a bit of a failure. 

The run to the 1st red was enough to get us on the scoresheet in 8th - but we had expected so much more from this event. 

In hindsight - I should have taken the laptop with us and calibrated it properly after the 1st attempt - but I thought I could fix it with just the camera itself. A lesson learned. 


Canyons Of Mars

Feeling a little despondent we went back to the pits to change the batteries and get ready for the Canyon's of Mars event. Svetlana suggested we do a quick test in the corridor. Personally I didn't see the point as we had done a fair bit of testing, but there's no harm in an additional test, so we ran it up against the door towards the wall where we expected it to turn left and carry on along the wall. 

It didn't - it turned right - then right again and came back the way it had started. 

This would have been a disaster. Our method of solving this challenge is very simple. When going forward we use the same code as per the straight line speed challenge to stay centred between the walls. Then when we sense the wall with the front sensor, we stop, look left and right to see which is the shortest distance, and then use a timed turn to turn approximately 90 degrees in the direction of the longest distance and keep going. As long as the 90 degree turn is there or thereabouts, the straight line centring code will put it back on track. That's it - repeat until the maze solved. We have some basic logging enabled in the software so we were able to see what the sensors were showing. It was giving us a reading of zero on the left sensor when we got to the wall. Generally this means that the distance is larger than the maximum so we should take it as the largest reading. However, whilst I had taken this into account on the right sensor, I hadn't taken it into account on the left. Our test courses at home were so small we never encountered this issue. A quick change to the code and it was working properly. 

Going down to the event, it worked a treat - the 1st run did touch the wall briefly as the robot turned, but the 2nd and 3rd runs were very clean and we won this event with a time of just over 15 seconds. 


Summary 

At the prize giving ceremony we were given 3rd place overall in the beginners which we were very happy about. Had the Hubble challenge gone smoothly, we could have done even better - but that's what competition is about - getting everything right at the time. 

Certainly the robot and the software we had were capable of winning the beginner's category - so we can be really proud of what we've achieved. 

We had no preconceptions about Pi Wars having never attended an event. When we saw the challenges we went for a functional design - to try and make a good all-rounder for each event. Knowing there was going to be some uneven ground we went for large wheels. This cost us the most anguish in the design - as we had to get new motors and motor controller to cope with the grip - but as it turned out this was a good decision and certainly helped in the obstacle course and spirit of curiosity challenges. Everything else we kept simple. Although there was a little complication in that we were using an Arduino for the ultrasonic sensor inputs -  this actually made things a bit easier as we could use cheap HC-SR04 ultrasonic sensors rated at 5v and plug them straight into the Arduino. 

The robot was pretty much built by January and the majority of the code written, so when we got the call in February to come off the reserves bench and enter the competition proper, we were well prepared - just fine tuning the software in the weeks before the event. 

Barring a couple of loose screws on the sensor mounts, and the aforementioned change to the Maze code, we had no real work to do in the pits. Most of the 2 crates of tools and spares we had brought were never used. 

What would we do differently? For our first attempt, very little I think. We had a robot that we think looked good and had the potential to perform well in all the challenges. I think just taking a bit more time before the start of each challenge to prepare properly would have helped. 

Overall we're extremely happy with 3rd place in the beginners. 

Next Time

After doing so well in the beginner's category I think that if we apply for another Pi Wars - in whatever form that may be - it'll have to be in the intermediate category. 

Watching the CNM Hackspace team from the US blast down the straight line speed track in just over 6 seconds means that the first thing to change is to put in faster motors.

I've also got some interesting ideas involving Servo motors - but we'll have to see if they're in any way practical. 

Watch this space ....

And Finally

During the development of Sputnik we kept a google sites website to keep track of setting things up. There may be some useful information on here - it's at http://www.sputnikrobot.co.uk.

Many thanks to Mike and Tim for organising the event and everyone who helped to make it a great day. 




Friday, 15 March 2019

Sputnik Is Ready For Launch


So - this is the last post before the blogging deadline. No doubt there will be more to come - after the judging has been done - but this post marks the end of the first Pi Wars challenge for us.

We've been quite happy with the blog so far - the main achievement has been to keep it going. We've been trying to publish at least one new post a month detailing progress.

Personally my favourite post is Tears, Cheers and Motor Gears which was written after a very difficult period in the build when I wasn't sure we would keep going.

Thursday, 14 March 2019

Sputnik in Pictures

As we're nearing the blogging deadline, we thought it would be a good idea to show the stages of Sputnik's development in pictures. Development started in September 2018 to make sure we could actually build a controllable robot before applying for Pi Wars 2019.



The first attempt in Lego ran off 4 AA batteries for the motors and a USB Power bank for the Raspberry Pi. An L298N dual HBridge controller handled the motor outputs. A PS3 controller handled the remote control.

Tuesday, 12 March 2019

A Little Hubble Trouble

Once the Pixy 2 camera was fitted I wrote some quick code to implement the Hubble Telescope Nebula Challenge.

I went for a very simple algorithm where the robot looks for the colours, remembers the positions and then attempts to move towards them in the correct order. There's a few backup bits of logic, so if it can't find the next colour after spinning to where it thinks it is it will look for it again.

Using bits of coloured paper in the kitchen We were able to test it out and fix the initial issues. Sometimes it worked - sometimes it didn't. It was difficult to filter out false matches from the background - but in the real test with black walls we were hoping to have less issues.

Also when moving towards the colours, we were using a timing mechanism so that when we reached the zone we reversed for the same time as we moved forward to get back to the centre. This was woefully inaccurate, so we had to come up with a new solution, and decided to use the distance sensors to help out.

Now when the start button is pressed, the robot will record the distance to the wall from the front sensor. Then when it reverses, it uses the front 45 degree mounted sensors to reverse to the same distance. This works extremely well.

Once the code was at least proved, we waited for another trip to Robot Club to try it out on the real thing.

Hubble Telescope Nebula Challenge at Robot Club

Sunday, 3 March 2019

Protecting Earth - With Rubber Balls

A lot has happened in the last few weeks. Sputnik has a new paint job - all silver and sparkly, we've fitted the Pixy2 camera (and got it to work to some extent) and decided to finalise our solution to the Space Invader challenge.

When we applied for Pi Wars back last September, we had planned to use the balls to knock down the target. The idea was to build some kind of ball kicker powered by a solenoid or servo to propel the balls towards the target.

Then - when we went through a couple of iterations of motors, we thought we could use the spare motors to make a Nerf bullet launcher. We built a prototype with lego. Everyone stood back for the first lauch, only to see the bullet struggle through the lego barrel and drop to the floor. Looking at other posts the motors being used are running at something like 1800rpm - so our little micro motors were never going to make it. So that idea was shelved.

We then built a lego kicker - using a small servo motor. The prototype didn't quite have enough power to move the balls in a straight line.

At the time, we were still on the reserves list, so there wasn't a great worry. Then when we got the call to take part, we realised we were going to have to work out something - however primitive.

This is what we came up with:

Sputnik with ball launcher and laser sight

Tuesday, 12 February 2019

Apparently you can talk about robot club!

Had a good time at Brian Corteil's Robot Club at Cambridge Makespace on Saturday, testing out Sputnik and meeting some other Pi Wars contestants. It was great to try out the real straight line speed course. On the Friday night we only had one successful test run using boxes to simulate the sides of the track - all the other times the boxes went flying. But on the real thing it worked a treat. There were only a couple of times it turned left instead of right, but we think that was due to the course not being quite complete and joined together, so our sensors got a bit confused. Brian also gave us some good advice on how we could improve the code to keep our robot in the centre of the track. Our only regret is that we forgot to film it.

The other thing we learned is that the compass in the BBC micro:bit probably isn't reliable in the real world. In the Maze test, the robot turned a nice 90 degree turn on it's own - only for the compass code to try and adjust it by another 20 degrees or so, and pointing the wrong way.

Tuesday, 5 February 2019

micro:bit tells the Pi where to go ...

... but in a nice way.

Not long after applying for Pi Wars, we were thinking about the design of the robot - and one question was how to display visually which mode the robot is currently in. Also - it would be nice to have a physical button on the robot to change the mode - just in case the remote controller can't connect for some reason.

Initially the idea was to have a number of LEDs and a button connected to the Raspberry Pi GPIO pins. The LEDs would show the mode using a binary representation and the button would allow the mode to be changed. However one day I looked across at the Dimm robot from BinaryBots we had built but never quite got round to programming and the answer was there. The BBC micro:bit would be perfect for a simple display and input. And after a few months, we've finally put a lid on the robot and had somewhere to mount it (albeit with some velcro for now - whilst we finalise the position).


micro:bit centre stage on top of Sputnik