Week 8 – 2019 – Tamsin

This week at coding we found a ramp that Mrs Bennett made for us. So we tried our line following program on it . The line following program didn’t work because the sensors were reading a lower intensity . That made the robot think it was on black and It turned in circles.

Then we had to pull apart the robot and pull the senses up a little bit so that took a chunk of our time away. In the end we finally got to the robot to work on the ramp but then we had to take it all apart again and put it out how it was normally set up so that we could do our coding on it. Here is some of my finished work that I have set up.

This week at coding I had a lot of fun but we didn’t get that much time to finish our coding but I finished mine because I had worked on it the previous week and now it works but we didn’t have that much time to finish

Week 7 – 2019 – Tamsin

This week at coding Sara and I finished our straight line following code here it is.

To finish my code from last week I did some research and noticed that I needed variables so I added just a couple of variables but I had no idea what to do with them

To solve this problem I looked at some of last years coders line following work and they for one had heaps of variables and two had heaps of code inside of ‘My Variables’

I also had a hard time knowing what the word threshold meant so I had to look it up and to me it meant a value that had to be met.

This week I had a fun time at coding and I was so excited that my code finally worked. I was stoked .

Week 8 – 2019 – Sara

Hey again…

Unlike lasts weeks blog this is going to be short. At robotics this week we were working on how to get the robot to go up and down the ramp. You may think, oh that’s easy, but it’s not. Why? Because when the robot starts going up the shadow of the robot gets in the way making it reflect back less light, and when the robot starts coming down the sensors get too big and cover up the black line.

Our first idea was too dismantle the robot and put the sensors a bit higher, but that didn’t work because that just made the sensors even bigger. So we had to dismantle it again and rebuild it the normal way.

Our next idea was that, when the robot started going up the ramp it would reflect less light due to shadows, that meant that in our code where we told the robot to stop when both sensors detected less then 40 the robot would stop at the bottom of the ramp. To fix this problem all we had to do was change that piece of code telling the robot it should keep going when it detected less than 40 on both sensors.

But that brought on a new problem, after the robot had gone over the ramp it would still follow lines but when it got to the silver part it just kept going and wouldn’t stop. That’s what we’ll have to figure out next time, how to make the robot stop after it has gone over the ramp.

Hope next time we figure this problem out, bye…

Week 7 – 2019 – Sara

Hi there….

If your wondering why I didn’t write my blog last week well it’s because there was no robotics (James was sick). But I’m back at it again this week, and here’s what I did.

I worked on my 2 Sensor Line Follower again, the one from week 6 worked only on straight lines and some curves but this week I managed to get it going on staright lines and all curves. First Rich showed me a truth table, here’s an example of one…

This pretty much explains what should happen on all four of these situations. The first three are self explanatory but the last one is a bit different, the last one says not black on both sensors which means it’s either on green or silver. Green and silver also reflect less than 40 which is like black.

Line Follower 2.0
You can click on the picture to make it bigger

That was today’s finished code, I put in some notes to make it easier to understand. Here’s the big (and long) explanation…

I created 3 variable blocks, Speed, Turn Angle and Reflected Light. This is so that when I have to change one of these things I only change it on the variable block and it automatically changes the rest. After all these variable blocks theres a switch block, using the left sensor it will look for how much reflected light there is if its greater than 40 then it should continue by going upwards, if its less than 40 then it should go down ( I’ll explain the up part first). After this theres another switch block telling it the same thing (if its greater than 40 go up, if not go down.) The only difference is that this time its using the right sensor to do this. (Going up once again) This part says that since both sensor are greater than 40 indicating its on white, it should go forward with a speed of 37.5 ( I’ll explain why that is soon). Now if the left sensor is greater than 40 and the right sensor is not then the robot should turn right 187.5 degrees with a speed of 37.5. By turning it will make the robot get back with both sensors on white again and when that happens it will move forward.

We’re finally at the bottom part of the code! The bottom part is when the left sensor is less than 40, it then has another switch block. Using the right sensor it asks if its less than 40, if yes go up if not go down. (Going up this time, it’s the last time.) Now it gets a bit complicated, it takes the Turning Angle times it by -1 and then puts the answer as the new Turning Angle. Which now means that when the left sensor is less than 40 (meaning its black) and the right sensor is greater than 40 (meaning white) the robot will turn left -187.5 degrees. The last and final line of my code is when neither one of the sensors are greater than 40, (which means they are both a dark colour) when they are under 40 the robot must stop.

For me to get the right Speed and Turning Angle I changed the speed right down to 15 and experimented with which Turning Angle worked best on the sharp curves. In the end I had Speed at 15 and Turning Angle at 75, but I found that the robot was really slow so I multiplied both these numbers by 2.5 and got the answer that I used on my code, a Speed of 37.5 and a Turning Angle of 187.5.

Finally done with it all, ok bye…

Week 7 – 2019 – James

Hi guys, if you’re wondering why we haven’t written for a week, it’s because of Dad looking after me. (I was sick last week). Anyway, I worked on my can finder (again).

The last one I showed you (Back in week 6) was partly done. But now, I’ve done more on it and put more comments in. Here is a reminder of what my last weeks one was compared to this weeks.

My last weeks can finder code. Note: the last loop hasn’t been tested or uploaded yet.
This weeks can finder code. Note: The “My Block” at the end just slowly ramps the speed up when pushing the can out by adding 0.01 to the speed every time the code goes around the loop.

As you can see, I’ve made a new variable and a new “My Block” which i’ll explain about now.

The new variable is called “turn_angle”. It stores the number of degrees to turn for every increment. The new “My Block” is called “speed_adder”. It increases the speed by 0.01 every time the is repeated in the loop. Inside the “My Block” uses an addition block which puts the speed up by 0.01.

I can’t show you the code inside it since I haven’t got a screenshot of it.

This is what happens when I run my new code. When the robot gets up to the silver strip, the robot finds the can. Next it turns in five degree increments till the robot cannot see the can. Next you have to do some maths. The maths is how many increments were turned till the robot didn’t see the can. Divide this number by 2. Multiply this number by how many degrees in an increment. In my code an increment was five degrees.

I left it at five degrees because it worked quite nicely. However, the robot appeared not to turn the opposite direction as much as expected. I’m going to look at it next week to find a way to make sure the robot lines as straight up as possible with the can.

That’s it for today’s post. But for now here is the word and phrase of the day.

Abet: To help, encourage, or support someone in a criminal act.

The true competitors are the ones who always play to win – Tom Brady

Week 6 – 2019 – James

Hi guys, today I revisited my can finder code for the Robocup Jr compition. I did this because my line follower definitely works but my can finder is pretty basic compared to the other team members code from last year.

Here is my code from before:

My Can Finder code from last year. Pretty basic really.

My new one is going to include a variable in it. The others from last year all used variables in their can finder. They did not add one thing though, comments. So I’m going to make the can finder better and adding comments along the way as well as rewriting my line following code with comments and adding the new ‘My Block’ with my new can finder code inside it.

To start things off, I looked at some examples from last year. I made 2 new variables called ‘increment_counter’ to know how many degrees the robot has turned and ‘max_distance_to_can’ to locate the can within the variables value. (Note: ‘max_distance_to_can’ may be changed. I’ve set it to 50 at the moment). When the can is located, the robot will stop and then turn 5 degrees till the robot cannot see the can. When it can’t see the can it will count how many 5 degree turns it has done and divide that number by two. When you get the answer the robot will turn that amount of degrees in the reverse direction and stop. At this point, the robot should be pointing at the can. Last, and finally, the robot will move forwards and push the can out of the green chemical spill.

I’ve only done a bit so here is the code for my improved can finder, so far. I really need to write some pseudocode so I will do that next week!

My new can finder code. Note: the last loop hasn’t been tested or uploaded yet.

That’s it for this weeks blog. I hope you’ve enjoyed learning stuff so far. Here is the word and phrase of the day.

Charlatan: A person falsely claiming to have a special knowledge or skill; a fraud

Be proud of who you are – Eminem

Bye…

Week 6 – 2019 – Sara

Hello…

This time at robotics me and Tamsin got challenged to make a 2 Sensor Line Follower. First we watched a YouTube video, which took quite awhile to find, but when we finally did find it we watched it. It explained a lot about 2 Sensor Line-Followers and truth tables. A truth table is basically writing that tells you what will happen when the robot does or detects something.

Here’s an example…

If right sensor and left sensor are on white then move forward. If right sensor is on black then turn right,if left sensor is on black then turn left. When both sensors are on white again move forward.

Tamsin and I wrote different codes but with the same goal (to make a 2 Sensor Line-Follower). On my first try the code actually worked, it followed straight lines the curves and the sharp curves. The only problem was that it was wiggling a lot. When I tried to fix that problem I just made it worse, after that the robot wouldn’t even follow straight lines (there were times when it would just go round round in circles). Near the end of the session I finally got the robot to follow straight lines again (the main problem was that I was only using the right sensor and I completely forgot to use the left one). The robot actually worked pretty well after that, it followed straight lines and even some curves not the sharp ones though.

This was the code I ended with…

Two sensor line follower

Here’s some explanation for the code. Using the right sensor the robot will look for reflected light (that is how much light reflects back, self explanatory right.) If the amount is greater than fifty, suggesting it’s white, it will move forward with a speed of 45. The next block tells the robot that is it’s less than 40, suggesting its black (but it could be any dark colour really), then it should turn right 75 degrees. Then the next to blocks are pretty much the same thing but for the left sensor, the only thing that changes is than if the left sensor sees black then it should turn left not right.

Usually a 2 Sensor Line-Following code works better and smother than 1 Sensor, but last week Rich showed us a 1 Sensor code that worked well and smoothly. We even thought it was using 2 Sensors.

Here’s my one Sensor code compared to my 2sensor unfinished code which is up there… ( just a few scrolls up actually)

1 Sensor Line-Follower

I think next time I will have to change the aggressiveness of the turn to make the other code work. But for now this is ok.

Bye…

Week 6 – 2019 – Tamsin

This week at coding first of all Sara and I had to watch a really long video as well as reading all of last years coders blogs about what we did this week.

So this week we tried to make the robot go in a straight line using both motors. To follow the black line around a corner you have to use a lot of blocks to do so. It is very hard.

At first I thought it was going to be easy but after I finished what looked like my code, when I tried to turn it on it just went round and round and round in circles .

In the end we did not get the robot to go in a straight. Line this week we had a lot of fun at robotics

Week 5 – 2019 – Tamsin

This week at coding we coded a line follower that wiggled when it moved to do this you have to get a loop block and inside the loop you put a true or false block in the true you put turn right if finds black ,in the false you put turn left if does not find black.

To do this it takes a bit of time. It took me and Sara a million times to get it right mostly we just changed the speed and the angle of turn

This week I was really busy, I wrote my blog and then it got deleted, I tried to redo it but I ran out of time.

Week 5 – 2019 – Sara

Hi…

This week we finally got the l sensor line follower to work. After getting used to how it was supposed to work it actually seemed quite easy.

This was the code I used last week…

1 sensor line follower

In my last blog I explained how my code worked,but if you haven’t seen it yet here’s a quick explanation. Using the right sensor the robot was supposed to find the right side of the black line,when that was found it was supposed to turn right, then when it detected white it would turn left,making the robot wiggle but follow the line at the same time. The main problem with this code was that the robot was using the right sensor and also trying to follow the right side of the line, and that made it really hard for the robot .

This was how I fixed the code to make it work…

1 sensor line follower
week 4

This is how this code works. The robot still looks for black, but with a difference this time it uses the left sensor. If it does find black then it should turn right 75 degrees with a speed of 75. When it finds white then it should turn left -75 degrees with a speed of 75. The reason I changed it from 50 to 75 was because last time it wasn’t doing any sharp curves, but by changing the angle to 75 it makes the robot do more aggressive turns. The change of speed from 55 to 75 is really only to speed up the process.

I think that the thing that made the biggest change to the two codes is the change from the left sensor to the right sensor.When it was using the right sensor the robot would keep going off the line and onto the white, that’s when it would get lost and go round and round in circles. But when it uses the left sensor the robot doesn’t go past half of the black line and that’s what keeps it going straight.

So, I guess that’s about it.

Bye…