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.