Introduction form Steve
I think it was back in February 2018 when James turned up at Leicester Hackspace along with his mother and sister with an interest in building a robot and learning some electronics and software. That summer he successfully applied for PIWARS 2019, now we just had to build a robot.
Our first entry, team RATAE, was based on hardware that James
already possessed, a PI0W, Pimoroni Explorer Hat and a PI Supply Controller. So
James set-to designing the chassis and I said I would help with the software.
We did not realise it at the start, but we were effectively building the Tiny
4WD robot. The first chassis was built out of Mecanno . Documentation on the PI
Supply website led us to “Approximate Engineering’s Python Game Controller”.
This is going to be simple I thought, as the software for controlling the robot
was already done, I just had to interface to my Je-Vois camera, add some line
following sensors and we would be started,famous last words. James would have no problems at home
controlling the robot, but as soon as he stepped into the Hackspace, everything
stopped working.
After a couple of visits to the Robot sessions at Cambridge
Makerspace we were making some headway. A purchase of a decent USB power bank
sorted out power issues, it still was not 100% reliable.
Off we went to PIWARS 2019 and it worked on the day. Although
it should not have! There was a bug in the software which explained our
reliability problems, sometimes it would generate an exception and stop it
working, other times it would not. We found that fault after the event!
Off to the PIWARS Mini Conference for a great day out in
October 2019. James purchased a REDROBOTICS hat to use with his PI3. This was
going to be the basis for PIWARS 2020, entering as ECO-AMICA.
With help from Brett at the Hackspace an improved power
supply was built and James designed and printed a new chassis using OpenSCAD.
The chassis had space for a camera and line following sensors, James
incorporated a NERF gun on a trailer. We
were making progress , a reliable system we could stream video, (using an
example for pyimagesearch.com) just had to sort out line Following.
Then lockdown happened. We had a problem with one of the Line
Following sensor’s and never managed to resolve the issue. I started to look at line following using the
camera but never managed to complete it. My excuse is that I did not have a
working robot at home to test it on.Still, James created a video and did everything
under manual control.
So here we are Team “Doing a Raspberry”.
Our basic hardware is the same. I managed to build my own
robot, finally succumbing to some Pimoroni Offers and buying a set of Meccanum
wheels I put something together. I knew all those bits I had up the loft would
come in useful, a spare PI3 , camera, two motor controllers, 4 Pimoroni Motors.
At the PIWARS mini-conference I was impressed with Brian
Starkey’s approach to edge detection. I have used that rather than OpenCV as a
starting point. It is still a work in progress, it follows a “bendy” line but
does not follow a curve. I had this great idea of using Multi-Processing so
that the Image processing script would run on one core and the robot control
script on another. Gave up because I could not get the two scripts to
communicate. So we can check the algorithm I stream annotated video to a
webpage, then it occurred to me, why not add an API request to get the error,
and that is what I did. The robot control script requests the current line
error when in line following mode. It seems to work, at the moment frame rate
is about 10Hz.
On my test robot the camera is low down, it is going to be
fine on the actual robot as the camera is mounted higher up. If you want to see
how not to write code in Python, search github for windy54, I have put all of
our code there to make it easy for James to download.
We are currently trying to have weekly zoom sessions, GCSE
course work permitting for James and
baby sitting duties for me. But finally, James is having to modify some code, changing my robot
control script to work with his Redrobotics HAT and add in the requests for
line error.
Another member Bill has just created a base for our course,
so we need to create our own “Up the Garden Path” track to test it out. Just
under 4 months left to finish the software, watch this space!
Steve Gale
Comments
Post a Comment