elegant avoiding of obstacle

40
HelloApps.com Elegant avoiding of obstacle Young Joon Kim http://www.helloapps.com MSRDS First Beginner Course – STEP5

Upload: merritt-estes

Post on 02-Jan-2016

33 views

Category:

Documents


0 download

DESCRIPTION

Elegant avoiding of obstacle. MSRDS First Beginner Course – STEP5. Young Joon Kim http://www.helloapps.com. Topics. Preparing basic environment Detecting distance by using laser distance sensor Stopping robot driving Avoiding obstacles. Preparing basic environment. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Elegant avoiding of obstacle

HelloApps.com

Elegant avoiding of obstacle

Young Joon Kimhttp://www.helloapps.com

MSRDS First Beginner Course – STEP5

Page 2: Elegant avoiding of obstacle

HelloApps.com 2

Topics

• Preparing basic environment

• Detecting distance by using laser distance sensor

• Stopping robot driving

• Avoiding obstacles

Page 3: Elegant avoiding of obstacle

HelloApps.com 3

Preparing basic environment

Page 4: Elegant avoiding of obstacle

HelloApps.com 4

Preparing basic environment

• Add a “Data” activity and “SPL Engine”

• Type “Script/BasicEnv4.txt” in the “Data” activity

Page 5: Elegant avoiding of obstacle

HelloApps.com 5

Preparing basic environment

• Execution result

Page 6: Elegant avoiding of obstacle

HelloApps.com 6

Detecting distance

by using laser distance sensor

Page 7: Elegant avoiding of obstacle

HelloApps.com 7

• Laser distance sensor

– Detect distance against target

– Notify distance with millimeter unit

– Max distance is 8000 millimeter

• SPL Engine provides notification data for laser sensor

– LRFNotify

• EntityName

• SensorData

– DistanceMeasurements

Detecting distance by using laser sensor

Page 8: Elegant avoiding of obstacle

HelloApps.com 8

• Copy and paste “SPL Engine” service

Detecting distance by using laser sensor

1

2

Copy by pressingCtrl+C

Paste by pressingCtrl+V

Page 9: Elegant avoiding of obstacle

HelloApps.com 9

• Add a “HelloApps Console” service

Detecting distance by using laser sensor

Page 10: Elegant avoiding of obstacle

HelloApps.com 10

• Add a “Calculate” activity

Detecting distance by using laser sensor

Page 11: Elegant avoiding of obstacle

HelloApps.com 11

• Connect the notification point of “SPL Engine” to the input

point of “Calculate” activity

Detecting distance by using laser sensor

Page 12: Elegant avoiding of obstacle

HelloApps.com 12

Detecting distance by using laser sensor

• Select “LRFNotify” item from the left list

Page 13: Elegant avoiding of obstacle

HelloApps.com 13

Detecting distance by using laser sensor

• Type ““Distance is “ +” in the Calculate

• Select “SensorData” from the list

Page 14: Elegant avoiding of obstacle

HelloApps.com 14

Detecting distance by using laser sensor

• Add “.”

• Select “DistanceMeasurements” item from the list

Page 15: Elegant avoiding of obstacle

HelloApps.com 15

Detecting distance by using laser sensor

• Add “[180]”

– “Distance is “ + SensorData.DistanceMeasurements[180]

Page 16: Elegant avoiding of obstacle

HelloApps.com 16

Laser Sensor Data

• DistanceMeasurements

– Array of 361 distances

For 180 angles,Detect distances by 0.5 degrees

0th index360th

180th

Millimeter unit, max distance is 8m(8000 millimeter)

90th270th

Page 17: Elegant avoiding of obstacle

HelloApps.com 17

Laser Sensor Data

• Distance for the front direction

– SensorData.DistanceMeasurements[180]

• Distance for the right 45 degrees direction

– SensorData.DistanceMeasurements[90]

• Distance for the left 45 degrees direction

– SensorData.DistanceMeasurements[270]

• Distance for the right direction

– SensorData.DistanceMeasurements[0]

• Distance for the left direction

– SensorData.DistanceMeasurements[360]

Page 18: Elegant avoiding of obstacle

HelloApps.com 18

Detecting distance by using laser sensor

• Connect the output point of “Calculate” activity to the input

point of “Console” service

Page 19: Elegant avoiding of obstacle

HelloApps.com 19

Detecting distance by using laser sensor

• Select “WriteLine” item from the right list

Page 20: Elegant avoiding of obstacle

HelloApps.com 20

Detecting distance by using laser sensor

• Select “value” item from the left list

Page 21: Elegant avoiding of obstacle

HelloApps.com 21

Detecting distance by using laser sensor

• Save and run diagram

Page 22: Elegant avoiding of obstacle

HelloApps.com 22

Detecting distance by using laser sensor

• Execution results

Page 23: Elegant avoiding of obstacle

HelloApps.com 23

Stopping robot driving

Page 24: Elegant avoiding of obstacle

HelloApps.com 24

Stopping robot driving

• If the distance from obstacle is below 1m(1000millimeter),

make a robot stop

– If (SensorData.DistanceMeasurements[180] < 1000)

• myrobot.Stop()

Page 25: Elegant avoiding of obstacle

HelloApps.com 25

Stopping robot driving

• Remove “Calculate” activity and “Console” service

Page 26: Elegant avoiding of obstacle

HelloApps.com 26

Stopping robot driving

• Add a “If” activity

Page 27: Elegant avoiding of obstacle

HelloApps.com 27

Stopping robot driving

• Connect the notification point of “SPL Engine” to the input

point of “If” activity

Page 28: Elegant avoiding of obstacle

HelloApps.com 28

Stopping robot driving

• Select “LRFNotify” item from the list

Page 29: Elegant avoiding of obstacle

HelloApps.com 29

Stopping robot driving

• Click textbox in the “If” activity

• Select “SensorData” item from the list

Page 30: Elegant avoiding of obstacle

HelloApps.com 30

Stopping robot driving

• Type “.”

• Select “DistanceMeasurements” item from the list

Page 31: Elegant avoiding of obstacle

HelloApps.com 31

Stopping robot driving

• Type “[180] < 1000”

Page 32: Elegant avoiding of obstacle

HelloApps.com 32

Stopping robot driving

• Add “Stop driving” diagram

Add diagram

Page 33: Elegant avoiding of obstacle

HelloApps.com 33

Stopping robot driving

• Connect the output point of “If” condition to the input point

of “Data” activity

Page 34: Elegant avoiding of obstacle

HelloApps.com 34

Stopping robot driving

• Save and run diagram

Page 35: Elegant avoiding of obstacle

HelloApps.com 35

Stopping robot driving

• Execution result

Stop

Page 36: Elegant avoiding of obstacle

HelloApps.com 36

Avoiding obstacles

Page 37: Elegant avoiding of obstacle

HelloApps.com 37

• Modify “Stop driving” diagram into “Turn 45 degrees”

– Turn(45, 0.2)

Avoiding obstacles

Page 38: Elegant avoiding of obstacle

HelloApps.com 38

• Add “Go forwards” diagram and connect them

– Go(0.2)

Avoiding obstacles

Page 39: Elegant avoiding of obstacle

HelloApps.com 39

Avoiding obstacles

• Save and run diagram

Page 40: Elegant avoiding of obstacle

HelloApps.com 40

Avoiding obstacles

• Execution result