Sensors Brad Miller Associate Director, WPI Robotics Resource Center.

Slides:



Advertisements
Similar presentations
Add and Use a Sensor & Autonomous For FIRST Robotics
Advertisements

Encoders, Motors, Power, Mini Project #1 10/24/2014.
In this presentation you will:
Sensors For Robotics Robotics Academy All Rights Reserved.
Rotary Encoder. Wikipedia- Definition  A rotary encoder, also called a shaft encoder, is an electro- mechanical device that converts the angular position.
VEX and Robot C Chris Patterson Presented by Modified by J. Andazola.
Navigating the BOE-BOT
EML 2023 – Motor Control Lecture 4 – DAQ and Motor Controller.
Using the NXT Light Sensor. 2 Connect One Light Sensor – 1 From My Files use Left / Right NXT buttons and get to View menu and push Orange button. From.
Sensors For Robotics Robotics Academy All Rights Reserved.
1 Sensors, Actuators, Signals, and Computers Part D Ping Hsu, Winncy Du, Ken Youssefi.
FRC LabVIEW Software Overview Joe Hershberger Staff Software Engineer National Instruments.
IR SENSORS AND ENCODERS. LCDs Timothy Friez Class # 2.
EIGHTH GRADE ROBOTICS KITTATINNY REGIONAL HIGH SCHOOL MR. SHEA Introduction to Robotics Day4.
Micromouse Meeting #3 Lecture #2 Power Motors Encoders.
1 ©2006 INSciTE Lab Two Task: Make the program from Lab One (Move forward 5 rotations and turn right 90 degrees) into a MyBlock.
1 Sensors BADI Year 3 John Errington MSc. 2 Sensors Allow a design to respond to its environment – e.g. a line following robot may use photosensors to.
Basics of Sensors. A sensor is a device which is used to sense the surroundings of it & gives some useful information about it. This information is used.
EML 2023 – Motor Control Lecture 3 – Feedback Sensor Optical Encoder.
VEX Robotics Platform and ROBOTC Software
Servo Motor Control Demonstration.
Program ultrasonic range sensor in autonomous mode
Programming Concepts Part B Ping Hsu. Functions A function is a way to organize the program so that: – frequently used sets of instructions or – a set.
The George Washington University Electrical & Computer Engineering Department ECE 002 Dr. S. Ahmadi Class 2.
ROBOTC for VEX On-Site Professional Development
1 L Fall 2003 – Introductory Digital Systems Laboratory Motors and Position Determination.
Programming Concepts (Part B) ENGR 10 Introduction to Engineering 1 Hsu/Youssefi.
Servo Motor Control Demonstration. EML 2023 Department of Mechanical and Aerospace Engineering motor with gear reducer flex coupling incremental optical.
David GiandomenicoFeedback Control for your FIRST Robot’s DrivetrainDec 2010 WRRF Workshops #1 David Giandomenico Team mentor for Lynbrook Robotics – Team.
VEX Robotics Design System Sensors A Brief Overview
Robot sensors MVRT 2010 – 2011 season. Analog versus Digital Analog Goes from 0 to 254 Numerous values Similar to making waves because there are not sudden.
FRC Robot Programming 1.PID Continued 2.Downloading and Deploying Code 3.Program a 2012 Robot from Spec Basic code For FIRST Robotics.
Sentry System Multiple Sensors
Control systems KON-C2004 Mechatronics Basics Tapio Lantela, Nov 5th, 2015.
Session 12 Sensors and Timers. 3 Main Types of Robot Projects Command-Based Robot A more complicated project for more complicated robots Iterative Robot.
ROBOTIC ARM 2 Wilmer Arellano © Hardware  Next slide shows sensor connection to analog pin 0 and Motor 1 connection. Lecture is licensed under.
The George Washington University Department of ECE ECE Intro: Electrical & Computer Engineering Dr. S. Ahmadi Class 4/Lab3.
The George Washington University Electrical & Computer Engineering Department ECE 002 Dr. S. Ahmadi Class3/Lab 2.
BEGINNER FLL PROGRAMMING WORKSHOP BY DROIDS ROBOTICS & EV3LESSONS.
Robot Project by Ahmad Shtaiyat Supervised by Dr. Salem Al-Agtash.
VEX and Robot C Chris Patterson Frisco ISD CTE Center Presented by.
Sensors Joe Ross Team What is a Sensor A sensor measures a physical quantity and converts it into a signal which can be read by an instrument.
Get your software working before putting it on the robot!
ROBOTC for VEX Online Professional Development. Homework Questions Thoughts? Questions?
Robotics Programming Wall Follow Line tracking for a set amount of time Line tracking for a distance.
ROBOTC for CORTEX Teacher Training © 2011 Project Lead The Way, Inc. Automation and Robotics VEX.
Components of Mechatronic Systems AUE 425 Week 2 Kerem ALTUN October 3, 2016.
Programming Concepts (Part B) ENGR 10 Introduction to Engineering
Programming & Sensors.
Electronic Control Systems Week 3 – Switches and Sensors
VEX IQ Curriculum Smart Machines Lesson 09 Lesson Materials:
.: maslab 2006 :: dheera venkatraman
ROBOTC for VEX Online Professional Development
ROBOTC for VEX Online Professional Development
Sensors For Robotics Robotics Academy All Rights Reserved.
ROBOTC for VEX On-Site Professional Development
ROBOTC for VEX Online Professional Development
Arduino Uno and sensors
Sensors For Robotics Robotics Academy All Rights Reserved.
Pulse Width Modulation (PWM) Motor Feedback - Shaft Encoder
Control Loops Nick Schatz FRC 3184.
Instrumentation and Control Systems
Programming Concepts (Part B) ENGR 10 Introduction to Engineering
CSCI1600: Embedded and Real Time Software
Sensors and actuators Sensors Resistive sensors
Motors and Position Determination
Advanced LabVIEW
CSCI1600: Embedded and Real Time Software
Programming Concepts (Part B) ENGR 10 Introduction to Engineering
Introduction to Arduinos
Presentation transcript:

Sensors Brad Miller Associate Director, WPI Robotics Resource Center

Why Use Sensors? Robot Internal State –Banner sensors –Limit switches –Potentiometers on arms –Accelerometers for tilt angle –Gyros for direction –Encoders for speed Robot position (usually) field relative –Rangefinders (ultrasonic or infrared) –Encoders for distance

This Stuff is Easy! People seem to think autonomous operations is only for advanced teams –Hard to program –Hard to connect sensors –Hard to understand It’s NOT HARD – the FLL 7 th graders can do it, their robots are all autonomous You just need the right tools!

Wiring Sensors Connects to robot via 3 pin PWM connector –PWM shells, connectors and crimp tool are available from Jameco and DigiKey –Same for digital and analog I/O –All FRC connectors should be female –Vex connectors are male

What makes a machine a robot?

What is sensing? Sensing is converting a quantity that you want to measure into a useable signal (usually electronic). Perception is the interpretation or under- standing of these signals. Example: Sensing: Sound waves -> vibrating eardrums -> signals to brain Perception: Understanding that I am talking to you about sensors.

One Use of Sensors Control your motors so they go at the speed and distance you ask them to –How do we know how fast the motor is really going? –How do we know how far the robot really went? –How do we know when the angle of the arm is what we asked it to be?

Controlling the Robot Open loop control has no feedback –Set the speed and “hope” that the motors go the requested speed and/or distance. Closed loop control (with feedback) –Use sensors to measure what’s going on then do something about it! –Apply correction to the input Desired speed is higher – Increase motor power Desired speed is lower – Decrease motor power

Simple feedback – On-Off On-Off (“Bang-Bang”) controller Thermostats have a set (desired) temperature –House too cold – turn on furnace –House too warm – turn off furnace Very of “jerky” response Hysteresis helps (dead band)

Proportional Control The speed of the robot (in this case) is proportional to the error signal –R(t) = K p * (D des (t) – D act (t)) –The difference between the desired value and the actual value is called the error function The constant K p sets the response time –Higher K p (controller gain) means faster response, but too high and oscillations and overshoot –Lower Kp and the system is slow and mushy

Proportional Control

Potentiometers Directly provides an angle of a piece of the robot You should always use potentiometers on anything that rotates or slides –Limit switches can provide stops, but not position Examples –Robot arm joint position –Lift (elevator) position

Potentiometers Variable resistor used to indicate position of something Single turn (about 270 degrees) or multi-turn for elevators Always use linear pots – not logarithmic volume controls Connect to the power, ground, and signal

Potentiometer Examples

Encoders A sensor of mechanical motion that translates motion such as speed, direction or shaft angle into an electrical signal Types of encoder outputs –Standard –Quadrature –Other outputs: Grey Code, Binary

Encoders Usually optical and measure changes in rotating disk Standard encoders have one output and can’t sense direction Quadrature encoders have multiple outputs for direction

Encoder Examples

Characteristics Resolution – Cycles/revolution –Typically 32, 64, 128, or greater –Trade resolution for processing requirements Types of outputs –Absolute: binary and gray code –Incremental: single channel (tachometer), quadrature –Optionally provide index output Maximum rotational speed

Measuring Distance

Methods of Measurement Mechanical touch sensors –Simple to build but you need to be in contact –The bumper sensor is a good example Light sensors –Infrared sensors measure reflected light amplitude, angle, time of flight (TOF), or contrast Sonar –Bounce sound off target and time

Mechanical Sensors Just switches: –Commercial switches like limit switches and bump sensors –Can be as simple as whiskers Generally only tell you a single distance Connect to a digital input on robot controller – we’re either in contact (1) or not in contact (0)

Limit Switches Can detect a fixed position Useful for knowing which position a mechanism is in –Pneumatic pistons with the reed switches Measuring the position –Polling – can easily miss the transition –Interrupts – better, but maybe more complex –Interrupt watchers (easyC and WPILib) Banner sensors are optical version of limit switch

Sonar Sensor Using the sensor –Start the sensor to begin, and stop it when finished –Read the range whenever it’s needed

How WPILib Computes Distance Speed of sound (in air): about 343 m/s or 1125 ft/s –Distance to object is 1/2 the round trip time –EasyC does the work for us – but does not give distance directly – that’s our job –Two connections, interrupt port and digital output Output port Interrupt port

Sharp IR Rangefinders Very inexpensive Easy to use Very cool!

Triangulation IR emitting diode is located at the focal point (F 0 ), producing parallel rays of output

Triangulation 2

Triangulation 3

Triangulation 4

Triangulation 5 PSD is located at the back focal plane (f)

Sharp: Limitations Back side of curve can give confusing readings – can be disastrous – easy to deal with Need to deal with nonlinear output

Cross Firing Detectors Get around the minimum distance

Beam Pattern Wider beam pattern using two crossing detectors Can be used with a servo to sweep an area Widest portion of beam is about 16cm

Choices of Sharp IR Sensors DetectorOutput TypeRangeEnable MethodOn CurrentOff Current GP2D02 Byte value read serially from device 10cm - 80cm Each reading triggered by an external clock ~25 mA~2 uA GP2D05 Boolean value (1 or 0) based on distance threshold 10cm - 80cm adjustable threshold with small integrated potentiometer Each reading triggered by an external clock ~25 mA~2 uA GP2D12 Analog value (0V to ~3V) based on distance measured 10cm - 80cm Continuous readings ~38ms per reading ~25 mA* GP2D15Digital (0 or 1) outputfactory preset to 24cm Continuous readings ~38ms per reading ~25 mA* * detector continuously reads (always on)

Gyros Measure rate of rotation –Integrate to get the angle –Initialize before using sensor –Connects to analog port Easy to get robots driving straight or on predetermined headings using proportional control Be careful of specs – especially the range (maximum degrees/sec) Parts usually come from Analog Devices

Gyro Programming With easyC or WPILib –InitializeGyro – runs calibration –StartGyro – starts background readings –GetGyroAngle – returns angle in 0.1 degrees –StopGyro – stops background readings Works with various models of gyros including kit parts – 80, 150, 300 degrees/sec

Sample Gyro Program Program always drives straight (0 degrees) Proportional control: Kp = 0.5 Replace 0 with 900 for 90 degree turn, then drive #include "BuiltIns.h" void main(void) { InitGyro(1); StartGyro(1); TwoWheelDrive(1, 2); while (1) { int error; int heading = GetGyroAngle(1); error = heading - 0; Drive(60, - error / 2); }

FIRST Infrared Remote Sensor Detects which of 4 IR Remote buttons is pressed –You program the sensor for a set of remote codes Put in program mode and teach it each code It then detects those codes by setting one of 4 wires to 5v for 100ms. Maybe a good candidate for interrupt watchers Be careful if polling –7-15v power supply

Programming IR Sensor

Sample IR Receiver Program #include "BuiltIns.h" #define LEFT 5 #define RIGHT 6 #define FORWARD 8 #define BACKWARD 7 void main(void) { TwoWheelDrive(1, 2); while (1) { if (GetDigitalInput(FORWARD)) Drive(127, 0); else if (GetDigitalInput(BACKWARD)) Drive (-127, 0); else if (GetDigitalInput(LEFT)) Drive(0, 127); else if (GetDigitalInput(RIGHT)) Drive(0, -127); }

Programming Sensors Programming tools –MPLab – Microchip tools that ship in the kit –Eclipse – Very popular open source programming environment –easyC – supplied in the kit from Intelitek Represents the softest entry into the world of programming

Libraries and Frameworks Raw IFI code base –Very basic – a set of starter files –You’re responsible for all sensor code, interrupts, timers, etc. Kevin Watson’s code –Complete source code base that you augment to add your code WPILib –Modular high level library that has “drivers” for all sensors, timing, interrupts –easyC is based on WPILib

Program Structure Basically you write three functions: –void Initialize(void) // init sensors here –void Autonomous(void) // autonomous code –void OperatorControl(void) // operator code The library does all the rest of the work for you

Questions?

Why do robots need sensors?

Sensing for specific tasks

Control Systems Open loop: the sequence of commands in the program is carried out irrespective of consequences –Example: microwave oven set to defrost for 2 minutes. Shuts off in two minutes – ready or not. –Driving a fixed distance by timing Closed loop: feedback is used to modify the commands in the program based on current conditions –Example: home heating system – the current temperature is fed back to the control system –Driving a fixed distance using wheel encoders

People do Closed Loop Feedback We stay in our lane. How do we do this: –If we stray out of the lane we apply a correction –Amount of correction is usually related to the amount of error (wild turns on waking up!)

What are some examples Keeping your house at a constant temperature Following a wall at a fixed distance Keeping the arm on our FIRST robot at a desired angle regardless of load Automotive cruise controls Airplane autopilots – near and dear to my heart

Derivative Control Going fast makes sense when far away. –The problem is momentum carries actuators past the setpoint Rate of change of error over time – is the error getting smaller over time?

Solving the Steady State Error Problem The problem is: the system has internal friction –At low values (near 127) the motors just don’t turn and the robot doesn’t make that final correction. But there is still an error – this is the steady state error. This is where the integral term helps: sum the error and reapply it. The longer the robot sits parked at 13” the larger the error becomes until it is enough to move the robot. The same thing happens when the robot is too close to the wall. This time, a negative correction accumulates.

Integral Control The Integral of the error (error accumulated over time) –Acts on the “history” of the error –Eliminates steady state error –While the error is positive, the correction is increasing. While the error is negative, the correction is decreasing.

Example: Driving Straight Gyro returns the rate of rotation –Integrate rate to get the heading –Different gyros have different sensitivities

Problem: Don’t Know the Distance Until Hitting the Object

Other Echolocation Users

Enter: Echolocation (Sonar) Sound Navigation and Ranging (Sonar) –Use speaker to send out sound and microphone to listen for echo –More correctly called echolocation –Works in air or water

Demonstration: Looking at the Rangefinder Signals We can measure the voltage from the echo return on the rangefinder. –That lets us see the rangefinder operating in real-time using a software oscilloscope.