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.

Week 8 – Josh

Today we were given a challenge with the ultrasonic sensor that would prepare us for the rescue challenge.  The ultrasonic sensor would be used when we are attempting to push the can out of the zone.

Pseudocode written for challenge:

  1. The robot will stop on the aluminium foil.
  2. Turn ultrasonic sensor on and detect objects within 50cm
  3. Turn left for 360° continuously.
  4. If no object found move forward 5cm
  5. Repeat steps 3 and 4 until object found.
  6. If object is found stop.
  7. Continue moving left until sensor loses object then stop again.
  8. Determine the distance between the 2 stops then divide the rotations by 2.
  9. Turn right that amount of rotations.
  10. Move forward for 10 seconds.

This challenge was extremely difficult and challenging.  We had lots of hiccups and problems.

Fig 1. problem with the sensors massive FOV

The first and main problem that we had was the ultrasonic sensors FOV (Field Of View).  So that when the can was further away the sensor was picking it up a way before it was aligned straight with the robot.  So that that when the robot moved straight it missed the can.  This diagram shows what the problem would look like. Fig 1.

Fig 2. My end code is where it uses variables and maths to find the dead centre.

We eventually came up with the idea that if we used a variable we could calculate how far the distance is from when it picks it up (1) ,to when it loses it (2), then it goes back halfway (3).

 

 

Sometimes it doesn’t pick it up a circular object very well because the sound bounces off but more often than not it still works really well.

Other problems we encountered included the robot not going quite straight but if you started slower it didn’t jolt as much.  With other little fixes of bugs along the way I finally had a working product.  The code follows my pseudocode and after weeks of work it works like a charm.

Here is a video of my code detecting and pushing the can out.

Our Mindstorm adventures continue…

 

Week 6 – Josh

Today at coding class we cracked into our overall goal, making a line follower.  First we had to learn about switch blocks which is really the program asking the robot a question about its surroundings and answering yes or no.  E.g is the colour sensor on a black line; yes turn right, no turn left.

We then got stuck into our first challenge.  The pseudocode challenge guidelines are as follows.

Step 1: Write a program that follows the RIGHT edge of a line.
Hints: If your sensor sees black, turn right.  If your sensor sees white, turn left.  Use loops and switches!
Step 2: Try it out on different lines.  Did your line follower work the same on straight and curved lines?
Step 3: If not, instead of turn Steering = 50, try smaller values.
Is it better on the curved lines now?
After some trial and error I got the robot to follow the line but when it got to a sharp turn it lost the line.  After adjusting the speed and steering I got it to work.  (I slowed down the speed and increased the steering).  This was a very interesting task as everyone used something different to steer to start with.  I used ‘On’, but the others used rotations, time and degrees.  We ended up all finishing on ‘On’.  The picture of the code is to the left .  We then checked the solution and it was very similar, the only real difference was the speed and steering.
The second challenge was pretty much an add on to the last task as we just had to make it stop when the touch sensor is pressed while the same line following code applies.  As you can see we changed the repeat forever to until touch sensor is pressed.  This was a very good lesson and is setting us up for our final goal.
Our Mindstorm Adventures Continue.

Week 3 – Josh

This week we discussed what pseudocode is and what it can do for us as programmers.  Pseudocode is what coders use to plan or explain an idea without actually coding it.  An example is if I wanted to make my robot go forward and then flash its lights blue and red.  This could help a fellow coder understand what I am trying to achieve while I have a clear plan in front of me.  We then look at the Peanut Butter and Jelly example and discussed what we could do to refine it and make it better.

Goal: Robot needs to go once around a square box. It starts at the line and faces north.  It will end on the line facing north.
Step 1: Go forward 10 inches
Step 2: Turn left 90 degrees
Step 3: Repeat steps 1 and 2 three more time.
We then attempted to code the EV3 to do this task.  It was actually an extremely difficult task.  As we had to figure out through guess and check how many rotations the wheel had to do, to do 90 degrees.  But now we have this information we can keep reusing it.  This will be very important information.
Our Mindstorm Adventures continue.

Week 2 – Josh

Today we focused on the software/programming side of things.  We first observed the code that Richard had done that used the EV3 colour sensor.  It was slow but smooth.

Next we used the EV3 lessons and did the move straight challenge.  We did some guess and checking and got it right with time.  With rotations it was a bit more difficult.  So we measured the degrees using the motors.  We then divided the degrees (1273) by 360 because there are 360 degrees in a circle.

We used the colour sensor to make it stop when it detected green.  This was interesting as we tried it on our mat that is a light shade of green.  That didn’t work.  We then tried it again and it worked.  Once!!! But we couldn’t get it to do that again.  I was leaning over at the time so maybe it was some sort of shadow.  We then tried it on a green LEGO Brick that worked every time.

Next week we will explore the colour sensor even more.

Our Mindstorm adventure continues.

Week 1 – Josh

This week was partly about observing the Mindstorm and getting the software up and running.

We got the domain name off an American website.  We all wrote down some ideas for our domain name.  We decided on mangorei.roboteam.space.  A nice name for our group.  We searched up on the American website our idea and we could get it.  Richard brought it and as the admin gave us all accounts.

We are using WordPress to run our blog/website.

Today we downloaded the mindstorms EV3 software for the educational version.  We then looked at the code Richard wrote for the reflection line follower.  We observed the way the Mindstorm went around the maze.

We made some adjustments to get the sensor to the middle of the robot to make an equilateral triangle between the two wheels and the sensor.

Next week we will look at the coding side of things.

What a great start to our Mindstorm adventures.