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…