Tutorial: Making Legobot Move Steering Command 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, time direction to both motors at 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 Software (From Desktop or Start Menu)> Create a New Program a. File > New Project > Program b. Click on Plus Sign on the Tab Bar Action Tab (Green) Code Blocks that controls Motors, Sound, EV3 Screen, Etc. 3. Command Code Tabs Flow Control Tab (Orange) Code Blocks that has Loops, If/Then Statements, etc. Sensors Tab (Yellow) Code Blocks that controls Sensors Data Operations Tab (Red) Code Blocks that allow Variable and Mathematical Calculations to be used with other codes blocks( I.E Sensors ) Advanced Tab (Blue) Code Blocks with advanced functions (I.E File Data retrieval, Bluetooth connections, etc. My Blocks Tab (Teal) Code Blocks that the user has created. User setup a series of code that equals 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 controlling how long the motors will turn for Movement Options changes based on the On 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 Time: Set duration motors will operate Brake/Coast Option Steering: controlled values 100 to -100. Controls Direction of Movement. Positive # s = Right Turns in U-Shape Direction Power: controls amount of power supplied to motors. Values 100 to -100 Positive # s=forward 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. Steering and Power: See On Option for Details Degrees of Movement: Type how many degrees motors will turn Brake/Coast Option Steering and Power: See On Option for Details Brake/Coast Option Rotations: Number of times engine will run before turning off 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 Choice > 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 type 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.