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.

Brayden – Week 11

This week in robotics class we decided to put two colour sensors on the Mindstorm. We decided to do this so that we could detect the green squares (hints) and use them to turn in the correct direction. To start the lesson we watched a video on YouTube to show us a piece of code that we could use to programme the Mindstorm. After writing this piece of code we then tried it out on the course. No ones worked due to the fact that the turning speed was far too low. Before we amended our speeds we decided to use variables (red blocks) to make it easier when we are changing our speed in our code. We tried this again and it worked. After revising our code so that it worked we decide to start ‘tuning’ our code. This meant we started trying various speeds and turning speeds so that we could have the fastest working robot. While we were tuning our speeds we agreed to move the two colour sensors closer together to see what difference doing that would make. It had a huge impact on the success of the Mindstorm. Causing it to lose the line at some speeds and perfecting other speeds. Here is my piece of code:

My code to use with two colour sensors

We will continue to tune and improve the performance and success of the Mindstorm by using the two sensors. Although we did not get to programming the Mindstorm to detect the hints, next week we will use the colour sensors to detect the green hints and turn in the direction of that specific hint.

Week 11 – Josh

Today at Mindstorms we looked at a 2 light sensor line follower.  We got started by watching a video of somebody else’s and realised it worked a lot smoother.

I then wrote some pseudocode.

  1. If both sensors see white go fast forward.
  2. If left sensor sees white and right sees black then turn left.
  3. If left senor sees black and right sees white then turn right.
  4. If both sees black then stop program.

I got the basic idea of how to do it fairly quickly.  But then I struck a problem when I put it on the line it turned the wrong way.  I had a bug, the motors were the wrong way round.  We worked on a double sensor follower because in the competition there are green squares (Hints) to tell you which way you go at the junction.  Bellow is the table of the situations that could happen with the sensors.

What code tells motors to do in table format

We also struck another problem that the turn and speed needed to be tuned correctly so it would make the turns.

We used variables for speed and turn rate so that we didn’t have to do it individually and make mistakes.

Here is our final code.

As you can see the last switch block has a stop sign so next week we will work on the next bit using that to read the hints.

Our Mindstorm Adventures continue.