Pi Wars week 5: The Canyons of Mars

29th Oct 2018

The new maze course has been revealed for Pi Wars:

The actual course being revealed is a little of a surprise, as the challenge description initially said the design would be a surprise, encouraging either a generic approach (like wall following) or a ‘maze solving’ strategy. Now the actual course is known, a more specific and optimised solution will probably be faster and more reliable.

Last year we looked at different approaches to the course, to see which might give the fastest or safest route. This year we’re expecting to have a better handle on where we are on the course (using the encoders and IMU, as well as distance sensors), so that may open up some faster and more sophisticated lines. We thought it was worthwhile to sketch the options out and see how the theoretical times compare, to see how worthwhile it might be to do the development.

First up we have the simplest planned route, one that’s relatively easy to program using only information from two or three distance sensors and is fairly safe: the straight, centre line course, turning on the spot in the corners:

This is the strategy we started with last year (see test video here: https://youtu.be/EV7YIHr5feg?t=518) Like in previous years, we’ve also developed a simple model of how fast we expect our robot to accelerate:

 

 

 

Previously this approach has been fairly accurate at predicting times in the straightline speed challenge, so we’re fairly confident in using it to estimate performance for the maze.

Using this model, we can combine the acceleration profile and the distance of each straight line segment of the approach above and estimate the transit times. Adding on a time to turn 90 degrees at each corner (we’re assuming 0.1 seconds, as that’s about what Piradigm needed to turn 90) gives a predicted total time of 5.3 seconds to complete the maze. If you’d attended previous Pi wars, you may think this was a ridiculous prediction, as most competitors took  20-30 seconds. This was mainly because they take a very tentative approach to the maze. Last year in practice Piradigm could fairly repeatably achieve 10second times whilst not running “full throttle”: (https://youtu.be/EV7YIHr5feg?t=541) and we did achieve one ~6 second time, so its certainly possible.

Can we do any better than the straight line route though? As you may have seen in the video linked above, a slight variation is to do smooth turns for the corners instead of stopping and turning on the spot:

 

Last year we found this to be much faster and no more risky. Predicted time: 4.3 seconds, a handy saving. This is assuming each corner is taken at 1.6m/s, which is at approximately the limit of traction of the tyres. Hopefully the IMU will allow us to stably and repeatably skid a little in the corners, otherwise we’d have to go a little slower to retain control.

So that’s good, but can we do any better? It still doesn’t look much like a ‘racing line’ as you’d see in motor sport. If we know where we are on the course at all times, can we corner faster? or tighter?  We can approximate something like a racing line by increasing the turn radius (but keeping it a constant radius) and clipping the apexes on key corners:

(note this isn’t a true racing line, usually drivers won’t drive at a constant radius through all corners, it will be a different parabola-like shape with a late apex, starting accelerating before finishing the corner.)

With the larger radius turns, we think they could be taken at more like 2.3m/s, and the distance travelled is a fair bit shorter than the second course, so the predicted time plummets to 3.2 seconds!

That is a nice target number but in reality we wouldn’t plan a route taking us so close to the sides, we’re unlikely to be perfectly positioned and hitting a wall can disorientate the robot and end the run. How much longer would it take if we take a racing line with a safety margin? say 75mm clearance?

The ‘safer’ racing line is ~0.3m longer and the slightly tighter corners mean going a little slower at 2m/s, but the predicted time is still only 3.6 seconds.

That’s all great, but the above predictions were assuming no downforce. As we discussed in our week 3 update, we’re intending to fit a vortex downforce generator. So how much faster can we go with that?

For the ‘safer’ racing line we’re predicting a 3.1 second time, and the faster, riskier line a bonkers 2.6 seconds.

 

Some crazy numbers, lets hope the software and electronics can give us the control needed to get the hardware to deliver the times its capable of.

Pi Wars week 4: schematics

23rd Oct 2018

Not much progress to show again this week. We’ve again been researching and trying to get our heads around Kalman filters, and have been learning a new software package to design our chassis/pcb.

In every one of our previous Pi Wars entries, we’ve had issues with loose wires causing erratic behaviour at some point. We’ve often wondered if having a pcb made to eliminate  much of the wiring would be easier and more reliable. So this year we’re going to try to have as few cables and connectors as possible and mount most components directly to a pcb.

We’ve designed a few small pcbs in the past, but we’ve never been happy with the pcb design software. This week we’ve been learning Diptrace, and now have the beginnings of a schematic to show for it:

We still need to add some components, like the drive motor controllers and connectors for components that won’t be mounted directly to the pcb (like the IMU, batteries, motors etc), then we can move onto routing the actual pcb design

In other news, the cheap encoders have arrived, but we’ve not had chance to test them yet.

 

 

 

 

 

Pi Wars week 3: Vortex generator

16th Oct 2018

Pi Wars has many challenges where fast acceleration and cornering are important for the fastest times. Certainly last year Piradigm, whilst it wasn’t the most powerful robot, when running well it was still traction limited in the Minimal Maze and Over The Rainbow Challenges. This year the Straight-ish Line speed test may also require good cornering and the Pi Noon challenge always favours good drivers (or code!) even more if the chassis has good handling. We’re hopeful that our software and hardware this year will be capable enough that extra traction would increase performance. To that end, we’ve started testing a novel ‘vortex generator’ style of generating downforce:

Before we explain the weird design,  some background:

Formula one cars corner much faster than normal cars due to their aerodynamics: as they move along,  they use wings to deflect the air upwards, pushing them into the ground, increasing grip without increasing weight. This works great if you have the power and speed to do that. unfortunately most Pi Wars challenges are completed at less than 5mph, so the wings would need to be huge to have any effect.

In another, more closely related analogy, Micromouse robots need to accelerate and corner quickly to solve their mazes in the fastest time. As designs have developed, the winning teams in this competition now all use fans to generate downforce. The mice have a flexible skirt under their chassis, much like hovercraft have, but these are arranged so the fan sucks the air out, creating a low pressure even when the mouse isn’t moving, sucking the robots to the ground. This works well since their course is very flat and smooth, so the skirt has almost no leaks. Check out their incredible performance in this video from a competition this year:

Inspired by those, and the small toys that can run on ceilings, I first included a downforce generator in one of my projects in my entry for power tool drag racing:

This design was a little different to the above mechanisms, it used a vortex suction generator, which is a vaned, high speed spinning bowl that spins the air rather than sucking it, to generate the required low pressure with lower power consumption and less reliance on a good seal with the ground. The theory is that because the air is spinning, there must be a pressure gradient to keep the air going in a circle. Since the outside of the bowl is at atmospheric pressure, the centre must be at a much lower pressure, sucking the bowl down.

For Pi Wars we’re hoping to use a similar design but on a smaller scale, and only if the rest of the system is fast enough to benefit from it. So far we have 3d printed the above CAD:

And done some spin up tests in a test rig:

In this test, we held the rotor above a metal toolbox, that was supported by some scales. We were hoping to both test if the rotor could survive the very high speeds required and,  if it did, what level of downforce we could generate (measured by the lift or reduction in weight of the toolbox). For the test we were stood well back, with a full face shield on in case the worst happened.

From the test video, you can see it was a successful test: the rotor survived spinning up to ~14000rpm and generated over 900grams of downforce, despite having over 5mm of ground clearance! For comparison, from the latest CAD model we have of the overall robot design, we’re expecting the all up weight to be about 800grams. Which means we should be able to corner at up to 2g, if we have sufficient control.

 

On the software side, we’ve been further researching kalman filters and how we might be able to fuse encoder data with the data from the IMU to give us the best possible positional information, and we’ve also had a few more components arrive:

multiplexer, ToF sensors, IMU

 

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