123
FIRST® Robotics Team 836 The RoboBees www.RoboBees.org Sensors The Basics

Basic Sensors for Robotics

  • Upload
    vodang

  • View
    242

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org

Sensors

The Basics

Page 2: Basic Sensors for Robotics

FIRST Team 836 - The RoboBees

2

Mr. Bazemore – Controls Mentor, Robot Build Project Manager

Mr. Long – Controls Mentor, Electrical Mentor

(contains LabVIEW References)

Page 3: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org

RoboBees Sensors

• Drive control – Provides for robot translation and rotation (skid-steering) and Sonar-

assisted positioning for auto-arriving at optimal shooting location. Drive Incremental

Encoders are logged to an odometer file for transmission maintenance scheduling.

• Fire control – Uses custom Infra-Red break-beam sensors to automatically manage

game-piece positioning, always promoting a disc to the shooter from the queue.

• Shooter wheel control – Uses Hall Effect sensor with Take-Back-Half control

algorithm to maintain shooter wheel at commanded RPM.

• Elevator control – Uses Absolute Rotary Encoder with PID control algorithm to hold

disc launcher at commanded Pitch. Using an absolute encoder simplified control,

ensuring the Elevator would always ‘wake up’ knowing its absolute position, no matter

where it was left when last powered down.

• Climb System control – Uses state machine and Incremental Rotary Encoder to

provide manual or automated control of ascent actuators, and a current sensor (on

climb motor) to confirm climb hooks are properly seated and taking load.

Page 4: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 4

OBJECTIVE

Remove the Mystery about Sensors

• Review Model: Sense – Decide – Act

• Understand what Sensors do

• Recognize Sensor Classifications

• Insight into how Sensors work

• Describe how to Use Common Sensors

• Identify how to Connect a Sensor

• Understand basic Sensor Specifications

• Be able to Calibrate a Sensor

• Review Basic Code Examples (LabVIEW)

Page 5: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 5

Sense / Decide / Act

• SENSE

– Sense the Control Input and/or Environment

• DECIDE

– Make a Decision based on this information

• ACT

– Take Action

• REPEAT

Objective

Page 6: Basic Sensors for Robotics

6

Brain / Controller

Effectors / Actuators Environment

Sensors

ACT

Feedback

SENSE

DECIDE

Page 7: Basic Sensors for Robotics

Sense – Decide – Act

7

• SDA is a model of ability

• To make an effective Robot, it must be made to interact well with its environment and control commands

• This interaction must be : – Continuous … so a loop

– Closely coupled … so a sufficiently fast loop

• Closely Coupled … it’s about Cause and Effect – Control/Environment changes important to the Robot are noticed

and considered

– The Robot should have an effect on the Environment

– The Environment should have an effect on the Robot

See http://www.youtube.com/watch?v=_iPMIU6jbio&feature=related

Professor Michael Wooldridge, Department of Computer Science, University of Liverpool

Page 8: Basic Sensors for Robotics

8

Sense – Decide – Act Tele-Operated

Sense

Decide

Act

Page 9: Basic Sensors for Robotics

9

Sense – Decide – Act Autonomous

Decide

Act

Sense

Page 10: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 10

Sense – Decide – Act

• Don’t ACT before you DECIDE

• Don’t DECIDE before you SENSE

• Keep updating your SENSES,

DECISIONS, ACTIONS

• Good rules for PEOPLE, too

Review

Page 11: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 11

What are Sensors?

• Sensors allow a robot to know something about : – Itself

– It’s Environment

• A Sensor is a device that maps an ‘attribute’ (of the robot or of the environment) to a quantitative value

• Generally by converting, or transducing, one form of energy to another – So Sensors may also be called ‘Transducers’

– Most times the sensor output is Electrical

Objective

Page 12: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 12

What are Sensors for?

• Allows interaction with Environment

– Tell me when you possess the game piece

– Notify when you are lined up on the mini-bot pole

• Sensors allow Goal Seeking!

– Go to wall, and stop when 22” away

– Drive in a Straight Line

– Keep the Turret pointed at the Target

– Put the Arm in the best Scoring Position

– Turn the Robot until it is Aimed at the Goal

Page 13: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 13

Classifying Sensors

• Exteroceptive Sensors

– Perceiving things about the outside environment, exterior to the Robot

• Proprioceptive Sensors

– Perceiving things about the relative position of Robot parts, or Robot movement

• Interoceptive Sensors

– Perceiving things about the interior of the Robot

*Definitions are not rigorous. Based on neurophysiologist Charles Scott Sherrington’s work in 1906

*

Page 14: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 14

Exteroceptive Sensors

• Sense the outside environment – Range or Proximity

• Navigation, Obstacle Avoidance, Distance

– Vision • Identify, Locate Objects

– Compass • Robot Orientation, Absolute Heading

– Break-Beam • Object Detection

– Contact • Proximity, Virtual Bumper, Collision

Page 15: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 15

Proprioceptive Sensors

• Sense the position of Robot parts / movement – Rotary Encoders

• Drive wheel direction/position, Arm position

– Gyroscope • Turn Rate, Relative Heading, Balance

– Inclinometer • Tilt, Relative Angle

– Accelerometer • Impact, Distance, Tilt

– Inertial Measurement Unit (IMU) • Combine Gyros and Accelerometers for Navigation

– Contact • Internal mechanism location or states

Page 16: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 16

Interoceptive Sensors

• Sense the Robots Interior condition – Battery Voltage

• Know when to seek a charger

– Failure Detection • Know when to attempt fault correction

– Not often used in FIRST Robotics • Interoceptor requirements tend to be for longer

term issues

• Time scale of competition is short

Page 17: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 17

Sensor Types

• Active

– Transmit signal into environment

– Sense return signal

– Example: Sonar, Break-Beam Sensor

• Passive

– Sense signal already available from

environment

– Example: Contact Switch, Compass, Camera

Page 18: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 18

Sensor Types

• Absolute Reading

– Zero position has physical meaning

– Example: Absolute Encoder, Compass, Accel

• Relative Reading

– Zero position is just an arbitrary starting value

– Example: Incremental Encoder, Gyro Heading

Page 19: Basic Sensors for Robotics

19 From Dr. Brian Mac Namee (www.comp.dit.ie/bmacnamee)

Page 20: Basic Sensors for Robotics

20 From Dr. Brian Mac Namee (www.comp.dit.ie/bmacnamee)

Review

Page 21: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org

How it Works

Limit Switch

• Converts Sense of Touch to a code – Detects presence or absence of something – Used to mark a limit for movement

• Provides a general ‘Sense of Place’ – Flipper size determines detection range

• Output is digital – NO – Normally open – NC – Normally closed

• Activated condition is inverse – Normally Open ---> Closed – Normally Close ---> Open

21

Page 22: Basic Sensors for Robotics

Limit Switch

Application

• Electrical Connections – Com ---> Ground

– NC ---> Signal Pin

– NO ---> Signal Pin

• Can use either NC, NO or both

22

DIOx

Digital Side Car

Pull-Up Resistor

causes reading to

Default to ‘High/True’ when input floats

Page 23: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org

Operational Considerations

• De-bounce!

• Can be fragile

• Reserve for slower sensing (>1 Hertz repetition, or

>0.5 sec duration)

23

See The RoboBees

2013 Code release

on Chief Delphi

for HOW to do this

in LabVIEW …

… or, see

http://zone.ni.com/devzone/cda/epd/p/id/6251

Page 24: Basic Sensors for Robotics

24

How it Works

The Accelerometer

• Measures Proper Acceleration

– Not the same as Coordinate Acceleration

• which is only about change in velocity

– It is Acceleration felt by the object

• An Acceleration, also called a “G-Force” (one ‘G’ = 9.8 m/s2)

• Thus, device will sense force of gravity* and

change in velocity**

– Both produce a measurable acceleration

• May output a small voltage or digital code

– Proportional to measured acceleration

See http://www.youtube.com/watch?v=YMCkE3sv-Mw&feature=player_embedded

* Indirectly, what it actually senses is the mechanical force from whatever is supporting it (ground) when not in free fall

** See Einstein’s Principle of Equivalence

Page 25: Basic Sensors for Robotics

25

How it Works

The Accelerometer • Accelerometers sense in one or

more Axes (X,Y,Z)

• MEMS approach is to use a micro-miniature mass on a movable beam – Beam displacement sensed

(change in capacitance)

Page 26: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 26

The Accelerometer

Applications

• Balancing the Robot

• Sensing Vibration

• Measuring Incline or Orientation – Is the Robot on a Ramp?

– What is the Angle of the Robot Arm?

• Collision Detection

Page 27: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org

Operational Considerations

• Fast responding (lot of signal variation)

• If seeking to sense orientation change,

(like Tilt), remember Robot movement will

affect signal

27

Page 28: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 28

How it Works

The (Rate*) Gyroscope

• Measures the Angular Rate of Rotation

– How fast the sensor is turning, degrees/sec

– Actual turn angle (Heading), is obtained by integrating the rate

• Provides a Relative Heading, since starts at ‘zero’

• Example of an Absolute Heading would be ‘North’

• May output a small voltage or digital code

– Proportional to measured Angular Rate * Since a real Gyro uses a rotating mass, the term ‘Rate Gyro’ is used for Angular Rate Sensors

Page 29: Basic Sensors for Robotics

29

How it Works

The Rate Gyro

• Rate Gyros sense in one or more

Axes (Roll, Pitch, Yaw)

• MEMS approach is to use a micro-

miniature vibrating structure

– Tuning Fork or Twisting Wheel

• Rotation of Gyro induces a Coriolis

Effect – Twists structure back to Conserve Momentum

– Displacement measured

Page 30: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 30

Biological Gyros

Crane Fly

• Vestigial hind pair of wings evolved into Halteres

– Pair of radially oscillating masses

– Biological Tuning Fork Gyro

– Generates muscular signals to control flight

Order Diptera

Page 31: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 31

The Rate Gyro

Applications

• Guidance

– Turn Robot a relative Heading

– Align Robot to a Target

• Navigation

– Keep track of where the Robot is

• Stability

– Hold a certain Heading (Drive Straight)

– Determine which way a Robot is falling

Page 32: Basic Sensors for Robotics

Gyro Code Example

Simple Turn

32

Sense

Decide

Act

Notes

Page 33: Basic Sensors for Robotics

Gyro Code Example

Drive Straight

33

Sense

Decide

Act

Notes

Page 34: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org

Operational Considerations

• Gyros have a 2 second calibration period

– During ‘Open’ (LabVIEW) (Don’t move!)

• Drift – maybe 1-2 deg every 10 secs

• You can exceed the rate - Will lose position

• Output doesn’t ‘wrap’ - will go above 360 deg

• Connect only to either Analog Input 1 or 2 – AI1 & AI2 are the only inputs that are paired to

integrators on cRIO FPGA

34

Page 35: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 35

How it Works

The Rotary Encoder*

• Converts Angular Position of a Shaft to a code – Measures how far a Shaft has turned by Counting

– Count can be used to measure Distance & Speed • Odometer / Speedometer

• Provides a precise ‘Sense of Place’ – One turn may be 1000’s of counts (resolution)

• Either Incremental (Relative), or Absolute

• May output a small voltage or digital code – Proportional to reported Angular Position

*Also called a Shaft Encoder

Page 36: Basic Sensors for Robotics

36

How it Works

The Rotary Encoder

• Optical approach uses Photo Detectors – Photo Interruptive

• Shines light thru a disk with transparent/opaque sections

– Photo Reflective • Shines light on a marked

reflective surface

• Each dark-to-light transition is counted

• Rotation is unlimited

US Digital E4P

Page 37: Basic Sensors for Robotics

37

How it Works

The Rotary Encoder

Photo Detector can sense shaft turning

But cannot discriminate which direction

Code Wheel

Photo Detector

Page 38: Basic Sensors for Robotics

38

How it Works

The Rotary Encoder

Two, offset code wheels* / photo detectors

Offset by one quarter cycle out of phase = Quadrature

Only one changes at a time, because they are out of phase

The sequence indicates which direction: CW or CCW

A B

Code Wheel ‘A’

Code Wheel ‘B’

Photo Detector ‘A’

Photo Detector ‘B’

*Can also arrange this with one code wheel, and two detectors, 90 deg out of phase

Page 39: Basic Sensors for Robotics

39

If A leads B, then Encoder

is turning CW

If B leads A, then Encoder

is turning CCW

How it Works

The Rotary Encoder

Phase A B

1 0 0

2 0 1

3 1 1

4 1 0

Clockwise Rotation

Phase A B

1 1 0

2 1 1

3 0 1

4 0 0

Counter Clockwise Rotation

Requires two channels, one each for ‘A’ and ‘B’

Makes the effective resolution 4x greater

Page 40: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 40

How it Works

The Rotary Encoder

• Total Counts from one revolution of the

encoder is called CPR (Counts Per Rev)

• US Digital E4P-360 has 360 CPR

• Distance traveled from one revolution of a

wheel → Distance = Cw = πDw

Wheel Radius

is 1, so Dw = 2,

so Cw = 6.28

WPI Library keeps ‘Counts’ constant whether or not one uses quadrature

Page 41: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 41

• Because one revolution of travel is the same as one revolution of the Encoder*, then – Cw / CPR is the Distance per Count

– In same units the wheel circumference is measured in

• So, Distance = X counts * Distance per Count – Example: Cw = 6.28 inches, CPR = 360

– How far is 1000 counts?

– Answer: 1000 * (6.28 / 360) = 17.4 inches

How it Works

The Rotary Encoder

*Assuming the Encoder is directly connected to the wheel shaft, i.e. no intermediate transmission

Page 42: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 42

The Rotary Encoder

Applications

• Drive Robot a certain Distance

• Move Robot at a certain Speed

• Velocity = Distance traveled / time

• Hold a certain Heading (Drive Straight)

• with Differential Drive

• Move Robot Arm to a certain Position

There are also Linear Encoders that operate on same principle

Page 43: Basic Sensors for Robotics

Encoder Code Example

43

Notes

Page 44: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org

Operational Considerations

• Application may drive absolute sensor – Absolute, Analog: US Digital MA(E)3

• Shaft or Shaftless (mech connection)

• Analog Encoders likely wrap their output – 0 -> 5 -> 0 volts, either use within one range, or handle wrap

• Quadrature is nice, tradeoff is extra input – Shooter wheel won’t need direction to be sensed

44

MA3

MAE3

Page 45: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 45

How it Works

The Ultrasonic Sonar

• SONAR is SOund Navigation and Ranging – Initially developed for underwater application

• Ultrasound is sound above Human Hearing >20 kHz – Sensors may use ‘sound’ above 40 kHz

• Measures how far an object is by Time-of-Flight – Sends out a sound wave

– Times until the reflection returns

• May output a small voltage or digital code – Proportional to reported Range

Will a Sonar sensor work on a lunar rover? Why?

Page 46: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 46

How it Works

The Ultrasonic Sonar

Speed of Sound * Time Passed = 2 * Distance to Object

Speed of Sound* is ~1,126 ft/sec (768 mph), or ~0.9 ms/ft

*In dry air at 68 deg F

Page 47: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 47

How it Works

The Ultrasonic Sonar

Since the wave is emitted as a cone, range errors may result

Page 48: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 48

How it Works

The Ultrasonic Sonar

Complex shapes may produce anomalous results

Multiple Sonars may interfere with each other

Multiple Sonars on one Robot might be configured to avoid this

Physically (by pointing different directions), or electrically (by taking turns)

Page 49: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 49

The Ultrasonic Sonar

Applications

• Position Robot at a certain Standoff Distance

• Avoidance of an Obstacle

• Determine the Range to a Goal

• Align the Robot on the Center of the MiniBot Pole

Page 50: Basic Sensors for Robotics

Sonar Code Example

50

Notes

Page 51: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org

Operational Considerations

• Consider range maybe 6 meters, for large objects

• Senses only the closest object – Auto discriminates against background

• Two can be used to triangulate – but must prevent cross-interference

– MaxBotix units have a special multi-sensor config*

• May need to filter the data – another Robot may send a ping at yours!

51

*http://www.maxbotix.com/documents/LV_Chaining_Constantly_Looping_AN_Out.pdf

Page 52: Basic Sensors for Robotics

52

How it Works

The Infrared Proximity

• Two types

– Opposed: Object disrupts IR beam

– Diffuse: IR is returned from an object

• Converts amount of Infrared light sensed

into analog or digital output

Opposed Type

Diffuse Type

Page 53: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org

Operational Considerations

• Some materials are transparent to

Infrared!

• De-Bounce! – It’s a switch

… Like

some

Plastics!

Visible Light Infrared

including, umm,

Frisbees …

Page 54: Basic Sensors for Robotics

How it Works

Hall Effect Sensor • Magnetic field affects current flow in a conductor

• Can be used as a switch, affected by a magnetic

field

• Non-Contact

• Types: Non-Latching, Latching, and Linear

See: http://vimeo.com/21847015

OPTEK Technology OH090U

Page 55: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org

Operational Considerations

• For Tachometers, secure your magnet! … Ensure magnet close, but won’t strike sensor…

• More magnets can be better – 2 is much better than 1, 4 a bit better than 2

– Allows better low speed control

• FPGA can count 39,000 ticks/second* – So encoders have been reported to work as well

– Don’t need quadrature, when running one direction

*… or so I’m told …

Page 56: Basic Sensors for Robotics

RPM Control* Code Example

Notes

*Should work with Hall Effect Sensor or Rotary Encoder

thanks Team 123 / Cosmos for the Take-Back-Half implementation subVI in LabVIEW!

Page 57: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org

Current Sensor

• Converts flow of electrons into a code

– Used to detect motor stall

– Detect events, (remotely sense load)

• Measures voltage drop across high

accuracy shunt resistor

• Output is analog

– Voltage scaled to measured current

• Will be built into 2015 Control System PDB

Page 58: Basic Sensors for Robotics

Operational Considerations

• Install ‘upstream’ of Motor Controller

• Don’t exceed current rating!

Here

NOT Here

Page 59: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 59

Sensor Interface

• Sensors are generally electrically powered, and

provide an electrical signal

– Sensors are commonly powered with 3 - 5 volts

– The Signal Wire is transmitting some kind of Signal

– The Signal represents the amount of the sensed

attribute

• Must get the signal into the Controller

– So the program can Decide what to do (SDA)

• The physical connection is done at an Interface

Page 60: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 60

Interface Types

• Basically two types : – Analog, signal can have any value in a Range

– Digital, signal can have discrete values in a Range

• The ‘Real World’ is an Analog place

• Computers process data (signals), that are Digital

• Analog signals must be converted to digital, using an A/D converter

• Sensors with digital interfaces may have this A/D converter already built in

Page 61: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 61

Analog Interface

• Analog sensors

connect here

– If they are 5 Volt

devices

Analog Bumper

Page 62: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 62

Digital Interface

• Digital sensors

connect here

– If they are 5 Volt

devices

Jaguar Motor Controller

Digital Sidecar

Page 63: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 63

Sensor Specifications

• Specifications, or “specs”, tell you

– How to power the sensor

– How to physically mount the sensor

– What kind of interface it has

– What kind of performance to expect

• Uses standardized terminology to

– Help you decide between alternative sensors

– Help you design your control system

Page 64: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 64

Sensor Specifications

• Range: Difference between min and max values

• Resolution: Minimum difference between two values

• Linearity: Maximum deviation of output signal from the ideal, across the range

• Sensitivity: Ratio of output change to input change

• Bandwidth or frequency: The speed with which a sensor can update new readings

• Error/Accuracy: Difference between the sensor’s output and the true value

From Dr. Brian Mac Namee (www.comp.dit.ie/bmacnamee)

Page 65: Basic Sensors for Robotics

65

Gyroscope

InvenSense IXZ-500 Manufacturer

Model

Page 66: Basic Sensors for Robotics

66

Infrared Proximity Sensor

Sharp GP2Y0A02YK0F

Page 67: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 67

Sensor Calibration

• Calibration

– Causing the quantitative sensor output values

to be consistent with a desired unit of

measurement

• Example: Distance

– Don’t use Angstroms, Parsecs …

– Don’t use Furlongs, Cubits or Beard-Seconds

– Do use Inches, Feet, Meters or Centimeters 1 Angstrom = 100 picoMeters (e-12) // 1 Parsec = 3.26 Light Years = ~9.46 PetaMeters (e15)

1 Furlong = 201meters // 1 Cubit = ~20.7 inches (we think) // 1 B-S = ~5 nanoMeters

Page 68: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 68

Sensor Calibration WPI Supported

• Many Sensors have VIs in the WPI Library

– Analog: Accelerometers, Gyros

– Digital: Counters, Encoders, Ultrasonic Sonars

– Particular VI sequence for setting up a sensor

• For these, start with the Spec Sheet

– Ensure it matches your particular sensor model

– These usually have pre-defined units of measurement (some you can choose preferred units, like Encoders)

Skip Details

Page 69: Basic Sensors for Robotics

69

Sensor Calibration

Accelerometer

Page 70: Basic Sensors for Robotics

70

Sensor Calibration

Accelerometer

• Sensitivity = 174 mV/g = 0.174 V/g

– Sensitivity is another term for ‘Gain’

• Zero g Bias = 1.5 V

– Zero Bias is another term for ‘Center Voltage’

Will read out directly in g’s

Page 71: Basic Sensors for Robotics

71

Sensor Calibration

Gyro

Page 72: Basic Sensors for Robotics

72

Sensor Calibration

Gyro

• Sensitivity = 6 mV/°/sec = 0.006 V/°/sec

– Sensitivity is another term for ‘Gain’

Will read out directly in angular degrees

Page 73: Basic Sensors for Robotics

73

Sensor Calibration

Rotary Encoder (US Dig E4P-360)

Page 74: Basic Sensors for Robotics

74

Sensor Calibration

Wheel (AndyMark am-0136)

• Specifications:

• Diameter: 5.95 inch (151mm)

• Width Across Middle: 1.13 inch

• Width at rollers: 1.79 inch

• Bore: 1.125 inch (28.6mm)

• Bolt Pattern: 0.2 inch diameter holes (6) on 1.875 inch bolt circle

• Body Material: Steel, 0.05 inch thick

• Load Capacity: 80 pounds (36kg) …

Page 75: Basic Sensors for Robotics

75

Sensor Calibration

Rotary Encoder

• CPR = 360 Counts / Revolution

• Wheel Diameter = 5.95 inches

• Cw = π * 5.95 = 18.68 inches

• Distance per Count = Cw / CPR = 18.68 / 360 = 0.052 in / ct

For quadrature encoding (default) Will read out directly in inches

Wheel Specifications:

Diameter: 5.95 inch (151mm)

Width Across Middle: 1.13 inch

Width at rollers: 1.79 inch

Bore: 1.125 inch (28.6mm)

Bolt Pattern: 0.2 inch diameter holes (6) on 1.875 inch bolt circle

Body Material: Steel, 0.05 inch thick

Load Capacity: 80 pounds (36kg) …

Page 76: Basic Sensors for Robotics

76

Sensor Calibration

Rotary Encoder Alternative*

1. Set Distance per Count to the value 1

2. Set up an Indicator to read Encoder Distance

3. Drive (or better, push) Robot a measured distance (while code is running)

4. Record Encoder Distance

5. Compute Distance per Count empirically

6. Reset Distance per Count

Example: • Distance pushed = 20 feet = 240 inches

• Count recorded = 4600 counts

• Answer: DpC = 240 / 4600 = 0.052 inches / count

*Use when wheel diameter unknown and/or Encoder not direct mounted to wheel shaft

Page 77: Basic Sensors for Robotics

77

Sensor Calibration

Ultrasonic Sonar (Analog)*

*Digital Ultrasonic Sonars, also available, are configured differently in code

Page 78: Basic Sensors for Robotics

78

Sensor Calibration

Ultrasonic Sonar (Analog)

• Sensitivity is 9.8 mV / inch

• This means we convert voltage to inches by multiplying by the inverse Inverse of 9.8 mV/in = 1 / (9.8 mV / inch) = 102 inches / Volt

Create an Offset to place the ‘zero’ of the sensor where you want it

If Sonar is 15.2 inches behind front of Bumper, subtract this

Global will have value in inches, from Bumper

Page 79: Basic Sensors for Robotics

79

Sensor Calibration non-WPI Supported

For any Analog sensor*, calibrate as follows:

1. Set up sensor with Control Knobs for Scale and Offset, and an Indicator. Run code.

2. Set Scale value to 1; Set Offset to 0

3. Make sensor sense minimum of Range (Smin), record Vmin

4. Make sensor sense maximum of Range (Smax), record Vmax

5. Calculate Scaler as (Smax- Smin)/(Vmax- Vmin)

6. Set Scale Knob to this value

7. Set Offset Knob to move ‘zero’ where you want it

*Assuming the sensor is linear … or you’re willing to accept any non-linearity

Page 80: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org

Where to Find Sensors

• Kit of Parts!

– Rotary Encoder US Digital E4P (250 or 360 CPR)

– Gyro Analog Devices ADXRS652 (250 deg/sec)

– Sonar LV-MaxSonar-EZ1

– Accelerometer Analog Devices ADXL-345

80

http://www.adafruit.com/

http://www.phidgets.com/

http://www.usdigital.com/

https://www.sparkfun.com/

Page 81: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 81

“Sensors are what makes it all possible.”*

*Rodney A. Brooks, MIT Artificial Intelligence Lab, Cambridge, MA

FIRST® Robotics Team 836

The RoboBees www.RoboBees.com

Page 82: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 82

References

• H.R Everett, “Sensors for Mobile Robots”, 1995

• Professor Michael Wooldridge, “Intro to Multi Agent Systems”,

Department of Computer Science, University of Liverpool

• Sir Charles Scott Sherrington, Human Sensory Classification

• Dr. Brian Mac Namee, Sensor Classification

• MEMS Industry Group

• Matt Hercules, Rotary Encoder Graphics

• John Reid, Ufo Karadagli, Wheel Circumference Graphic

• User:Imeowbot, Tachometer Graphic

• Christophe Dang Ngoc Chan, Longitudinal Wave Graphic

• Team 123 / Cosmos, Bisect Ctl LabVIEW subVI for Take-Back-Half

Page 83: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org

BACK UP SLIDES

Page 84: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 84

R / P / Y for an Aircraft

Page 85: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 85

R / P / Y … in a Canoe

Page 86: Basic Sensors for Robotics

86

R / P / Y … if you’re a Fish …

Roll Yaw

Pitch

Page 87: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 87

Learning Objectives Sense-Decide-Act

• Understand the SDA Cycle

• Understand how SDA leads to intelligent

behavior

• Identify the three SDA robot hardware

elements and explain their function

• Explain what makes the cycle effective

Page 88: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 88

Review Sense-Decide-Act

• What is the SDA Cycle ?

• How does this cycle improve the robot’s

behavior?

• Name the three robot hardware elements

• What do they do?

• What’s important for the cycle to be

effective?

Page 89: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 89

Learning Objectives Sensor Purpose & Classification

• Describe how a Sensor works, in general

• Identify two capabilities that sensors give

the robot

• Describe the three Classes of Sensors

• Explain the terms active, passive,

absolute, and relative

• Recognize the typical use of common

sensors

Page 90: Basic Sensors for Robotics

90

From http://i.cmpnet.com/eetimes/news/09/09/1567chart_pg31.gif

Page 91: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 91

Review Sensor Purpose & Classification

• How does a Sensor work?

• What two capabilities do sensors give the

robot?

• Describe the three Classes of Sensors

• Explain the distinction between active,

passive, absolute, and relative

• Name some sensors and how they might

be used

Page 92: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 92

Learning Objectives The Accelerometer

• Describe what an Accelerometer Measures

• Name the directions or axes

• Understand MEMS technology

• Describe applications of Accelerometers

Page 93: Basic Sensors for Robotics

93

How it Works

The Accelerometer

• Micro-Electro-Mechanical Systems (MEMS)

– technology of very small mechanical devices

driven by electricity

See http://www.youtube.com/watch?v=ZuE4oVrtEQY&feature=player_embedded

Page 94: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 94

Review The Accelerometer

• What does an Accelerometer Measure?

• Name the standard axes

• What is MEMS technology?

• Name some applications of Accelerometers

Page 95: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 95

Learning Objectives The Gyro

• Describe what a Gyro Measures

• Name the three axes of a Gyro

• Describe applications of Gyros

Page 96: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org

Simple Turn Code Notes

• Code example assumes Begin has defined the Device

References

• Don’t use loop structure (nor wait) in Tele-Op!

– Tele-Op already runs in a loop

• Confirm that the wiring to Left/Right Axis inputs on Tank

Drive vi cause robot to turn in expected direction

• Turn performance will be dictated by how well the Drive

System is designed

– If doesn’t work well, it may not be your code!

• This implementation will overshoot objective

– Due to momentum

Page 97: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org

Drive Straight Code Notes

• Code example assumes Begin has defined the Device

References

• Don’t use loop structure (nor wait) in Tele-Op!

– Tele-Op already runs in a loop

• Confirm that the wiring to Left/Right Axis inputs on Tank

Drive vi cause robot to turn in expected direction

• Turn performance will be dictated by how well the Drive

System is designed

– If doesn’t work well, it may not be your code!

• This implementation will require tuned PID constants

Page 98: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 98

Review The Gyro

• What does a Gyro Measure?

• Name the three Gyro axes

• Name some applications of Gyros

Page 99: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 99

Learning Objectives The Rotary Encoder

• Describe what an Encoder Measures

• Discuss the advantage of Quadrature

• Discuss any disadvantage

• Describe applications of Encoders

Page 100: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org

Encoder Code Notes

• Code example assumes Begin has defined the Device

References

• Don’t use loop structure (nor wait) in Tele-Op!

– Tele-Op already runs in a loop

Page 101: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 101

Review The Rotary Encoder

• What does a Rotary Encoder Measure?

• Describe Quadrature Encoding advantages

• Describe any disadvantage

• Name some applications of Encoders

Page 102: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 102

Learning Objectives The Ultrasonic Sonar

• Describe what a Sonar Measures

• Discuss possible problems with Sonar

• Describe applications of Sonar Sensors

Page 103: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 103

How it Works

The Ultrasonic Sonar

• One type uses a Ceramic transducer that

vibrates when electrical energy is applied

• Vibrations compress and expand air molecules

in waves from the sensor face to a target object

• Echo is received and amplified with increasing

gain over time to compensate for loss of volume

• The sensor will measure distance by measuring

the elapsed time, before retransmitting again

Page 104: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org

Sonar Code Notes

• Assumes Sonar is facing forward

• This will drive forward at control speed until Sonar

detects something 25 units ahead, then slow to half

speed, and finally stop when 15 units away

– Slowing helps to manage overshoot by reducing momentum

• Code example assumes Begin has defined the Device

References

• Don’t use loop structure (nor wait) in Tele-Op!

– Tele-Op already runs in a loop

Page 105: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 105

Review The Ultrasonic Sonar

• What does a Sonar Sensor Measure?

• Describe possible problems with Sonar

• Name some applications of Sonar Sensors

Page 106: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 106

Learning Objectives The Hall Effect Sensor

• Describe what a triggers a Hall Effect Sensor

• Describe the types of Hall Effect Sensors

• Describe applications of Hall Effect Sensors

Page 107: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org

RPM Control Code Notes

• Using one magnet with (non-latching) Hall Effect Sensor

– Set Period Multiplier to One

– If using Encoder, set Period Multiplier to CPR

• This example uses the Take-Back-Half control algorithm

– The “Bisect Ctl” subVI (thanks Team 123 / Cosmos!)

• TBH Gain constant must be tuned

– Start with a small value, monitor graph for performance

• Code example assumes Begin has defined the Device

References

• Don’t use loop structure (nor wait) in Tele-Op!

– Tele-Op already runs in a loop

Page 108: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org

RPM Control, Begin

Page 109: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 109

Review The Hall Effect Sensor

• What does a Hall Effect Sensor Measure?

• What are the types of H-E Sensors?

• Name some applications of H-E Sensors.

Page 110: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 110

Learning Objectives Connecting Sensors

• Describe the two types of Sensor Interfaces

• Identify where to connect sensors

Page 111: Basic Sensors for Robotics

111

Jaguar Interface

Analog Potentiometer Digital Encoder

‘Digital’ Switch

Page 112: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 112

• What are the two types of Interfaces?

• Where are these Interfaces?

Review Connecting Sensors

Page 113: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 113

Learning Objectives Sensor Specifications

• Explain the purpose of Specifications

• Identify standard specifications for Sensors

• Describe where to find Specifications

Page 114: Basic Sensors for Robotics

114

Digital Compass

Honeywell HMC6352

Page 115: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 115

• What is the purpose of Specifications?

• What are some standard specs for

Sensors?

• Where does one find Specifications?

Review Sensor Specifications

Page 116: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 116

Learning Objectives Sensor Calibration

• Explain the purpose of Calibration

• Describe where to find Specifications

• Understand setting up sensor VIs

Page 117: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org 117

• What is the purpose of Calibration?

• Where does one find Specs for Calibration?

• Describe how WPI-supported sensor VIs

are set up

Ready for the TEST?

Review Sensor Calibration

Page 118: Basic Sensors for Robotics

FIRST® Robotics Team 836

The RoboBees www.RoboBees.org

Page 119: Basic Sensors for Robotics

Accelerometer Code C++ / Java

Accelerometer accel;

void setup()

{

accel = new Accelerometer(1,1);

accel.setSensitivity(.018);

accel.setZero(2.5);

}

double getAccel()

{

return accel.getAcceleration();

}

Page 120: Basic Sensors for Robotics

Gyro C++ / Java

Gyro gy;

void setup()

{

gy = new gyro(1);

gy.Reset();

}

float getAngle()

{

return gy.GetAngle();

}

Page 121: Basic Sensors for Robotics

Counter C++ / Java

Page 122: Basic Sensors for Robotics

Analog IO C++ / Java http://wpilib.screenstepslive.com/s/3120/m/7912/l/85775-analog-inputs

Good reference for code blocks

Page 123: Basic Sensors for Robotics

DigitaI IO C++ / Java

DigialInput di = new DigitalInput(1);

di.get();

Java returns true/false

C++ returns 0/1