30
1 © 2019 The MathWorks, Inc. Infrared Sensor Basics and Robot Autonomy Programming Using Simulink By Jose Avendano

Infrared Sensor and Autonomy Programming Using Simulink ...€¦ · By Jose Avendano. 2 Agenda Introduction to the BEST IR Sensor Sensor Applications 1. Object Detection 2. Line Detection

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Infrared Sensor and Autonomy Programming Using Simulink ...€¦ · By Jose Avendano. 2 Agenda Introduction to the BEST IR Sensor Sensor Applications 1. Object Detection 2. Line Detection

1© 2019 The MathWorks, Inc.

Infrared Sensor Basics and Robot Autonomy

Programming Using Simulink

By Jose Avendano

Page 2: Infrared Sensor and Autonomy Programming Using Simulink ...€¦ · By Jose Avendano. 2 Agenda Introduction to the BEST IR Sensor Sensor Applications 1. Object Detection 2. Line Detection

2

Agenda

▪ Introduction to the BEST IR Sensor

▪ Sensor Applications

1. Object Detection

2. Line Detection

3. Motor Encoders

▪ Autonomy Integration

1. BEST SimBot

2. Joystick Triggering

3. Sequences of Commands

Page 3: Infrared Sensor and Autonomy Programming Using Simulink ...€¦ · By Jose Avendano. 2 Agenda Introduction to the BEST IR Sensor Sensor Applications 1. Object Detection 2. Line Detection

3

BEST Robotics IR Sensor Kit

Page 4: Infrared Sensor and Autonomy Programming Using Simulink ...€¦ · By Jose Avendano. 2 Agenda Introduction to the BEST IR Sensor Sensor Applications 1. Object Detection 2. Line Detection

4

BEST Robotics Infrared (IR) Sensor

▪ 2 Sensor components

Beam

Projection Area

Receiver

Field

Of

View

Transmitter Receiver

Page 5: Infrared Sensor and Autonomy Programming Using Simulink ...€¦ · By Jose Avendano. 2 Agenda Introduction to the BEST IR Sensor Sensor Applications 1. Object Detection 2. Line Detection

5

Sensor Detections

1. IR Beam cannot be

obstructed

2. IR Beam must be within

detection distance

X

X

Page 6: Infrared Sensor and Autonomy Programming Using Simulink ...€¦ · By Jose Avendano. 2 Agenda Introduction to the BEST IR Sensor Sensor Applications 1. Object Detection 2. Line Detection

6

Sensor Testing

▪ Transmitter LED indicates power

▪ Receiver LED indicates detection of IR beam

IR Beam Broken (LED OFF)IR Beam Active (LED ON)

✔ X

Page 7: Infrared Sensor and Autonomy Programming Using Simulink ...€¦ · By Jose Avendano. 2 Agenda Introduction to the BEST IR Sensor Sensor Applications 1. Object Detection 2. Line Detection

7

Sensor Sensitivity

▪ Adjust potentiometer to

change sensitivity

▪ Somewhere in the middle

(not either extreme) is the

highest sensitivity

Page 8: Infrared Sensor and Autonomy Programming Using Simulink ...€¦ · By Jose Avendano. 2 Agenda Introduction to the BEST IR Sensor Sensor Applications 1. Object Detection 2. Line Detection

8

Sensor Sensitivity

Page 9: Infrared Sensor and Autonomy Programming Using Simulink ...€¦ · By Jose Avendano. 2 Agenda Introduction to the BEST IR Sensor Sensor Applications 1. Object Detection 2. Line Detection

9

Sensor Application 1

Object Detection

Page 10: Infrared Sensor and Autonomy Programming Using Simulink ...€¦ · By Jose Avendano. 2 Agenda Introduction to the BEST IR Sensor Sensor Applications 1. Object Detection 2. Line Detection

10

Object Detection

▪ Bouncing light from an object

▪ Place transmitter and receiver

facing in the same direction

▪ Reflected light will be detected

and indicate an object

✔ X

Page 11: Infrared Sensor and Autonomy Programming Using Simulink ...€¦ · By Jose Avendano. 2 Agenda Introduction to the BEST IR Sensor Sensor Applications 1. Object Detection 2. Line Detection

11

Object Detection

Page 12: Infrared Sensor and Autonomy Programming Using Simulink ...€¦ · By Jose Avendano. 2 Agenda Introduction to the BEST IR Sensor Sensor Applications 1. Object Detection 2. Line Detection

12

Simulink Example 1

Object Detection

Page 13: Infrared Sensor and Autonomy Programming Using Simulink ...€¦ · By Jose Avendano. 2 Agenda Introduction to the BEST IR Sensor Sensor Applications 1. Object Detection 2. Line Detection

13

Simulink Example: Move Until Object is Detected

Page 14: Infrared Sensor and Autonomy Programming Using Simulink ...€¦ · By Jose Avendano. 2 Agenda Introduction to the BEST IR Sensor Sensor Applications 1. Object Detection 2. Line Detection

14

Sensor Application 2

Line Following

Page 15: Infrared Sensor and Autonomy Programming Using Simulink ...€¦ · By Jose Avendano. 2 Agenda Introduction to the BEST IR Sensor Sensor Applications 1. Object Detection 2. Line Detection

15

Line Detection

▪ Same as object detection, place

transmitter and receiver facing the

same direction

▪ Light will be reflected by bright

colored surfaces and absorbed by

dark surfaces

▪ Place the transmitter and receiver

strategically

▪ Make sure to calibrate the sensor

sensitivity

✔X

Page 16: Infrared Sensor and Autonomy Programming Using Simulink ...€¦ · By Jose Avendano. 2 Agenda Introduction to the BEST IR Sensor Sensor Applications 1. Object Detection 2. Line Detection

16

Line Detection

Page 17: Infrared Sensor and Autonomy Programming Using Simulink ...€¦ · By Jose Avendano. 2 Agenda Introduction to the BEST IR Sensor Sensor Applications 1. Object Detection 2. Line Detection

17

Line Following

Page 18: Infrared Sensor and Autonomy Programming Using Simulink ...€¦ · By Jose Avendano. 2 Agenda Introduction to the BEST IR Sensor Sensor Applications 1. Object Detection 2. Line Detection

18

Simulink Example 2

Line Following

Page 19: Infrared Sensor and Autonomy Programming Using Simulink ...€¦ · By Jose Avendano. 2 Agenda Introduction to the BEST IR Sensor Sensor Applications 1. Object Detection 2. Line Detection

19

Sensor Application 3

Wheel Encoders

Page 20: Infrared Sensor and Autonomy Programming Using Simulink ...€¦ · By Jose Avendano. 2 Agenda Introduction to the BEST IR Sensor Sensor Applications 1. Object Detection 2. Line Detection

20

Motor/Wheel Encoders

▪ Place the transmitter and

receiver so the detection is

interrupted by a rotating

wheel

▪ Resolution of encoder

depends on number of

detections per rotation

▪ Use black paint and adjust

sensitivity to help reduce

false detections

Page 21: Infrared Sensor and Autonomy Programming Using Simulink ...€¦ · By Jose Avendano. 2 Agenda Introduction to the BEST IR Sensor Sensor Applications 1. Object Detection 2. Line Detection

21

Motor/Wheel Encoders

▪ Derive distance traveled

with robot geometry

▪ Derive robot orientation

using multiple encoders

360°

123456789

Page 22: Infrared Sensor and Autonomy Programming Using Simulink ...€¦ · By Jose Avendano. 2 Agenda Introduction to the BEST IR Sensor Sensor Applications 1. Object Detection 2. Line Detection

22

Simulink Example 3

Wheel Encoders

Page 23: Infrared Sensor and Autonomy Programming Using Simulink ...€¦ · By Jose Avendano. 2 Agenda Introduction to the BEST IR Sensor Sensor Applications 1. Object Detection 2. Line Detection

23

Autonomy Integration

Page 24: Infrared Sensor and Autonomy Programming Using Simulink ...€¦ · By Jose Avendano. 2 Agenda Introduction to the BEST IR Sensor Sensor Applications 1. Object Detection 2. Line Detection

24

Intro to SimBot

▪ Robot designed for teaching BEST workshops

▪ Built with BEST components

▪ Robot controller is a VEX Arm-Cortex

Microcontroller

Page 25: Infrared Sensor and Autonomy Programming Using Simulink ...€¦ · By Jose Avendano. 2 Agenda Introduction to the BEST IR Sensor Sensor Applications 1. Object Detection 2. Line Detection

25

SimBot Components

A. 1 Servo Motor

B. 3 DC Motors

– Left Wheel

– Right Wheel

– Arm

C. 2 Contact switches

D. 2 Potentiometers

E. 1 InfraRed (IR) Sensor

A

C

B

E

D

Page 26: Infrared Sensor and Autonomy Programming Using Simulink ...€¦ · By Jose Avendano. 2 Agenda Introduction to the BEST IR Sensor Sensor Applications 1. Object Detection 2. Line Detection

26

Fetching an object Autonomously

Page 27: Infrared Sensor and Autonomy Programming Using Simulink ...€¦ · By Jose Avendano. 2 Agenda Introduction to the BEST IR Sensor Sensor Applications 1. Object Detection 2. Line Detection

27

Simulink Example 4

Trigger Autonomous Behavior

Page 28: Infrared Sensor and Autonomy Programming Using Simulink ...€¦ · By Jose Avendano. 2 Agenda Introduction to the BEST IR Sensor Sensor Applications 1. Object Detection 2. Line Detection

28

Simulink Example 5

Sequencing Commands

Page 29: Infrared Sensor and Autonomy Programming Using Simulink ...€¦ · By Jose Avendano. 2 Agenda Introduction to the BEST IR Sensor Sensor Applications 1. Object Detection 2. Line Detection

29

MathWorks Student Competitions

Mobile Robotics Tutorials

▪ Control of robot motion

▪ PID Controllers

▪ Line Following

▪ Obstacle Detection

▪ Path Navigation

Page 30: Infrared Sensor and Autonomy Programming Using Simulink ...€¦ · By Jose Avendano. 2 Agenda Introduction to the BEST IR Sensor Sensor Applications 1. Object Detection 2. Line Detection

30

Robot Autonomy and Control Webinar

▪ Intro to Robot Autonomy

▪ Motion Control

▪ Using VEX Sensors

▪ Control Algorithms

▪ Navigation Logic/State-Machines

▪ PID Control implementations