Featured

Introduction

Welcome to the children’s website about their journey to enter a RoboCup Junior competition in New Zealand.

Their aim is to compete in the Rescue Challenges.  One of the requirements of being in the competition is listed in the Rescue Rules as:

7.1.2.  All teams must maintain a logbook detailing the design, development and construction of the robot and its programs.

This website will be their means to achieve this.  It will allow them to keep a record for themselves while, at the same time, allowing them to share what they are doing with family, friends, and the school.  It will also give them some experience of using WordPress as a platform.

Some of our aims are to:

  • Examine different line following algorithms from very basic to more advanced
  • Critically evaluate how each algorithm performs and use observation of the robots behaviour to go back to their code and make iterative changes to see if improvements can be made
  • Develop strategies to make changes on the fly, during competition time, if the robot fails the task, for any reason.
  • Learn documentation skills and ways of managing code history.

We hope you enjoy following their progress 🙂

 

Week 3 – 2019 – Oliver

This week I made a new line-follower program with 2 sensors. This program doesn’t need to wiggle to stay on the black line. It uses the amount of reflected light to tell which direction to turn. The program is shown below:

My new line-following code (click on this image to make it bigger)

James and I started making the code for our hint-finder part of the line follower. If the sensors are on neither white nor black, they must be on green or silver. The robot automatically veers onto the hint, meaning one sensor is on green and the other on black. The difference between the right and left sensor is about 10, so we can use math blocks to work it out:

Sensor 1 (10) - Sensor 2 (20) = -10
The ABS of -10 is 10, so the output is 10.

ABS stands for ABSolute value, which removes the negative sign. The result is the difference between the two numbers. However, if the robot finds silver then both sensors will be on it. Therefore the sensors will receive about the same value, with an exception of 2 or 3. The absolute value of silver will then be lower than 3, which will trigger the can-finding program.

The table below explains the amount of light reflected from silver or green hints for each sensor:

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

This screenshot is my hint-detector test code, which will show “GREEN” on the screen on a hint or “SILVER” if on silver.

This is my hint-detector test code. (click on this image to make it bigger)

But, of course, to incorporate this into my code would require a MyBlock. For the MyBlock to work effectively with the code, I needed to remove the loop and turn the if/or statement into a logic output statement, which you can make from the MyBlock menus like shown below:

This is how to set up a MyBlock for logic statements.

Finally, I placed the finished MyBlock in my line following code. When the colour sensors are both on silver, such as when it reaches the end of the line and the start of the can finder part, it cuts out of the loop and will lead to the can finding algorithm. I am yet to make a program to turn at the green hints, so I will come to that next week.

The semi-finished hint-finder MyBlock. I will add to this in future weeks.

Useless fact of the week: The closest fraction to pi is 22/7! Check on the calculator if you don’t believe me! (22 ÷ 7 = 3.14285714286 and π = 3.1415926535)

Week 2 – 2019 – Tamsin

This week Sara and I did a challenge to make the robot turn in a square.

This is the instructions we were given

Step 1 : Go Forward 25 cm

Step 2 : Turn left 90 degrees

Step 3 : Repeat steps 1 and 2 three more times

This is a sample of our code we used below.

We tried a few times but the robot failed to turn the correct angle so we adjusted the code a few more times.

We changed the angle by little bit more each time until we had the correct code to make it work.

It was really fun trying to make the robot turn in a square, I enjoyed it so much I can’t wait until the next coding lesson.

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…

Week 2 – 2019 – Sara

Hello there !

This week at robotics we finally started doing our own codes. It was really fun, it was kinda hard at the start but then I got the hang of it.

We started of by writing pseudocode for the robot to make a square. This was my pseudocode…

Step 1 : Go forward 10 inches ( around 25 cm) Step 2 : Turn left 90 degrees Step 3 : Repeat steps 1 and 2 three more times

This was my finished code…

The first green block was to tell the robot to move forward for two wheel rotations at a speed of 50, the second block was telling it turn off its left motor but the right motor should keep going and turn 409 degrees to the left. Then repeat this three more times.

The hardest part was finding the right number of degrees it should turn, I started of at 300 degrees and kept increasing until I found a degree that it had turned perfectly.

At first I thought that if I put 90 degrees it would make a perfect turn, but no, because I was coding for the right motor it meant it had a longer way to turn than the left motor. And if I put down that the left motor should turn 90 degrees I think it wouldn’t have worked because it would have needed the right motor to come along with it and that would mean I would have to wright two different degrees for each of the motors.

Ok , goodbye I’ll wright again next week.

Week 1 – 2019 – Tamsin

Today we learnt about variables and how they can be like collections and shopping lists how they store things. We also learnt that green spaces are clues or hints.

We learnt that the robot reads the instructions that we give it and that it follows the black line. To make it follow the black line it reflects the black and white and finds the middle of it. You have to use the variables to make it do so.

In the green square, which is a chemical spill, there is a person that needs to be saved but is too dangerous for a person to go in so we programmed the robot to save the person without the person falling over and get it back to safety.

To get to the person in the chemical spill it uses the ultrasonic sensor to locate the position of where it is, It knows the area of the spill due to the colour of the block detected by the colour sensors.

Week 1 – 2019 – Sara

Today was the first time we were at robotics class, by we I mean James, Tamsin, Oliver and Me. Tamsin and I are both new to it this years but the boys were there last year. We pretty much did the basics today, we checked out how the one sensor line follower is different to the two sensor (the two sensor makes it wiggle less)

We did some pseudocode on the robot following lines and using the sensors to find the can ( the person who needs to be rescued). We also learnt how to use the robot (turning it on, selecting the right code, ect.) We used some of Josh’s codes from last year just to see how it works and then next week I think will start doing our own codes.

By using light reflection it seems easy enough to tell the difference of when the robot is on a black surface or a white surface, on a white surface about 80% of light is reflected back, on a black surface its only about 10%, it can also tell the difference between green and silver. None of these colours reflect back the same amount of light that’s why its easy to tell the difference between one another.

We also looked at the Ultrasonic Sensor, its used to detect objects by using sound waves. It sends out a wave until it hits something and comes back to the sensor, therefor detecting how far away that object is. The speed of sound is 343 metres per second, so all this happens pretty fast.

Ok bye, I’ll write again next week…

Week 1 – 2019 – James

Hi, James here.

I’m back this year and with a new class! The people in this years Mindstorm class are Tamsin, Sara, Oliver and Me (Obviously). For this lesson, we just learnt stuff about the Ultrasonic Sensor and the Light Sensor to remember the important things. (Because there are two new coders). We also learnt a bit about pseudocode (Which I know about).

So we firstly looked at the line follower made by Josh last year. The line follower was really basic because the robot wiggled a lot. But when we used the 2 sensor line follower the robot didn’t wiggle as much as the basic line follower. I made a table to show the people reading how the 2 sensor line follower works.

You can look at the table here

When we were looking at the light sensor we also looked at how much light was reflecting from a certain colour. We tried it on green, black and white. White reflected about 80% of light, black reflected about 10% of light and green reflected about 20% of light. We found that out by using the Port View on the robot.

We also looked at the Ultrasonic Sensor. The Ultrasonic sensor is a sensor that sends sound waves till it hits an object and then it comes back to the sensor at a speed of 343 meters per second! We’ll use that sensor for locating the can (AKA the person who needs to be rescued). Last year Oliver, Josh, and Brayden used variables to find the can and push it out. By, locating the can, seeing how many degrees to spin till the sensor can’t detect the can then dividing that number of degrees by 2, the robot will turn back that many degrees to push the can out. I did the Can Finder challenge a different way. I used the turn motor block to spin the robot in only one direction then when it locates the can, the robot will push it out of the “Chemical Spill”.

For the new kids joining this year they had to do a challenge on Scratch. To do it you had to use variables. The meaning of a variable is:

A container with a name that stores important information. ( e.g The score in a game of Pac Man)

Sara said, “That there were different variable types”, “one is an ordinary variable (Like the one I gave the meaning on), another one could be a list, and another could be a collection”.

Before I go, I will always put a word of the day in. Today’s word of the day is…

Ascetic – Extreme self discipline and abstention from all forms of indulgence, typically for religious reasons.

Bye. See you next time I blog about my newest Mindstorm adventures…

Week 12 – Oliver

Last week I wasn’t at coding so I missed out on the 2-sensor line-following session so I caught up on that today. We joined up our line-following code with the ‘find the can’ code from 2 weeks ago to make a piece of code that can do the whole course. This course will not be the course we do in the Robocup Junior next year, instead, we will be doing the Senior course in which you have to reach up to a platform to get the can and there is a harder line following course. Here is a picture of my code:

Some problems I had today were stopping the infinite loop and getting the robot to move again once it had got out of the loop. I solved this by changing the loop type to a colour sensor loop so it exited out of the loop when it detected grey.

Week 10 – Oliver

This week at coding we came up with a better solution for our find the can code. If the robot was pointing straight towards the can my code made it go forward 2 wheel rotations, turn clockwise for 1 rotation and then repeat the old code. I also made the robot slowly go up to 50 speed when it is pushing the can so the sudden jerk didn’t make the robot go skewed. This meant that some parts of my pseudocode:

(Newer) Pseudocode:
1. When the robot reaches the green area, stop moving.
2. If the can is in the robot's field of view then go forward 2 rotations, otherwise go to 4.
3. Turn 1 rotation clockwise and continue.
4. Turn on axis anticlockwise until an object is detected within a range of 60cm. (can)
5. Turn 1 degree at a time anticlockwise until the can is not detected while counting number of degrees.
6. Halve the number of degrees turned and turn clockwise that number.
7. Move forward, 3.5 rotations, increasing the speed of the robot each time.

This is my pseudocode turned into Mindstorms code:

Some problems that I had were the robot’s ultrasonic sensor having a very wide range of vision, meaning that the algorithm that I had made got confused by the can being straight in front of the robot.

This is my programming in action for the find the can part:

Next week we will do a line follower with 2 sensors and join that onto our find the can code.

WORD OF THE DAY: Cancatervate – Heaping things into a pile.

Week 11 – James

Hi, James here (again)

If you are wondering why this is named week 11. It’s because we didn’t write  for 2 weeks, except for Oliver, so that’s why.

Today we were making a 2 sensor line follower.  We used 2 colour sensors to detect reflected light of a certain colour like black, white and silver.

We are using 2 sensors because there is a silver line at the green chemical spill blob so we need to stop there.

This is how the 2 sensor line follower will work.

          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

Note:
Black reflects about 12% of the light
White reflects about 72% of the light
Silver reflects about 30% of the light

For our inputs we used greater than 50% to detect white and less than 50% to detect black and silver.

For this post I think this won’t need pseudocode because my table describes it perfectly.

Here is my code for the 2 sensor line follower.

We used variables to set the speed for how fast the robot turns around corners and for its forward speed.  We used variables so we didn’t have to change speed values in many blocks of code.

We tuned it by experimenting with different speeds to see if it would follow the line on our mat and not run off.

There was a thing very interesting.  I couldn’t use a turn speed of 70 but I could use a turn speed of 75.

The two sensor line follower didn’t jiggle around like our original one sensor follower.  The two sensor follower behaved more like the 1 sensor PID line follower which was made by Richard.