Tutorial: Making Legobot Move Steering Brighton H.S Engineering By: Matthew Jourden

1. Build Bas Robot. See Build Manual in the Lego Core Set Kit for details or Build Instructions Base Robot File on Website

1. Two types of movement Linear Direction and Tank Method. Each has their advantages and disadvantages. We will experiment with both.

a. Move Steering Command will apply the same power, direction to both motors the same time b. Move Tank Command will allow the user to control each motor independently from each other. I.E Power can be different from the Right and the Left Motors.

2. Open Lego Mindstorm EV3 Labview (From Desktop or Menu)> Create a New Program a. File > New Project > Program b. Click on Plus Sign on the Tab Bar

3. Command Code Tabs Data Operations Tab Sensors Tab (Red) Code Blocks Flow Control Tab (Yellow) that allow Variable (Orange) Code Blocks that and Mathematical Code Blocks that has Action Tab (Green) controls Sensors Calculations to be Loops, If/Then Code Blocks that used with other Statements, etc. controls Motors, codes blocks( I.E Sound, EV3 Screen, Etc. Sensors )

My Blocks Tab (Teal)

Advanced Tab (Blue) Code Blocks that the user Code Blocks with advanced has created. User setup a functions (I.E File Data retrieval, series of code that equals Bluetooth connections, etc. only one block instead of multiple blocks Move Steering Movement

1. Click on the Action Tab (Green) at the bottom of the screen > Drag Move Steering Code Block (Looks like two motors w/ a steering wheel) on the work screen and connect to the Play button

Steering Movement Options Overview

Ports: Lists which Ports the Motors are wired too on the EV3 Brick

Motor Control Options

Controls how power will be

applied to the motors thus Movement Options

controlling how long the changes based on the On

motors will turn for the Rotations Selections

Off: Turns Motors off

On for Seconds: Turns Motors on for a series of time On: Turns Motors On until user turns them off

Steering and

Power: See On Option for Details Brake/Coast Power: controls Option Steering: controlled amount of power Time: Set values 100 to -100. supplied to motors. duration Controls Direction of Values 100 to -100 motors Movement. Positive #’s=Forward will Positive #’s = Right Turns

operate in U-Shape Direction Negative #’s= Reverse

Continued on Next Page Negative #’s= Left Turns in U –Shape Direction

Steering Continued

On for Rotations: Controls how many times the motors will cycle through before turning off.

On for Degrees: Controls how many degrees of rotation the motors will have.

Brake/Coast Brake/Coast Steering and Option Option Power: See On Option for Details Steering and Rotations:

Power: See On Number of times engine will run Option for Details Degrees of before turning Movement: Type off how many degrees motors will turn

2. Set the Motor Control to On for Seconds > Set the following below a. On for Seconds b. Steering = 0 c. 2 Seconds d. Brake at End = Brake

3. File > Save Program > TutorialSteering 4. Attach your Lego Base Robot to your computer using the USB-MicroUSB Wire > Wait till the computer recognize the EV3 Brick 5. Upload TutorialSteering Program to the EV3 Brick > Wait till the upload is complete > Detach the MicroUSB Wire from the EV3 Brick > Test the TutorialSteering Program

Making the Lego Robot Turn

6. Add a Wait Code Block from the Flow Tab (Orange) to the Right of the Steering Command > Set time to 2 Seconds (See Code Below). This will make the Lego Drive Base pause before carry out the next command. It is recommend to have any robot pause and sense their environment before immediately starting to move again. The Wait/Pause can vary depending the task being performed. NOTE: The Wait command can be controlled by a variety of sensors (I.E. The robot will pause until on the sensors conditions are either true or false)

7. Add another Action (Green Tab) > Move Steering Command to the Right of the Wait Command > Set the following a. On for Rotations b. Steering = 40 c. 3 Rotations d. Brake at End = Coast

NOTE: Can calculate the distance of Rotation by the following method:

1. Measure the circumference of the wheel 2. Run one rotation forward

8. Attach the EV3 brick to the computer using the USB to MicroUSB Wire > Upload Program to Brick > Detach wire after upload is complete > Run the Program

9. Add the following set of Code Blocks

10. Attach the EV3 brick to the computer using the USB to MicroUSB Wire > Upload Program to Brick > Detach wire after upload is complete > Run the Program

Adding a Start Button Flow Control > Drag the Wait Command at the beginning of the program line as follows > Change the setting to Brick Buttons > Compare > Set button to 2 (Middle button) > State 1 (Pressed).

Once the middle mouse button is pressed the program will run and begin moving the robot

Press State = Pressed Brick Setting > Compare > Brick Buttons Button > 2

Save Program Answer on your Lab Sheet

Question 1: Describe the difference in Brake at End (Brake vs Coast) Command. How did this affect the stopping of the vehicle?

Question 2: What is the distance that your Robot traveled in the first move command (straight)?

Question 3: What is the distance that your Robot traveled in the second move command (turning Right)?

Question 4: Describe what happened in the third movement command. Describe how the degrees effected the movement and what was the distance traveled?

Program 1: Line Follow

Write a Program that will follow the black taped line, keeping your robot centered on the line, provided by the teacher. Have your Robot stop at the end of the tape. Use any combination of Move Steering Commands Submit

1. Show Teacher Completed Program 2. A screenshot of program 3. Answer the following questions a. What of Movement (s) commands did you use to follow the line? b. How many movements did you need to incorporate in your program? c. How long did it take for your robot to complete the course? d. How did you figure out how to keep your robot closest to the line e. Did you robot stray off the course?

Program 2: Picture Draw

1. Design a holder to your robot that will hold a predefined marker 2. Draw a picture that uses a minimum of 8 lines/arcs. Be sure the image is school appropriate.