Pi wars week 2: encoders and magnetometers

8th Oct 2018

It’s been a productive week for the Tauradigm team, we’ve tested a prototype projectile launcher, researched sensors for odometry, mapped out the system architecture, evaluated a magnetometer board and order some of the key components.

 

Projectile Launcher

First the projectile launcher. Since the concept design (posted last week) is quite similar to Hitchin’s old skittles ball flinger, I thought it was worthwhile to just use that for a test, to check it was feasible to use with the soft juggling balls. I 3d printed a holder to mount the flywheels closer together, so they’d grip the balls:

modified ball flinger and juggling ball. notice the scuff marks on the ball from the tyres

The result is just about ok. It could do with the balls having a bit more energy, so they fly rather than bounce towards the targets. I’m not sure if its because the flywheel tyres are soft, as well as the balls, so they’e not getting much grip, or because the flywheels are too far apart, or because there’s not enough energy stored in the flywheels.

Still, a promising result and worth further development, since the balls knocked over the books and there’s no way the elastic bands from last year would have managed that.

 

Odometry sensors

Odometry is the fancy word for sensors that tell you how far you’ve traveled. The classic example is wheel (or shaft) encoders where markers on the wheels or motors are counted, to allow the travel distance to be estimated (its an estimate as the wheels may slip).  There are now also optical flow based sensors, where a series of images are taken, key reference points identified in each frame, and the travel distance worked out from there. This can eliminate the wheel slip error, but introduces other potential errors such as when when the camera to ground distance varies, the perceived speed changes.

As mentioned previously, we ideally want an encoder that doesn’t interfere with our magentometer (no long range magnetic fields), is fast (better than 100Hz), precise (better than 1mm resolution when used on a 50mm wheel, so more than 100counts per rev) and isn’t sensitive to dirt, contamination and sunlight.

Shaft encoders are split into a few variants:

 

Optical flow

optical flow solutions fit into two categories: general purpose cameras with specialist software analysis, and dedicated hardware based solutions, often based on optical mice. The mouse chips tend to be cheaper and faster.

so lots of options available, none ideal. We’re going to start with the cheapest and see what we learn.

 

System Architecture

For most challenges, we’re aiming to use map based navigation, and rely on ‘external’ sensors as little as possible (after the issues with light interference last year). To do this we’re planning to have a microcontroller very rapidly reading simple sensors like the IMU (including the magnetometer) and encoders to keeps track of where it thinks it has traveled and adjust the motors accordingly, aiming for  a given waypoint, whilst keeping the pi up to date with what its doing and where it thinks it is.

The Pi will keep track of the location on a representative map, use key features to update the perceived location on the map and give the microcontroller new waypoints to head for. Localisation (figuring out where we are on the map) and route planning will be separate modules. See this page: https://atsushisakai.github.io/PythonRobotics/ for a collection of algorithms written in python that achieve this, along with animations representing each one’s approach. Our Pi will use ToF sensors and image processing to detect obstacles and use them as inputs for correcting the perceived location.

 

Magnetometer Evaluation

Since we already had a gy-271 magnetometer (HCM5883L breakout board), we thought it was worth doing a few tests to see if the magnetic field of the motors would interfere with the results.

The HCM5883L is a 3axis magnetometer, so doesn’t know its orientation to gravity or its turn rate like an accelerometer or gyroscope does, but by measuring the local magnetic field the results can be used to calculate the current orientation.

We first did a bench top test with a single motor and the board. we found that at about 150mm distance, the motors could cause a +/-2degree heading error. At 100mm it was +/-20degrees and at 50mm it caused more than 45degrees error. A few people on twitter suggested using materials with a high magnetic permeability as shielding for  the motors.  We managed to borrow some flexible magnetic keeper material (like Giron?), so we tried that:

Interestingly, in most orientations this gave no improvement, and in some orientations it was worse than no shielding. We think the material may have been concentrating the motors magnetic field into a better magnetic shape or directing more towards the magnetometer, or maybe the earths field was also affected by the material. We couldn’t entirely engulf the motor as we need the power wires to exit one end and the gearbox output shaft to exit the other. If anyone can suggest a more suitable material or arrangement, please let us know in the comments. Good magnetic shielding materials seem to be very specialist and expensive, and will likely add more weight than a plastic sensor tower, so for now we’re going with that.

Here you can see we’ve mounted a wooden stick to the front of our Tiny test chassis. Since the explorer phat doesn’t have pass through headers, we initially used a PiFace solderless expansion shim to breakout the GPIO pins, but we found some of the pins weren’t getting a connection, so had to revert to using jumpers to wire everything up (explorer phat floating in the air on wires, instead of sitting on the pi). After a bit of calibration, we got the Tiny to drive towards North fairly successfully:

From this test, its clear we need other sensors to help us figure out how far off course each little deviation takes us, so we don’t just turn back to the correct heading (parallel to the original path but offset), but we can turn back onto the desired path. We also need to find a better calibration routine, the few libraries we found still left some errors, North was ok but South was closer to South by South East. Here’s an example of one of the early calibration test results:

This is after some scaling and conversion, so the units are a little meaningless, but it shows the magnetic field strength in X and Y as the sensor was rotated. Since the earth’s field is constant, this should result in all the points being an equal distance from the origin, clearly this is offset to the right and downwards. The scaling looks ok as both axis vary by the same amount. After we changed the offsets we got much better results.

 

Parts are arriving

We’ve started ordering the parts we’re confident we will need, like a Pi, Pi camera and motor controllers:

So lots of progress. Hopefully next week we’ll evaluate a few more sensors and develop the Tiny test bed further.

Pi wars 2019 – it begins!

30th Sep 2018

First the big news: Hitchin’s A and B teams both got in to Pi Wars 2019!

Before the excitement fades, the feeling of worry sets in, how much work have we just committed to? Can we get it done on time this year? Better get cracking!

Mixed progress has been made on Tauradigm this week.  We’ve fleshed out the CAD design a little more, estimating what components we need for all the challenges, and checking how they’ll fit:

initial layout

Pi 3b+ in the centre, batteries either side, motor controllers behind them, with a Teensy at the rear (to quickly track the encoders and IMU). The field of view of the distance sensors (mounted on the underside of the main board) are represented by the cones pointing outwards. The grey sketched rectangles represent the IMU (gyro, accelerometer and magnetometer, for figuring out the robots orientation and movement) and a multiplexer, so we can speak to multiple sensors easily.

At this point it was looking fine.

rear encoder

We’d even included a model of the encoders we were planning to use. It was at this point we realised a couple of issues. Firstly, the motors we’d been hoarding (high speed, high power 12mm motors, bought really cheap off ebay in a pack of ten) didn’t have rear motor shafts, so those encoders wouldn’t fit. Secondly, would the encoder magnet interfere with our magnetometer? Come to think of it, would the magnets in the motors interfere? Some quick research suggested they would, many people have had issues with getting magnetometers to work reliably. it looks like we might have to move the IMU as far from the motors as possible. like on the top of a small tower! Ok, if that’s what we need to do…

 

layout

pi noon setup

Next was a quick mock up of the Pi Noon arrangement, with the camera angled up to see the pin and opponents balloons (an issue we had last year where the balloon disappeared from view just at the critical moment!) and you can see the tower for the IMU. We’ve also added the 5v regulator and the barrel jack for running from a power supply. Looking ok. but space is getting tight and we still need to sort out a solution for the encoders.

ball flinger attachment

 

Next was a drawing of the firing mechanism for space invaders (target shooting). This design is based closely on Hitchin’s previous ball launcher (for skittles, http://hackhitchin.org.uk/finalstraight/) but this time firing soft juggling balls. There’s been some discussion with the pi wars organisers about whether a speed or energy limit might apply, so this might need to be revised as it requires quite a lot of energy to work properly, even though the speed isn’t that high (probably slower than a nerf dart). We’re also considering vacuum cannons 🙂

Drawing up the launcher highlighted an issue with the camera and IMU mount we had for pi noon above, so that’s going to need a rethink.

 

For the encoders, it looks like we could go magnetic or optical on the output shaft, or optical mouse sensors looking at the floor. The magentic sensor is probably the most reliable but has a very low resolution and might interfere more with the magnetometer, the optical sensor may be a little big and may be sensitive to dirt, and the mouse sensors are sensitive to distance from the ground (and might need to be too close to be practical).

magnetic encoder on the output shaft

 

We’re planning a separate post on sensor selection, as it can be challenging and confusing.

 

That’s it for this week. hopefully we can soon start ordering parts to test.

 

Pi Wars 2019 – The entries are in

24th Sep 2018

Its that time of year again, where Hitchin Hackspace get slowly obsessed with Pi powered robots, in the build up to Pi Wars. Hitchin have again applied with two entries, this is post will be focused on the entry for Tauradigm, another fully autonomous entry and successor to last years Piradigm entry.

Key bits from the application form:

Team/Robot name: Tauradigm
Team category: Advanced or Professional
Team details: Mark Mellors: Professional Mechanical Engineer, lead on the mechanical and electrical side of the robot. Previously did majority of work (across all disciplines) on last year’s (disastrous/’ambitious’) Piradigm.
Rob Berwick: Professional Computerman, lead on the software side. Previously an adviser and supporter on Piradigm
Both Mark and Rob have also contributed to all of Hitchin Hackspaces Piwars entries, from main team members in ‘16 to occasional advisers in ‘18.
Proposed robot details: Fully autonomous in all challenges, obviously
4 wheel drive, lego/custom wheels tyres as default configuration
Custom chassis using unusual materials/construction techniques 🙂
Stylish, lightweight, UFO themed bodywork
Home made pcbs for power and signal distribution
Arrays of various sensors, including: internal (encoders and inertial measurement), proximity (distance sensors, reflective) and vision (pi camera), possibly supported by offboard sensors (beacons, ‘eye in the sky’)
Software:
Separated architectural units
Fast IMU/encoder feedback with continuous location estimation, much like actual spacecraft (so build a virtual map then use that for navigation, with occasional corrections when known markers are detected)
Advanced route planning algorithms
Automated hardware self testAttachments for challenges
Space invaders will have a much more powerful soft projectile system with vision based auto aiming supported by encoders and distance sensors
Spirit of Curiosity may use one or two homing beacons or visual markers
Navigate by the Stars and Blast Off may use a rocket (jet, no flames or pyrotechnics!) propulsion module
The Hubble Telescope Nebula Challenge and Pi Noon: The Right Stuff will use vision again, supported by distance sensors and encoders (plus be more tolerant of changing lighting conditions this time!)
The Apollo 13 Obstacle Course will be attempted autonomously without on course markers this year, using a range of sensors
Why do you want to enter Pi Wars?: Retribution! To show that full autonomous is possible! But also, as before, to inspire, share and stretch ourselves.
Which challenges are you expecting to take part in?: Remote-controlled challenges, Autonomous challenges, Blogging (before the event)
Any more information: Piradigm would like to attend as an exhibitor this year

The entry only went in last week (sorry Mike and Tim for leaving it late!) yet we’ve already realised we might need to make some changes to the robot design.

Initial draft CAD rendering:

Render of Tauradigm

Render of Tauradigm

Fingers crossed we get accepted!

We should find out in the next week

Making a Hackspace, part 7: coming out of our shell

15th Jun 2018

It’s been a busy couple of months. At the moment, our main focus is on getting the “office” side of the building up and running. This includes the toilet and tea-making area, as well as a general area for sitting down and doing the sort of stuff we do once a week at Ransom’s Rec. Once that’s out of the way, we’ll be moving on to the workshop.

All-a-board

Having previously completed the ceiling in the office side, we’ve turned our attention to the walls. Because of the enormous difficulty we encountered in trying to remove the old tiles, we’ve just overboarded the lot. This is now about 95% complete, with just a few bits left. We’ve also started on jointing the boards (wall and ceiling) to make a nice smooth surface. Or so the theory goes. Maybe in practice we’ll have to hang some strategically-placed artwork over the joins.

Plasterboard

Plasterboard on walls

More plasterboard

More plasterboard on the walls

Doors

For the last year or so, the only way in and out of the building has been to unlock one of the half-height doors in the hoarding and duck under. But now, we’ve fitted both the main door, and the fire escape door. Finally, we can walk into the building like people, not an early-human/monkey hybrid. The main door has a window so we can see who’s knocking, and opens inwards. The fire door opens outwards for emergency egress purposes, so we’ll need to be very careful about pedestrians when opening it, especially on occasions when the building is not on fire.

Door

Door, with the awful hoarding still in place behind it

Windows

Probably the second biggest or most obvious change we’ve made to the building is to replace the windows. The old windows, apart from being mostly broken, were a mixture of single-glazed wired glass, plastic and fibreglass. They let very little light in, and were not at all transparent. The new windows are double-glazed and the difference they’ve made is incredible.

For security, all the windows are made of laminated glass.

The old windows

The old windows

Old windows being removed

Old windows being removed

New side windows

New side windows

Office side, with new windows

Office side, with new windows

Workshop side, with new windows

Workshop side, with new windows

Leaving Stealth Mode

Up until now, we’ve mostly been operating in secret behind the hoarding that covers the front building. We’ve not exactly been hiding; we’re often approached by people who are interested in what we’re doing as we enter or leave the building, or work on the outside of it, but we have maintained the mural over the front.

We have now removed the mural elements (they are stored safely while we try and find a new home for them), and taken the boards down which covered the doors and the windows. It’s now very obvious that something is afoot in the old toilet block, but we’ve been pleasantly surprised by the overwhelmingly positive comments we’ve received from passers-by about what we’re doing.

In fact, as far as I know, the only negative reaction is from someone who was disappointed to learn we weren’t opening a coffee shop.

Unstealthed

The front of the building with the hoarding removed from the doors and windows

What’s next?

  • The last few bits of plasterboard need to go up, including a bit of stud wall to divide the toilet from the rest of the office
  • Joint and paint the walls and ceiling
  • Put the lights up
  • Put power sockets in
  • Fit the tea area
  • Buy and fit the toilet
  • Buy and fit air conditioning
  • Lay some floor
  • Build a door between the office and the workshop
  • Move in and start using the building

So, there’s still enough to keep us busy for some time, but there’s a definite sense that we have at least reached the end of the beginning of the build.

Making a Hackspace, part 6: Work in Progress

10th Apr 2018

Hello! It’s been a while, hasn’t it? This isn’t because we’ve not been doing anything, but because we’re in the middle of lots of things and nothing is quite done yet.

Progress

Last time, we were knocking down walls and getting rid of waste. Since then, we’ve also knocked down half of the ceiling. But, we have also done quite a bit of building and fixing up, on one side of the building at least.

Using the divide between “office” and “workshop”, we’re currently focussing on getting the office side up and running. Once we do this, we can move into the building permanently, using it for the same sort of things that we currently do over at Ransom’s Rec (light crafts, laser cutting, electronics, drinking tea). We’ll then switch attention towards completing the workshop side, which should be a lot faster.

Floor

Starting at ground level, the floor has received some much needed attention. Where the walls were removed, this left gaps in the floor that we needed to fill, some of which were quite deep. There are also the sewer connections for toilets which had been removed, and drains for toilets and sinks that we’d taken out. And, as the urinals were below floor level, removing them left two deep, long gaps in the floor.

While taking out the unused toilet connectors, a brief moment of excitement occured when we realised the original connections to the drains had lead seals. But a quick scrap price check soon dashed our dreams of riches, as it turns out lead is only valuable if you have the sort of quantities you can pinch from an old roof.

As we started clearing out the holes where the walls and urinals had been before filling them, we noticed that some of them seemed a little damp. As a precaution, we laid a liquid damp-proof course down before screeding over the top.

With all the holes filled in (on the office side, at least), the floor is now reasonably level, albeit not terribly attractive: it’s a mish-mash of concrete, cement, tile and self-levelling floor compound, so we’ll eventually put a nice floor covering over it.

Urinal trough filled in and brought up to floor level

Because one of the walls we removed was between the office and workshop sides, which are at different heights, we had to build a step where the wall used to be. A ramp will eventually be placed here for access.

Step step step step steppy steppy step step

Step between floors where a wall was removed

Walls

The main thing we need to do to the walls, other than make them look nicer than they do at the moment, is to build up the disabled toilet cubicles on both sides so they meet the ceiling. In the workshop side, the cubicle is a “dirty workshop” where anti-socially noisy, smelly or noxious activities can be carried out, so some way of containing the sounds and smells is needed. The office side cubicle will be used as a toilet, so the requirements are broadly the same.

For the office side, we have started extending the long wall to the ceiling with bricks left over from demolishing the main walls. Once this is completed, a stud wall will be built over the doorway, and a door fitted.

Ceiling

We knocked down the old ceiling, which was made of metal mesh and plaster. This is mostly because it was starting to fall down by itself. The original plan was to overboard it, covering up the damages/missing areas (such as where walls had been removed) but it quickly became clear that given the state of it, ripping it down and putting up a new one was going to be much easier.

As well as taking down the ceiling, we also had to build one, with a nice big loft hatch, in the void where the cistern room used to be. This has been done with new joists.

The old ceiling joists are quite uneven in places, particularly around the old loft hatch. In order to make putting up the ceiling easier, we have fitted battens to the joists, packing them (or trimming them, in a couple of places) to give a more level end result.

The plasterboarding is almost finished (except for a couple of bits near the loft hatch).

Old ceiling taken down

Plaster dust all over the floor

Battening in place ready for new plasterboard

The (nearly) finished new ceiling

Lights

Continuing our upward journey, just above the new ceiling is the new wiring for the new lights which will be fitted. The original plan was to use some donated light fittings, along with possible re-using some of the old lights. However, we found some lovely, bright and very inexpensive LED panel lights from CPC. Fitting the new wiring from below while the ceiling was down was considerably simpler than fitting it from the loft.

The original lighting circuits have been removed from the office side and loft, and now only supply lighting to the workshop side (until they are also replaced).

In order to keep everyone safe in the event of a power cut, we’ve also installed emergency lighting.

Roof

Unfortunately, since we took over the building, we have discovered there are several leaks in the roof. One of these was especially serious and caused considerable damage to some roof timber above the workshop.

On the office side, a leak was noticed when it started dripping on the floor after we’d removed the ceiling. All over the outside of the building, we could see missing and damaged tiles, though fortunately they hadn’t been serious enough to cause more leaks.

Using some salvaged roof tiles, we have replaced most of the missing and broken tiles, though a few more remain to be done. Following the advice of a roof repair company, we have been able to remove the rotten timber, and stabilise the remainder. When the workshop ceiling is removed, we’ll be able to complete the repair of the roof.

Roof repairs in progress

Repairing the roof

What’s next?

The next steps in completing the office side of the building are

  • Ceiling – fitting the last couple of bits of the ceiling, jointing and painting it, and putting the lights up
  • External doors – we have external doors (a main door and a fire escape); they need to be fitted
  • Walls – the walls are generally sound but unattractive, being about three-quarters tile and the remainder painted and quite grimy. In order to get rid of the “public toilet” vibe, we’re going to overboard the walls
  • Tea area – sink, worktop, cupboard for the tea and biscuits, and a kettle. We also need to box in the electricity meter/fusebox.
  • Toilet – the logical counterpoint to having somewhere to make and drink tea
  • Internal doors – at the very least, we need a door on the toilet. Additionally, doors to separate the office and workshop, and the workshop and dirty workshop are much desired.
  • Windows – the current windows are in a poor state, so we’ve started exploring the cost of getting them replaced
  • Electricity – the lights are already wired in, but the next thing we’ll need is sockets. Lots of sockets.

Join us

If you’re interested in helping, or even just like the sound of what we do generally and want to get involved, pop down to Ransoms Rec Pavillion on a Monday evening and say hello. We have tea, and probably biscuits.

Funding update

16th Jan 2018

Aviva Community Fund

Previously, we had been announced in the top 8 of our category/funding level thanks to the kind votes of hundreds of people. The results have been announced, and… (if this was a TV show, there’d be a very long pause here) sadly, we didn’t make the winning two.

Congratulations to Northumbria Coalition Against Crime and Cantley and Horning Primary Schools Federation. Two extremely worthy winners, amongst the many others from all categories and funding levels within the competition.

Thank you again to everyone who voted for us, and to Aviva for considering our application.

But it’s not all bad…

As a runner-up in the top eight, we have been awarded £500.

While we’ve been waiting for Aviva to announce the winners, we’ve not been idle on the fundraising front. A successful application to London Luton Airport’s Community Trust Fund for a grant to assist with the renovation of the building has meant an award of £3750 has been made by Bedfordshire and Luton Community Fund on behalf of the airport’s fund.

North Hertfordshire District Council’s Hitchin Area Committee awarded us £5000 on the strength of our application to them for funding, and Mark’s successful presentation of our case to the committee in person.

Councillor Judi Billing, who has supported us for many years, has given us £1000 from her locality budget to fund the purchasing of new doors for the building.

This brings our fundraising total up to £10,250 in the last few months. Considering that we entered the Aviva competition because an extra 200 quid (awarded to any entry submitted by an Aviva customer) would be nice, to have over ten thousand pounds to build and fit out the Hackspace is a real privilege, and will make an enormous difference to the sort of space we can build and operate.

In the meantime, in between games of Fantasy “What Could We Spend £25,000 On?”, we’ve been beavering away in the Bancroft building, mostly knocking down the old ceiling and preparing to put a new one up. Look for some big progress updates coming soon.

Aviva Community Fund. We (all) did it!

28th Nov 2017

Previously, we had done a bit of internal number crunching and reckoned we’d made 6th place in our grouping. Now, the official results are in. Announced at 2pm on 28th November, we’re in the top eight in the Skills for Life category at the £10,000-£25,000 funding level; the results page doesn’t list a position.

The results are here

We didn’t do it on our own, though: Thank you again for all your support. Now we have lots of forms to fill in for the judges, and the final result will be announced on 16th January 2017.

Aviva Community Fund: The dust settles

21st Nov 2017

The vote has closed

Back in early October, we spotted the Aviva Community Fund competition, and that if you were entered by an Aviva customer, you would automatically be awarded £200. On our tiny shoestring budget, £200 is a nice little pot of cash, so we submitted an entry.

From looking at the previous year we knew that winning entries had to have several thousand votes, which seemed like an impossibly large amount. But we went for it anyway, and now, just over a month later, the voting has finished.

And our final total is an amazing 4791.

A huge thank you to…

Everybody! It’s impossible to know exactly how many people took the time to vote for us, but based on the final total, we’d estimate something like six hundred people made the effort, sometimes in the face of difficulties with the voting site, to give us their vote. That’s an astonishing amount of support for our tiny Hackspace, and we’re extremely thankful for it.

We know that not everyone was able to give us 10 votes; there are a lot of very worthwhile projects out there and some people would have wanted to share their ten between two or more, but we really are grateful for every vote.

As well as friends, family and colleagues who suffered our increasingly frequent requests for support with good grace, and a good crop of clicks, we also reached out across the internet to ask for help.

We had help from (I hope they’ll forgive the term) geek royalty with Robot Wars’ Dr Lucy Rogers and Raspberry Pi creator Eben Upton retweeting our request to their thousands of followers on more than one occasion. The official Raspberry Pi twitter account also did the same. As big Raspberry Pi fans, we were very excited by this.

Hackaday covered the Aviva vote in an article, with Hitchin top of the list of contenders (a couple of other hacker/maker spaces also had entered). Many other spaces across the country were only too willing to allow us to promote our cause to their members via membership mailing lists or web forums.

Mike Horne, organiser of CamJam and the annual PiWars competition, took the time to write a whole blog post explaining in his own words how we should win.

Read all about it

The local newspaper, The Hitchin Comet, gave us some very welcome coverage. We’d been told that the article would feature “prominently” in the print edition, but no-one expected it to be the main headline on the front page.

We’ve had lots of support from local businesses, both online and good old fashioned posters in shop windows.

Far more people and organisations than we could possibly mention individually helped promote our entry, and we’re incredible grateful to every one of them.

So thank you again, everyone who tweeted, retweeted, Facebooked, wrote about us, commented on us, replied to say they’d voted for us, and most especially to everyone who voted for us.

And the winner is…?

The Aviva competition is partly public vote, and partly judged (insert your own comparison to Saturday night entertainment shows here). There are four categories, and four funding levels. We’re in the Skills for life category and the £10,000-£25,000 level.

In our category and funding level, the top 8 entries by number of votes go through to the final judging round, from which two are awarded the funding. The other six receive £500.

The official results aren’t emailed to us until November 28th, but by our own unofficial reckoning, checking against the other entries, we came in 6th place.

We’re eagerly awaiting official confirmation, but as we seem to be in the top 8, it appears that we will be awarded at least £500. And, of course, there’s the possibility of winning an award of between £10,000 and £25,000. The difference that would make to the Hackspace is incredible.

Thank you again, and hopefully we’ll be able to announce early next year that we’ve won the full funding. But more than anything else, we’re amazed and delighted by the support and goodwill our little project has, and we look forward to bringing you our refurbished toilet block Hackspace, whatever the final result.

 

 

Piradigm – Approach to Piwars challenges 2018

12th Nov 2017

Quick progress update: chassis wired and driving in remote control mode!

 

So now I’ve got the basic functionality working, I can start on programming for the challenges. In principle I could compete in three of the challenges right now, as they’re intended to be entered with manual control. As I mentioned last time though, I’m hoping to attempt them autonomously, as well as the mandatory autonomous challenges. Here’s how I’m intending to approach them all:
Somewhere Over the Rainbow (driving to coloured balls in sequence)
I’m hoping to use OpenCV’s contour detection for this challenge, to spot shapes which can then be filtered by size, shape and colour, to identify the coloured balls, then use the size of the ball and possibly the height of the arena to help judge distance to the ball. I have a few ideas to help make the image processing quicker and more reliable – have the camera at the same height as the balls and prioritise looking where the balls should be based on their expected height and angle relative to the start position.

 

Minimal maze
To help with many of the challenges, I’m intending to use external markers (like QR codes) to help track the robot’s position and orientation on the course. This year the minimal maze allows markers to be used, so I’m intending to put an ARuco marker on each corner, with the hope that a wide angle lens will always be able to see one marker, giving me position on the course at all times. I’ll preprogram waypoints for each corner of the track and use the markers to help navigate to them in sequence.

Hitchin Hackspace built a copy of the minimal maze last year. its the same this year, with different colours for each wall

Straight line speed challenge
Like the maze, I’m intending to put a marker at the far end of the course and just drive towards it. Once the marker reaches a certain size, I’ll know I’m at the end of the course and can stop. This is the first challenge I’m going to attempt to program. If I get all the others done and working reasonably reliably, I may come back and try to do it without a marker, just using the colour of the edges of the course as guidance.

 

Duck shoot (target shooting)
This challenge is intended to be shooting targets by manually steering the robot. I’m hoping to do autonomous aiming through object detection. I’ve picked a gun (blog post coming up on that) and got it to be electronically actuated, so I “just” need to find the targets and aim. I’m hoping the targets will be rectangles of a consistent colour, or at least something easily identifiable using opencv, but that’s up to the organisors and course builders to let me know. I know roughly the size, position and distance to the targets, so I may be able to use that to narrow down which detected shapes are targets.

 

Pi noon (1 v 1 balloon popping)
This is going to be tricky! I’m again intending to put markers at the corners of the arena so I can judge position. After that, I can either drive around randomly or look for coloured round things (balloons) and drive towards them. Hopefully after I’ve got the code for Over the Rainbow and Minimal Maze challenges working, this one should be more than halfway there. I think spotting balloons may be tricky though.
Slightly deranged golf
The golf challenge is a little like pi noon, in that there’s a round object on a course that’s going to be difficult to catch. I’m going to attempt it the same way, programming a waypoint for the hole and looking for round white objects that might be balls. Very tricky.

Golf Course from last year, note the steep hill at the start that caused the ball to roll into a hazard

Obstacle course
Again, by having markers on the corners of the course and programming waypoints, like the minimal maze, I’m hoping to autonomously navigate the course. The extra 3D-ness of the obstacle course will make this more difficult, as the markers may not always be visible. The main difficulty will be the turntable though. I may need to put a marker on the turntable or some other trick. I’m leaving this challenge until last, as its so difficult.

 

Obviously its still early days so these plans may change as I get into and find image processing is too challenging for some reason, but hopefully I can complete at least some of the challenges using the camera.

next week: design and build notes

 

Reminder: please vote for Hitchin Hackspace on the Aviva site here:  Hitchin Hackspace Community Workshop  We are very close to getting funding to enable our Hackspace, we just need a few more votes.

Pi wars 2018

29th Oct 2017

Its Pi Wars time again! If you were following along the last few years, you’ll know that Hitchin Hackspace has previously entered the Raspberry Pi powered robot competition with some innovative and challenging robot designs, sometimes with great success, often with stress and very late nights towards the end. This time we’re doing things a little different, On the one hand there’s the A team of Dave, Martin, Brian, Mike and Paul; taking the typical Hitchin approach and on the other hand, there’s, well, me. I’m being politely referred to as the rebel, or more frequently Team Defectorcon.
Why the split? I want to take a different approach; a somewhat risky strategy that’s unlikely to be competitive, and I knew the rest of the team would prefer something more along the lines of what they’ve done before.
So what’s the difference? Hitchin Hackspace typically goes for highly optimised designs, with attachments specifically tailored for each challenge, attached to a high performance drivetrain and using carefully selected sensors. I’m going to be using a robot kit as the basis of my entry, and my only sensor is going to be a camera. I’m hoping to use off the shelf items wherever possible even if they may be a little compromised. In addition to that, I’m going to attempt to enter *all* challenges autonomously, even those intended to be driven using remote control. By starting with a kit, I’m hoping that I can get a moving chassis very early on, so I can get maximum time to develop and test the software.

Progress has been very good so far. I decided to use Coretec robotics ‘Tiny’ chassis very early on, as its a nice, popular platform that other pi wars competitors will recognize, its not that expensive and its not super fancy (important as I want this to be a relatively budget build and show others what can be done with simple and cheap mechanics). I saw them at the competition last ear and was impressed how well such a small chassis coped with the obstacle course. In fact in many places it had an easier time than its larger competitors.

The tiny kit comes with the basics of a moving chassis: wheels, motors, chassis (including camera mount) and motor controller. At a minimum, that leaves me to select the Raspberry Pi board I’m going to use, along with the battery, voltage regulator, camera and LEDs. All piwars bots need extra LEDS :-). Taking those in order:

Pi board: This was an easy one. Since I want to use computer vision for the challenges, its inevitably going to be computationally intensive, so I wanted the fastest board I could: Pi 3 B.

Battery: As above, due to the processing power (and therefore power consumption) and learning from previous years, I knew I wanted the highest capacity battery I could fit in. Lithium polymer batteries offer the most energy density and the best value at this scale, so that decides the battery technology. The stock Tiny kit motors are rated for about 6V, but I expected they’d cope with being slightly over-volted for a bit more speed, so I went with a 2 cell pack (7.4V nominal). Hobbyking do a vast array of lipo batteries and I knew from previous projects the quality is ok, so I used their battery chooser to find the highest capacity pack that would fit within the kit chassis – 2.2Ah, that will do nicely : – )

 

Voltage regulator: Hobbyking also do a bunch of regulators (often called a BEC in radio control circles, a Battery Eliminator Circuit, i.e. it eliminates the separate pack that used to be used to power an RC receiver). I picked a 5A version so it was definitely adequate for the burst current a Pi may need.

Camera: I went for the Raspberry pi branded camera as I knew it would *just work*. I’ve also bought a clip on wide angle lens to hopefully reduce the amount of turning needed to spot things. The quality of the wide angle lens isn’t great though, I may have been better getting a Sainsmart Pi Camera as it already has a built in, well matched wide angle lens and is a bit cheaper.

LEDs: most Piwars bots have some flashy RGB LEDs on them for decoration. I also wanted to have LEDs but, after a suggestion from Rob Berwick, I’m going to try to use the lighting for something functional. One of the challenges with computer vision is variable lighting conditions, particularly shadows and colour changes. Sharp shadows can create edges and shapes that the detection algorithms can mistake for the actual target. By having very high power white lights, I’m hoping I can balance out the sun, reducing the affect of shadows. Beating the sun requires *a lot* of light though, about 15watts by my calculations (1000lux over about 1m^2 requires 10-20watts). Sparkfun do a pack of 5 3 watt LEDs, so I’m going to setup an array of wide beam headlights.

 

So those components cover the basics. I also wanted a screen on the bot for debugging, so went with a fancy touch screen from Adafruit, so I can also drive menus. Unfortunately, after buying the screen, I realised It had created a bit of a challenge. The screen uses about 8 of the Pi’s GPIO pins, and many of them clashed with the pins of the explorer motor control board that comes with the tiny kit. that controller also doesn’t work well when stacked under a screen, and it can only drive the motors at 5V (from the Pi), not battery voltage. I went looking for another motor controller
but couldn’t find one that meet all my needs, particularly the need to stack. The best I could find is a Picon zero from 4tronix, but that doesn’t stack, so I needed to find a way to get the neccesary control signals to it. Luckily the Adafruit screen includes a second set of pins on the underside, duplicating the full GPIO array, so I’m planning to use a ribbon cable to connect them to the motor controller. Getting this to fit turned out to be a much bigger headache than I’d expected.
With my component selection covered, I’m going to leave it there for this week, other than to say a CAD model of the current design is now on Grabcad here: https://grabcad.com/library/pi-radigm-v1-piwars-robot-1

I’ve done a wiring diagram with Fritzing:

 

 

 

 

 

 

 

 

 

And the build currently looks like this:

 

Next week I’m hoping to get the wiring finished, some basic software going so that its driving, and I’ll talk about how I’m planning on attacking each Piwars challenge.

Reminder: please vote for Hitchin Hackspace on the Aviva site here:  Hitchin Hackspace Community Workshop  We are very close to getting funding to enable our Hackspace, we just need a few more votes.

Thanks

Mark

*Thanks to Pimoroni and Coretec robotics for letting me share CAD of their parts.