Lifting and moving

LEGO Robotics - Lesson 4

Objectives

  • Write algorithms to control the movement of a robot
  • Write algorithms to control motors that operate moving and lifting attachments on a robot
  • Debug algorithms to solve problems

Lesson Resources


Lesson 1 - Measure and move

Lesson 2 - Time to turn

Lesson 3 - Get in shape

Lesson 4 - Lifting and moving

Lesson 5 - Sensors

Lesson 6 - Sensors and Robot challenges

Introduction

Recap some of the challenges from the last few lessons. Ask the class, what have we learned about controlling our robot accurately? 

Remind them how to calculate the rotations needed to travel a specific distance.

In this lesson we will be combining controlling the two large motors (which control the wheels) with controlling the robot's medium motor. The medium motor can be used for a range of different attachments for your robot, but we'll be using it as a device to lift and move objects.

 

Using the medium motor 

Your EV3 robot comes with a third, medium motor. This motor is faster, but less powerful than the main larger motors.

 

 

It can be used in different ways, but in the build instructions it forms part of a grabber device that can be attached to the front of your robot:

 

This can be used nicely with the coloured box you can also build with your EV3 set:

 

 

How the attachment works

The medium motor controls the bar lifter attachment with 2 gears that interlock at a right-angle.

As the medium motor turns, it turns Gear A. Gear A connects to, and turns Gear B.

Gear B is linked to an axle that runs through the lifter attachment. As the axle turns it lifts the front of the attachment.

 

 

Adding an extra hook piece to the bar grabber also turns it into a lifting device. 

 

 

Use the multicoloured box that comes with the EV3 kit. Stand it on its end with the large hole facing the robot to give the biggest target for the hook.

 

 

With a bit of practice you will be able to get your robot to pick up, move and put down the box.

 

 

Controlling the medium motor

This block controls the medium motor, which will control your robot’s ‘arm’. 

 

The up/down motion of the attachment is controlled by adjusting the speed setting. Positive power LIFTS the arm Negative power DROPS the arm. Keep the power low for good control of the robot arm. 

Using seconds for the duration instead of rotations is highly recommended as it removes an issue where code will get stuck and not complete if the motor is told to rotate more than it is physically able to. Anything after that in the sequence won't run.

A very short movement (0.5 seconds) is enough to lift or lower the arm as the medium motor only needs to rotate a small amount to turn the gears which make the attachment work. 

Demonstrate both an up and down movement to the class using positive and then negative power.

The medium motor block can be combined with the large motor blocks to create algorithms which make the robot move and control the arm.

 

 

Medium motor missions

To begin with, ask each group to simply try to get their robot's arm to rise and fall. They should then work through the following missions at their own pace. Our worksheet is available so you can give each group a guide to all the missions.

 

Mission 1

Then give each group a large sheet of paper, flip chart size sheets are perfect. They will also need some felt tips. Ask them to draw a start line for their robot to begin from, and at the other end of the paper, a target.

The box can begin on your robot's hook/arm. Then it should drive forwards, drop the box as close to the centre of the target as possible.

Ask the class, how can we be be precise with our movements and avoid trial and error?  We don't want to revert to guessing how many wheel rotations the robot needs to perform to get to the target. We can measure the distance and calculate the rotations. However, this needs a little more thought of how we do it. Ask the class, if we measure from the robots wheels (as we did previously) then where should we measure to? We should not measure to the centre of the target. Why won't this work? It won't work as we don't want the wheels to end up on the target. Instead, we need to extend the robot arm so the box (while still on the arm) is on the centre of the target. Then measure to the position the wheels are in.

 

 

Mission 2

In the second mission the box starts on the centre of the target. The robot must drive and pick up the box and then return the box to the start line. This time measuring from the tip of the arm/hook to the centre of the box works well this time.

 

 

Mission 3

They may need to use the back of the paper at this point (or just different coloured pen markings).

In mission 3 the robot must drive to collect the box, turn a corner, drive again and place the box down on the target to right.

 

 

Mission 4

Mission 4 extends mission 3's challenge by adding a wall (just draw it) and the need for a second turn.

 

 

Mission 5

Mission 5 adds a second wall to place the target even more out of reach. This one will require three turns from the robot.

 

 

Here's an example of a robot in action:

 

 

Plenary

Finish the lesson by asking some groups to demonstrate missions that they have had success with. Ask the class:

  • did it get easier or harder as you went through the missions?
  • were you able to re-use code in different missions?
  • what did you learn as you progressed? 

In the next lesson we will be investigating the robot's sensors.

 

 

< Previous Lesson

Next Lesson >