Autonomy using Encoders

Slides:



Advertisements
Similar presentations
Full Speed Ahead Introductory Presentation. Opening Activity Choose one of the objects to the right and in ten or more steps explain how it goes from.
Advertisements

Navigating the BOE-BOT
Robot C Ready, SET, Go! Workshop SDSU, Fall 2013.
Autonomy using Encoders Intro to Robotics. Goal Our new task is to navigate a labyrinth. But this time we will NOT use motor commands in conjunction with.
Available at: – Program Optical Quad Encoders in Autonomous Mode Program optical quad encoders in autonomous mode.
ROBOTC for VEX Online Professional Development
ROBOTC for VEX On-Site Professional Development
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.
Programming Design ROBOTC Software Principles of Engineering
Variables and Functions. Open your Encoder program Let’s begin by opening the “Labyrinth Auto Straight” code. Save this file as Labyrinth with variables.
Autonomy using Encoders Intro to Robotics. Autonomy/Encoders Forward for Distance In this unit, you will learn to use the encoders to control the distance.
Negative Power or Negative Rotation makes robot go backwards. But if both are negative, the robot will go forward! Move Steering Block.
Find the Mindstorms Icon on the computer.. To start a new program click go.
Getting Started in RobotC // Comment task main() motor[] {} wait1Msec() ; = Header Code Compile Download Run Take out your notes.
BEGINNER EV3 PROGRAMMING LESSON By: Droids Robotics Using Sensor Data and Port View.
Vex Robotics Program four: reversing and turning.
Programming - Motion Intro to Robotics. Motors and Sensors Setup The first thing we need to do is tell ROBOTC that we have motors on our robot. Choose.
BEGINNER FLL PROGRAMMING WORKSHOP BY DROIDS ROBOTICS & EV3LESSONS.
Deriving Consistency from LEGOs What we have learned in 6 years of FLL by Austin and Travis Schuh © 2005 Austin and Travis Schuh, all rights reserved.
ROBOTC for VEX Online Professional Development. Homework Questions Thoughts? Questions?
Bot Shop Jane Taylor Dee Wallace Robot C For Vex.
Programming Design ROBOTC Software. Behavior-Based Programming A behavior is anything your robot does –Turning on a single motor or servo Three main types.
With. Project Overview  Introduction to Factory Automation Numerical Control  Build an autonomous robotic solution  Testing an autonomous robot build.
Programming Design ROBOTC Software Principles Of Engineering
VEX Cortex Video Trainer using ROBOTC
BEGINNER EV3 PROGRAMMING Lesson
Deriving Consistency from LEGOs
VEX IQ Mix & Match Curriculum
ROBOTC for VEX Online Professional Development
ROBOTC for VEX Online Professional Development
Robotics Programming Using Shaft Encoders
By Sanjay and Arvind Seshan
Programming – Using a Range Finder
ROBOTC for VEX Online Professional Development
StartStruck in a Virtual World
Programming Design ROBOTC Software Computer Integrated Manufacturing
Introductory Presentation
Programming - Motion Intro to Robotics.
Movement using Shaft Encoders
Using Encoders to go Straight
Programming – Touch Sensors
BEGINNER PROGRAMMING LESSON
Introductory Presentation
By Sanjay and Arvind Seshan
Getting Started in RobotC
Programming – Using a Range Finder
Automation and Robotics
Beginner Programming Lesson
BEGINNER PROGRAMMING Lesson
An Introduction to VEX IQ Programming with Modkit
Getting Started in RobotC
Beginner Programming Lesson
LESSON 03 Turning In Place. LESSON 03 Turning In Place.
Auto Straightening using VEX Shaft Encoders
Beginner Programming Lesson
BEGINNER PROGRAMMING LESSON
BEGINNER PROGRAMMING Lesson
Programming Design ROBOTC Software Principles Of Engineering
The Basics Subtitle.
Programming - Buttons Intro to Robotics.
Automation with RobotC
Robotics Programming Using Shaft Encoders
Programming - Buttons Intro to Robotics.
Robotics Programming Using Shaft Encoders
Remote Control For this activity we will use the Squarebot
Automation with RobotC
Robotics Programming Using Shaft Encoders
Programming Design ROBOTC Software Principles of Engineering
Getting started with LEGO EV3 Mindstorms software
Is there an alternative to copy-paste for repeating code?
Presentation transcript:

Autonomy using Encoders Intro to Robotics

Goal Our new task is to navigate a labyrinth. But this time we will NOT use motor commands in conjunction with timers. We use our new sensor, the ENCODER.

Autonomy/Encoders Forward for Distance In this unit, you will learn to use the encoders to control the distance the robot moves, and to self-correct its steering to counteract the random drift that occurs during movement. This will eventually serve two purposes.

Autonomy/Encoders Forward for Distance First, it will provide you with a new form of Operator Assist that uses the sensors on the robot to drive straighter than a human operator might be capable of doing. Second, it will begin building a base of behaviors that the robot can use on its own during the Autonomous Period that is part of the revised challenge. For 20 seconds at the start of the match, your robot will have a chance to run and score points completely on its own.

The Encoder The Encoder is a sensor that measures rotation. On the Squarebot 3.0, encoders are attached to the wheels of the robot. The encoders measure how far the wheels have turned, and therefore, how far the robot has moved. The distance the robot covers moving forward is equal to the length of the tire tread that spins by.

The Encoder We will be able to make reasonably accurate predictions about exactly how far the robot will move after every full turn of the wheels. The encoder measures in 4-degree increments, and so will register 90 counts for a full 360-degree rotation. For this lesson, the important part is simply that the number of encoder counts is directly linked to the amount that the wheels turn, and therefore, to the distance that the robot travels. Being able to directly measure the turning of the wheels allows us to dictate the motion of the robot in terms of distances rather than simply defining a period of time that the robot should move. This is a much more reliable method, because it is unaffected by factors like speed or battery power. Using the encoder-based distance to determine movement, therefore, will result in much better consistency of movement. This is exactly what your robot needs to do its job well, with or without human supervision!

Create a NEW program/Save Save the code as Encoder Test

Motors & Sensors Setup

Motors & Sensors Setup

Modifying our Code

Modifying our Labyrinth Code Checkpoint Your robot should begin executing the first behavior two seconds after it is turned on. The robot will start moving — and keep moving! If you pick it up and let it run for a while, you will notice that it eventually stops, but nowhere near the right distance. The guess we used for the number of encoder counts was off. 500 is far too many counts for the distance that the robot needs to move.

Encoder count off?

Test the Encoder count

Making turns with the Encoder

Rule of thumb

Finish the program

Test & make changes to encoder counts

Motor power changes?

Motor Power Changes

What happened?

Encoder usefulness

Automated Straightening Earlier in the course, we tweaked the power motor values to get the robot to go straight even though the task was tedious.

Automated Straightening

Automated Straightening Take your current open program and save it.

Automated Straightening

Using the “RIGHT” Encoder

Using /* comments */ to test program Note: Make sure the last */ - comment tag is BEFORE your last “task main” punctuation pair. “Commenting out your code” is a great way to go back and test out individual parts of the code as you work on changes.

Test!

Finish the changes! Now change the REST of the code for the OTHER behaviors which require the robot to go straight. Be sure to RESET the encoder values to zero before each while loop.

Test the Labyrinth

Making changes takes too much time

Behaviors and FUNCTIONS Really, it seems like this whole ordeal is unnecessary. The command for setting the motor power inside all four of these behaviors is exactly the same. Why do we have to make the change four different times in four different places when they’re all exactly the same behavior? Recognizing that all four of these chunks of code represent the same behavior is key. In this lesson, you will learn how a control structure called a function can help by letting you define the moving-straight behavior as a custom command in the language of ROBOTC!

Behaviors and FUNCTIONS

Behaviors and FUNCTIONS This is called the CALL.

Behaviors and FUNCTIONS

Behaviors and FUNCTIONS

Behaviors and FUNCTIONS

Behaviors and FUNCTIONS

Behaviors and FUNCTIONS

Behaviors and FUNCTIONS

Behaviors and FUNCTIONS

Behaviors and FUNCTIONS If you compare the 2 sets of code you should now realize that by using functions you can greatly reduce the # of lines of code you need. 66 lines of codes vs. 103 lines of code!

Let’s test your understanding Create new FUNCTIONS for your right and left turns. Compile and test the program to see if it makes it into the labyrinth. If successful, use COMMENTS to EXPLAIN each line of code in YOUR own words. Copy and paste the code in word for proper formatting and spell check. Be sure to place your NAME in the comments and turn the code in to the basket for grading.