Week 5 – 2019 – James

Hi guys, today I worked on the junior competition requirements for the Robocup Jr junior competition.

Here are the tiles you’ll have to complete in the junior competition.

The tiles in the robocup Jr primary competition.

Some time ago I think I had a photo of my 2 sensor line follower. But this time I’ve made the line follower even better. Here’s what I did…

Firstly, in the senior competition there are those green hints. I added a variable called “use_green_hints”. I used that to look for the hints if I turned the variable setting to true. If I put it to false, the robot would not be looking for hints. This would be useful because in the junior competition, there are no hints. But if you compare that to the senior competition, there are hints.

With that true or false variable, I put it in to my ‘Declare Variables’ ‘My Block’ along with the speed and turn speed variables, as you can see below on the far right.

The new variable is a true or false block so you can turn things on and off like this case for instance.

You can see the code below for using the true or false block where that green line is leading to.

The code for turning the hint finder on or off. (The blocks after the “use hint” comment are not necessary but the code still works.

There will be a ramp included in the competition but we don’t have one yet. It should be made sometime soon though.

That’s it for today’s post, so now i’ll give you the word and phrase of the day.

Lionize: To treat someone as a celebrity; pursue celebrities

It’s better to offer no excuse than a bad one – George Washington

Bye…

Week 5 – 2019 – Oliver

This week I updated my line-following code to include the hint-finding MyBlock. I had to connect the logic output to a logic variable, which cut the program out of the infinite loop.

My updated line following code

To incorporate the hint-finding code into my program, first I had to make a MyBlock of what the robot should do when it comes across a hint. The program finds the direction the hint is facing based on which sensor is receiving more light. If the left sensor is receiving more light than the right sensor, the robot turns left and vice versa. I put a Display block to show whether the robot was meant to be turning right or left. The wait block is at the end so you can read the display.

The testing code for the MyBlock

The robot turned on the hints the right way when it found them, but it had a problem when it came to the silver. The program found a hint before the silver, meaning the program must have detected a light difference higher than 1.

When I looked in port view, the difference between the two sensors when the robot was on silver was 3. I changed my code to accommodate for this by making the difference 5, but the robot still detected a hint before it came to a stop. This is a mystery that remains unsolved and will do until next term.

Useless Fact of the Day: 99% of all the mass of the solar system is concentrated in the sun.

Week 4 – 2019 – Tamsin

This week at coding I learnt alot about code and how to do it so let’s get into what I now know and what I learnt.

So, this week I learnt how to make the robot wiggle 5 times. To make the robot do so you have to read the instructions below.

1st you put the speed to as high as you like. 2nd on the next speed block put minus the same speed. 3rd you put how many turns. I put 0.125. 4th repeat steps 1-4. 5th get a loop and put everything inside it

For the next code I made the robot wiggle on green. For this I used my wiggle code put it in the true for the switch block and added a steering block but only used it for going straight until it finds green.

This week coding was fun. We learnt a lot of stuff this week. I did my work a lot faster so i could get more stuff done and it worked so I will do that next week too.

Week 4 – 2019 – Sara

Hi again…

This time at robotics I made a simple 1 sensor line follower. I found it pretty complicated to get the robot to follow a straight line, that was partly because it wouldn’t start exactly on the black line sometimes it would start on white and thats when it wouldn’t work at all.

The code worked better when the robot was making turns but not so much for when it was going straight.

This was the code I finished, even though it didn’t completely work…

Pretty much all the code tells the robot is, if you see black turn right if you see white turn left. This makes the robot wiggle and follow the line at the same time. The reason why it wiggles is because I only used one sensor, if I had used 2 then it would have wiggled way less.

Well good bye, I’ll write again next week…

Week 4 – 2019 – James

Hi guys, today I worked on my hint finder (again). This time I got around some tight corners which looks like very sharp corners.

The code for the sharp turns and hints.

The turns were in the junior and also maybe the senior compition. The problem we had is we had to get around the hints and the tight corners together.

We tried to do them both with the previous code but it didn’t work. I thought that if I moved the sensors closer a bit and make the turn speed more aggressive, it might work. It sometimes went through the turns and sometimes did not. So that was the good news but the bad news is it gets up to one off the hints and goes off course and goes around in circles.

I decided to put a stop program block in the hint section but sadly, it doesn’t let you. This time I thought of making a my block because you could make one with a stop program in it and make the robot stop. (I called the block stoppy). I tried that but it also didn’t work! I thought if that didn’t work I could stop the motors and then stop the program. It didn’t work, again.

It was about time I headed back to class when dad came up with an idea. He saw that Sara and Tamsin where using one motor to go forward and one motor to go backwards and it was turning. When dad told that to me I thought that could possibly work to get around the sharp corners and complete the hints. But it might not work. You’ll just have to wait till next week I blog.

Before I go here is the word and the phrase of the day.

Perseverance: Persistence in doing something despite difficulty or delay in achieving success.

You have to be able to accept failure to get better.LeBron James

Bye…

Week 3 – 2019 – Sara

Hello there!

This week in coding we did quite a lot. Here’s a few things we did…

First we started off by changing our code from last week (the one that made the robot make a square). Instead of making one wheel stop and wait for the other to spin 409 degrees, we made both the wheels keep moving, each in a different direction, thus making the robot move back and turn 90 degrees at the same time.

After this we started using the colour sensor. We had to use pseudocode once again to write our code later on, here was my pseudocode for the robot to detect the colour green…

Step 1: Move forward

Step 2: If green found completely stop

Step 3: If nothing found repeat until green is detected

That was my code for the robot to detect the colour green. It worked quite well, when I put the green Lego piece in front of it, it detected it and stopped, it stayed there until I removed the Lego block then it moved forward again searching for some more green.

This was my next challenge…

Step 1: Move forward

Step 2: If green found completely stop, if not keep moving forward.

Step 3: If red found stop and wiggle 5 times, if not keep moving forward.

Step 4: If no colour is detected keep moving until something is found…

That was my finished code. The first block told the robot to move forward at a speed of 50, the second block told it to look for the colour green, then it had a switch block after that which meant that if green was found the robot should stop but if it wasn’t found then it should keep moving. After that it had another switch block, but this time it was looking for the colour red, if red was found then it should stop and wiggle on the spot 5 times, if not then it would keep moving until one of the 2 colours were found. All of this was put inside a loop block, which meant it was going to keep doing this until someone stopped the robot.

Ok I guess that’s it, I’ll write again soon with more to tell from our next time at robotics…

Week 3 – 2019 – Tamsin

Hello this week we made the robot stop on green and if it doesn’t find green it keeps going until something gets in its way or its battery runs out here are some pictures of my code.

We also changed last weeks code because it was so slow we wanted to speed it up a little so we did some work it was fun.

We figured out that if you half your wheel spins and that if you have one wheel at the speed of 40 and the other wheel going -40 instead of 0 it moves and turns faster

This week was so fun we did mostly our own code and hardly used Richs’ help. Can’t wait until next time because it was so fun this time and I hope it will be fun next time to.

Week 3 – 2019 – James

Hi guys. Today I finally figured out the hint bits in the senior Robocup Junior competition.

As I showed you last week, the hints looked like tiny green squares which were tucked in a certain corner. They are used for telling where the robot should go.

Sorry but my code was not uploaded but i’ll try to explain it as best as possible.

So my hint detector would run when either the left and right sensor was on the silver or when both sensors were on green or black.

If the left sensor was on green, the robot displayed on the screen “Found hint”. It would be the same if that happened to the right sensor. But if both were on silver, the robot would stop till the robot starts up his can finding algorithm.

Sometimes it incorrectly identified what it was on. To resolve that problem I made 1 as the B number in the math calculation. Next time it worked and was consistently working after that.

Next week, I’ll enhance the hint detector and finish the hint bit. (Well, maybe).

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

Mindset: The established set of attitudes held by someone.

And also, here’s the phrase of the day

You learn more in failure than you ever do in success – Jay – Z

Bye guys…

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.