ROBOTC Software EV3 Robot Workshop Lawrence Technological University.

Slides:



Advertisements
Similar presentations
Robofest 2005 Introduction to Programming RIS 2.0 RCX Code.
Advertisements

Introduction to LEGO RCX robotics and Robot Sumo
RCX Workshop Day 2 Programming with Touch Sensor Light Sensor Repeat CJ Chung Associate Professor of Computer Science Lawrence Technological University.
Each team has their own: a.Laptop computer b.LEGO NXT robot c.USB cable d.Light paper on the table to test the robot Sit Down in Teams of 2.
Getting started with LEGO NXT Mindstorms software This is intended to be a short introduction to the LEGO Mindstorms software and programming the LEGO.
Jason Howard. Agenda I. How to download robotc II. What is tele-op used for? III. How to build a basic tele-op program IV. Getting the robot to drive.
EV3 Workshop Curriculum Developed by Joe DeRose, Ph.D.
Graphical RobotC NXT (EV3) Robot Workshop 2015 Instructor: Dr. Fred Brauchler Assistant: Chris Parker 2/7/2015Lawrence Technological University1.
Automation and Robotics
VEX Robotics Platform and ROBOTC Software Introduction.
Navigating the BOE-BOT
Available at: – Program Optical Quad Encoders in Autonomous Mode Program optical quad encoders in autonomous mode.
Diameter, Circumference, and Rotational Sensors Robotics Academy All Rights Reserved.
EV3 Software EV3 Robot Workshop 2015
EIGHTH GRADE ROBOTICS KITTATINNY REGIONAL HIGH SCHOOL MR. SHEA Introduction to Robotics Day4.
LEGO Mindstorms NXT Programming We will be using the Common Palette for our Robots This is how you download your program onto the brick Drag and drop a.
Testbed: Exercises.
ROBOTC for VEX Online Professional Development
VEX Robotics Platform and ROBOTC Software
GIRLS Robotic Camp. Let’s Begin Meet and Greet – Camp leaders introduce themselves – Students introduce themselves.
ORTOP WORKSHOP 3 ROBOT NAVIGATION & MISSIONS ORTOP WORKSHOP 3 ROBOT NAVIGATION & MISSIONS.
The George Washington University Electrical & Computer Engineering Department ECE 002 Dr. S. Ahmadi Class 2.
Coding for the FIRST Tech Challenge: RobotC
Introduction to the VEX ® Robotics Platform and ROBOTC Software © 2012 Project Lead The Way, Inc.Principles of Engineering.
Application of Math and Science Principles Creating a robot that moves a specified distance straight ahead and Creating a robot that turns a specified.
Measured Turns Introductory Presentation. Opening Activity In the Right Face Activity, we made our robot turn right using the program below.
Minds and Computers 3.1 Preview Spin left motor Spin right motor Wait until the motors have spun two rotations Stop left motor Stop right motor What five.
EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright
Motors and Sound Troubleshooting Tips. © H-CCS Problem 1 Why can’t I download my program to the RCX?
A note on oral presentations These are the progress report presentations. Please note that the individual presentations should be ~8 min long. Since the.
Negative Power or Negative Rotation makes robot go backwards. But if both are negative, the robot will go forward! Move Steering Block.
Castor Bot. Now, we will begin creating a robot Log onto your computer On your screen, click on the website labeled “castor bot” Your building instructions.
Robotics NXT-G: variables, file Rotation sensor Lab: Use buttons to hit specific ball. Homework: Postings. Start planning mapping the room.
BEGINNER EV3 PROGRAMMING LESSON By: Droids Robotics Using Sensor Data and Port View.
The George Washington University Electrical & Computer Engineering Department ECE 002 Dr. S. Ahmadi Class3/Lab 2.
By Droids Robotics INTERMEDIATE PROGRAMMING LESSON BRICK BUTTONS AS SENSORS.
EV3 Software EV3 Robot Workshop
ROBOTC Software EV3 Robot Workshop
BEGINNER FLL PROGRAMMING WORKSHOP BY DROIDS ROBOTICS & EV3LESSONS.
Automation and Robotics.  First you select the platform type so that you can use Natural Language PLTW.
ROBOTC for VEX Robotics (VEX IQ) On-Line Session 2014 My name is Jason McKenna I will be leading you through these sessions Teacher for 17 years Hopewell.
MEH108 - Intro. To Engineering Applications KOU Electronics and Communications Engineering.
ROBOTICS Jason Bell Brad Carlson
ROBOTC for VEX Online Professional Development. Homework Questions Thoughts? Questions?
Project Overview  Introduction  Clawbot Build  Design Modification  Design Development  Programming  Sensors  Advanced Sensors  Open design challenges.
ROBOTC for CORTEX Teacher Training © 2011 Project Lead The Way, Inc. Automation and Robotics VEX.
How Do You Make a Program Wait?
Introduction to Programming in RobotC
BEGINNER PROGRAMMING LESSON
BEGINNER EV3 PROGRAMMING Lesson
Mindstorms EV3 Programming
ROBOTC for VEX Online Professional Development
ROBOTC for VEX On-Site Professional Development
Mindstorms EV3 Programming
Beginner programming Lesson
Sensors Training.
Automation and Robotics
Robot Programming Computer Literacy S2.
An Introduction to VEX IQ Programming with Modkit
Getting Started in RobotC
Beginner Programming Lesson
Storing Values as Variables
EV3 Programming guide to “Following”
INTERMEDIATE PROGRAMMING LESSON
Introduction to programming consistent results
Robotics Week 3 beginning wheel control
Robotics Week 4 Functions and reusable code
Compiled from various Internet sources Presented by Mr. Hatfield
Compiled from various Internet sources Presented by Mr. Hatfield
Getting started with LEGO EV3 Mindstorms software
Presentation transcript:

ROBOTC Software EV3 Robot Workshop Lawrence Technological University

2015 Robofest competition RoboGolf SPbot introduction Using the SPbot to solve the RoboGolf challenge Course Overview 2

Video overview – My Youtube Channel My Youtube Channel – This channel is not complete, but will have videos about using RobotC. Key tasks – Find the edge of the table – Follow the edge of the table – Find a putting green – Find the golf ball – Aim for the hole – Mathematics to locate the center hole – Rotate the robot to putt – Putt the golf ball 2016 Robofest competition 3

Please note that putting the golf balls is beyond the scope of this workshop 2016 Robofest competition 4

LEGO EV3 robot used – SPbot Color Sensor 1 EV3 Computer Left Motor: B Right Motor: C Touch Sensor Sonar Sensor Color Sensor 2

Left Motor connects to B Right Motor connects to C – If your motors are upside down forward will be backwards in your program Color sensor 1 connects to port no. 1 Color sensor 2 connects to port no. 2 Touch sensor connects to port no. 3 Sonar sensor connects to port no. 4 Remember the connections! 6 Please note that the retail version of EV3 uses an infrared sensor, not a sonar sensor.

ROBOTC Version 4.52 Build Date Dec 7, 2015 PowerPoint and all example programs are available at robofest.net under Tech Resources ROBOTC Versions Used 7

Opening the source codes files for the workshop will assist in setting up the ROBOTC environment Once the source files are loaded the EV3 motors and sensors should be assigned Setting Up The ROBOTC Environment

The first step in using ROBOTC is connecting to your EV3 robot – Robot -> LEGO Brick -> Communication Link Setup – Select your EV3 – Hit the Close button Setting Up The ROBOTC Environment

The first time you use an EV3 robot with ROBOTC, you need to download the ROBOTC kernel – Robot -> Download EV3 Linux Kernel -> Standard Kernel Setting Up The ROBOTC Environment

Brick Overview

Setting Up The ROBOTC Environment 12 Under Robot Menu Compiler Target Physical Robot Platform Type LEGO Mindstroms EV3 Uncheck Natural Language Motors and Sensor Setup Reviewed on the next slide Firmware Download

Select Custom Configuration Motors and Sensors Setup 13

Set left and right motors Motors and Sensors Setup 14 **Check these boxes if your motors are upside down or if your robot moves the wrong direction.**

Set up sensors Motors and Sensors Setup 15

Once the motors and sensors at set up, ROBOTC will generate code to configure them We will use this code in all programs we write in this course Code generation 16

17 Task 0 Find the edge of the table

Task 0: Example Solution 18 Program: findTableEdge.c Set up a Threshold of 20 Turn on motors forward. Wait until the edge of the table is detected. Stop the robot.

YouTube:

One method of monitor the sensor values is to use the ROBOTC debugger window – Download program to your robot This opens the Debugger and Debugger windows Reading sensors values

ROBOTC offers many debugging options Debugger Windows

We can write a program to display the sensor values on the EV3 LCD screen as well Reading sensors values 22 Program: sensorValues.c

23 Task 1 Follow the edge of the table

Use the zig-zag method to follow the edge of the table Edge following is also referred to as line following We need to determine when the robot is on or off the table Follow The Edge Of The Table 24 Right Edge Left Edge Table

Get color sensor values to determine when the robot is on or off the table and putting green. We will use the color sensor in Reflective Light Intensity mode. We can use the sensorValues.c program to assist or use the Sensor debugging window. Color Sensor 1Color Sensor 2 – Off table = ______ (10)On green = ______ (20) – On table = ______ (60)On table = ______ (60) Follow The Edge Of The Table 25 Color Sensor Readings

Light sensor settings example – Off table = 10 – On table = 60 – Median threshold = (10+60)/2 = 35 Two cases – Light sensor reading > 35. On table. – Light sensor reading < 35. Off table. Follow The Edge Of The Table 26

Simple Line Following Algorithm 27 Program: LineFollowZZ.c Set the threshold value. Loop forever – the robot will not stop. Based on color senor reading, determine which direction to travel to line follow.

YouTube:

Zig-zag method can cause a bumpy response To improve the response, you can use a 3-level line follower (concept shown below) How to improve our line following algorithm 29 Off Table On Table

30 Task 2 Find a putting green

One method of finding a putting green requires two color sensors – Sensor 1 used to follow the edge of the table – Sensor 2 used to locate the putting green General idea – Follow the edge of the table until the second color sensor detects a putting green Find A Putting Green 31

Let’s modify the previous program to stop when the robot reaches the putting green Find A Putting Green 32 Currently the program will line follow until we stop the robot. Let’s change the outer loop to stop when the green is reached.

Find A Putting Green 33 Program: LineFollowZZStop.c Here we modify the while loop conditional statement to use the second color sensor to detect when the putting green is reached. Once putting green is reached, we exit while loop and stop the robot.

YouTube:

35 Task 3 Find the golf ball

General idea – Let’s assume we located the putting green and we know where the golf ball is on the green relative to the edge of the green – How can we begin to position our robot to putt? Find The Golf Ball 36

Example Find The Golf Ball 37 Robot m Follow the edge of the putting green a distance “m” This will position the robot in line with the golf ball m = 11 cm for the Junior Division. What about the Senior Division?

How to find “m” given n/m – From the diagram of the putting green we have – Let’s assume that n/m = X (X is known) – Now we can solve for m Find The Golf Ball 38

One solution – Follow the edge of the putting green until we reach the position of the ball Approach – Let’s modify LineFollowZZStop.c to stop at the location of the ball Tools needed – Line following – Measure distance traveled Find The Golf Ball 39

Determine how far the robot travels moving forward for 2 seconds Measure Distances 40 Distance Compute distance traveled by measuring the number of rotations of the wheel

Use the wheel geometry Measure Distances 41 PI = 3.14 Circumference = Dia × PI Radius Diameter = 2 × Radius How can use this information?

For each rotation of the wheel, the robot will travel (Wheel Diameter) x (PI) Distance = (Wheel Diameter) x (PI) x (# Rotations) Distance = (5.5 cm) x (PI) x (# Rotations) Distance = (17.28 cm) x (# Rotations) Measure Distances 42

Measure Distances 43 Program: measureDistance.c Here we reset the a motor encoder. The encoder outputs the rotation of the motor in degrees so we convert the output to rotations. Code added to wait until the touch sensor is pressed to keep the information visible on the robot screen.

Proposed method: – Compute the distance to travel along the edge of the putting green – Compute the number of rotations required to travel that distance – Find the edge of the putting green – Reset motor rotation sensor – Follow the edge of the putting green – Stop the robot when the desired number of rotations is reached Aligning The Robot With The Golf Ball 44

Example – Putting green dimensions m = 11 cm, n = 11 cm – Number of rotations Distance = (Wheel Diameter) x (PI) x (# Rotations) Solve for (# Rotations) Aligning The Robot With The Golf Ball 45 (# Rotations) = (Wheel Diameter) x (PI) Distance (# Rotations) = (5.5 cm) x (PI) 11 cm = 0.64 rotations

Aligning The Robot With The Golf Ball 46 Here we define some variables. Loop until the desired distance is traveled. Compute the distance traveled. Program: lineFollowDistance.c

47 Task 4 Aim for the hole

We will review a few methods to aim for the hole Method 1: Search for the flag pole – Scan using the sonar senor Method 2: Compute the location of the hole – Mathematically determine the location of the hole Step 1 – Determine the angle we must rotate to aim the robot towards the golf hole Step 2 – Rotate the robot the determined amount Method 3: Determine the location using trial and error – Here we find the hole by rotating the robot different amounts in an attempt to find the correct orientation Aim for the hole 48

Here we are going to have the robot spin until it “sees” the center hole flag with the sonar sensor Method 1: Scan For Hole 49 Program: spinSearch.c This empty loop with allow the robot to spin until an object is detected by the ultrasonic sensor.

Using this approach we can calculate how far to rotate the robot to face the center hole We complete this in two steps – Step 1 Determine the angle we must rotate to aim the robot towards the golf hole – Step 2 Rotate the robot the determined amount Method 2: Mathematical Approach 50

We can use geometry to determine the location of the hole Determine The Rotation Angle 51 r s t Robot

We can use trigonometry to determine the location of the hole and aim the robot Determine The Rotation Angle 52 r s t θ Robot

Use an advanced math block to compute the necessary rotation angle – Assume the following r = 40 cm s = 30 cm Determine The Rotation Angle 53 Program: trigMath.c ° 36.87°

We need to rotate the robot θ degrees to aim the robot at the golf hole Rotate The Robot To Putt 54 Robot Starting PositionRotated Position 90° - θ

We will use the spin feature to turn the robot θ degrees When the robot spins, the wheel path is a circle centered between the wheels The diameter is the track width of the robot Rotate The Robot To Putt 55 Robot

For an example, let’s spin the robot 90 deg – Robot track width = 16.2 cm – The circumference of the robot’s path C = PI * D = 3.14 * 16.2 cm = cm – The circumference of the robot’s wheel C = PI * D = 3.14 * 5.5 cm = cm 90 degrees is ¼ of the circle. The robot travels – D = ¼ x cm = cm How rotations to travel cm? – # Rot = Distance / (Wheel Circumference) – # Rot = cm / cm = 0.74 Rotate The Robot To Putt 56

Spinning robot example – Robot width = 16.2 cm – Wheel Diameter = 5.5 cm Circumference = 17.27cm Number of rotations Rotate The Robot To Putt 57

We can use one block to spin the robot Rotate The Robot To Putt 58 Program: spin90.c Set motor targets to the degrees they need to turn, or #Rotations * 360 Speed of 20 for leftMotor and a speed of -20 for rightMotor so they spin in opposite directions.

YouTube:

Whew that’s A LOT of math!!!

61 Task 5 Putt the golf ball

Again, this task is beyond the scope of this course However, your robot should be in position to putt the ball in the center hole Remember, you can only hit the golf ball once and only with the wooden block putter Putt The Golf Ball 62

Solving the Robofest Game challenge will typically require a fairly large EV3 program Very large programs can be difficult to understand, navigate and use To alleviate this issue, ROBOTC allows the use of functions group and reuse sections of your program Functions

For example, let’s assume you have a section code that completes the following: – Move forward until the edge of the table is found with color sensor 1, then stop – After stopping, rotate the robot 90 degrees Here is an example… Functions

Let’s create a function called findEdgeAndTurn Functions Now can call the function from our main task program Program: findEdgeAndTurn.c

In this course we learned how to – Find the edge of the table – Follow the edge of the table – Find a putting green – Find the golf ball – Aim for the hole – Putt the golf ball Putting It All Together 66

Little Robots, Big Missions 67 Questions? me at