Week 2 – 2019 – James

Hi, James here again. Today I was working on the hints for the senior competition. Just saying I’m not in the senior competition but Dads asked me to have a go at it anyway. The hints look like this and they tell the robot which way to turn so they don’t turn somewhere where the line disappears.

The hints in Robocup Jr

Last year we had a table telling the robot what to when a certain event happens in our two sensor line follower. You can see this table below.

          Inputs           |         Outputs
---------------------------|--------------------------
Left Sensor | Right Sensor | Left Motor | Right Motor
------------------------------------------------------
White       | White        | Forwards   | Forwards
Black       | White        | Stop       | Forwards
White       | Black        | Forwards   | Stop
Silver      | Silver       | Stop       | Stop

Since we haven’t added green in the table, we’ll change it to see if we can try and detect a hint. The new table will look like this:

          Inputs           |         Outputs
---------------------------|--------------------------
Left Sensor | Right Sensor | Left Motor | Right Motor
------------------------------------------------------
White       | White        | Forwards   | Forwards
Black       | White        | Stop       | Forwards
White       | Black        | Forwards   | Stop
Not White   | Not White    | Stop       | Stop -> HintDetector MyBlock

If both are ‘Not White’ it is likely that the sensors are on either green and black or silver and silver.

If both sensors were on silver, they would both receive the same amount of reflected light. If one sensor was on green and the other sensor was on black, we think that green would reflect more light than black.

To compare the two sensors, we will use maths to work it out.

If we subtract the left sensor from the right sensor and take the absolute value we will get a result. If the result is close to zero, both sensors probably would be on silver. If the result is bigger than zero, the robot’s probably on a hint.

The absolute value is basically if a number is negative, just ignore the negative sign.

We can show this in a table to make things simpler.

      Reflected Light      | 
---------------------------|----------------------------
Left Sensor | Right Sensor | Difference (Absolute Value)
--------------------------------------------------------
80% (Silver)| 79% (Silver) | result = ABS (80 - 79) = 1
10% (Black) | 20% (Green)  | result = ABS(10 - 20) = 10

This approach may not work. If it doesn’t, we’ll have to think of something else. Here is my code so far. You can click on it to make it bigger.

My code for detecting the hints so far…

Next week I will keep working on it to see if the idea works.

Before I go here’s the word of the day…

Heuristic: A practical method for solving a problem that is not optimal or perfect but sufficient for the immediate goals.

Bye everyone…