Elegant avoiding of obstacle
Young Joon Kimhttp://www.helloapps.com
MSRDS First Beginner Course – STEP5
2
Topics
• Preparing basic environment
• Detecting distance by using laser distance sensor
• Stopping robot driving
• Avoiding obstacles
4
Preparing basic environment
• Add a “Data” activity and “SPL Engine”
• Type “Script/BasicEnv4.txt” in the “Data” activity
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
10
Detecting distance by using laser sensor
• Connect the notification point of “SPL Sensors” to the input
point of “Calculate” activity
12
Detecting distance by using laser sensor
• Type ““Distance is “ +” in the Calculate
• Select “SensorData” from the list
13
Detecting distance by using laser sensor
• Add “.”
• Select “DistanceMeasurements” item from the list
14
Detecting distance by using laser sensor
• Add “[180]”
– “Distance is “ + SensorData.DistanceMeasurements[180]
15
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
16
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]
18
Detecting distance by using laser sensor
• Connect the output point of “Calculate” activity to the input
point of “Console” service
24
Stopping robot driving
• If the distance from obstacle is below 1m(1000millimeter),
make a robot stop
– If (SensorData.DistanceMeasurements[180] < 1000)
• myrobot.Stop()
27
• Connect the notification point of “SPL Sensors” to the input
point of “If” activity
Stopping robot driving
29
Stopping robot driving
• Click textbox in the “If” activity
• Select “SensorData” item from the list
33
• Connect the output point of “If” condition to the input point
of “Data” activity
Stopping robot driving