Thursday 12 November 2015

ElMo: finishing the finishing touches

Not a lot of time for blogging this week - too much coding to do:)  But we finally drilled and shaped our orange perspex lid for ElMo.  Looking good - a bit waspy perhaps?

We've spent quite a lot of time coding this week - as the deadline for the code review is on Saturday.  You can see how that is going at our bitbucket.  The new straight line speed test code uses an ultrasonic sensor to keep track of how far we are from the wall.  It does not work at all well unless the sensor is at right angles to the wall - because the reflections just don't bounce back otherwise.  We needed a bit more metal to be able to do this - we are making judicious use of wing nuts so we can swing the sensors to face forwards or sideways.  The line sensor is the last bit of code and is still 'bleeding edge' software - this is using 3 IR sensors that can detect black and white (as shown in the photo).  But it turns out we can use the same code to stay over the line as to stay close to the wall - we just need to change the comparison functions we use.  The technique uses something called a proportional integral derivative controller.  See this page for more details.  We've also checked our code using an online pylint tool - you can upload your python code and see how well it conforms to python standards.  After much refactoring we now score a fairly respectable 9.66 out of 10.

There are a number of parameters that we will need to change on the day.  Our very naive three point turn relies on knowing how long it takes to travel one metre and rotate 360 degrees - but these values change depending on the how much power is left in the batteries.  So we'll write a calibration function that will allow us to change this from the menu - and write the values to a configuration file so we can read them back in if we reboot.  We need to tweak the parameters for the various challenges.  And we need to stop the ball rolling away from the cannon as we push it forwards.  But it feels like we are getting there - which is probably just as well given there are only 3 weeks to go :)

3 comments:

  1. Thanks for the online pylint tool reference; we'll use it if we get the code finished.
    I've also used Trinket.io for online Python editing of basic code.

    Agree with you on the calibration routines, we have spin, turn and straight line over three marks (sensed dark lines).

    Nick & Jen - PiRSquad

    ReplyDelete
  2. I think it is awesome, the people who made it must be geniuses!☺☺☺
    Eleanor

    ReplyDelete
  3. I think it is awesome, the people who made it must be geniuses!☺☺☺
    Eleanor

    ReplyDelete