Some Robotic STEM Ideas Craig Shelden [email protected] 202-251-7578 Science and Engineering Festival
Dec 16, 2015
Robot Connections with STEM
Combines disciplines• Engineering• Math• Technology• Scientific Method
Makes abstract ideas real.
3
Thoughts on Programming
Clear Problem Statement
Pseudocode Draw out what’s being attempted Words First.
Program – Test – Program – Test ---> Repeat
Value of default settings… ? Make things easier to program… Make students think through every block they program
Approaches vary with goals and Team choices
WeDo Programming
Sailor Max
Basic boat movement
Basic boat movement with sound effects
basic_boat.wedoboat_sounds.wedo
WeDo – Complex Capability with Sailor Max
storm.wedo
Motion and sound with tilt sensor
Motion and sound with tilt triggered by proximity sensor
WeDo – NXT-G ConnectionSimilar: • Syntax• Coloring• Left – to – right
program flow
NXT-G Simple Area Measurement
Given a circle… How to measure its area using a robot?
Circumference = 2πr
Area = π r2
r
Pause Here…
NXT-G Simple Area Measurement
Given a circle… How to measure its area using a robot?
Circumference = 2πr
Area = π r2
One approach might be to:• measure all the way around
the circle• calculate the radius• calculate the area
Area = C2/(4 π)
r
One Circle Measuring Solution
NXT-G Simple Area Measurement
Given a circle… How to measure its area using a robot?Other ways….
Circumference = 2πr
Area = π r2
r
Are there other ways?
NXT-G Simple Area Measurement
Given a circle… How to measure its area using a robot?Other ways….
Circumference = 2πr
Area = π r2
Cross on a diameter and determine measurement….
r
NXT-G Complex Robotic Behavior - Sumo
Consider This Program Architecture
Define Variables
Monitor Sensor # 1 Variable # 1Monitor Sensor # 2 Variable # 2
Act
Record desired data
…
Act (Values) Act
See one of the sumo programs
Subsumptive Programming Architecture
Source: Brooks: A Robust Layered Control System for a Mobile Robothttp://people.csail.mit.edu/brooks/papers/AIM-864.pdf
See one of the sumo programs
NXT-G – Data Collection and AnalysisArea Measurement
NXT-G – Data Collection and AnalysisArea Measurement
How to measure the perimeter and area of an arbitrary closed shape?
Pause Here…
NXT-G – Data Collection and AnalysisArea Measurement
How to measure the perimeter and area of an arbitrary closed shape?
Consider Descartes’ method:
Could we do this by driving a robot around the shape?
From Area the Easy Way
INSTRUCTIONS
1. Beginning with any vertex, list the coordinates of the vertices in order, moving counter-clockwise around the polygon. List the first pair again at the end.
2. Find the diagonal products from left to right.
3. Find the diagonal products from right to left.
4. Sum each column of products.5. Find their difference and divide by
2.
This is the polygon’s area.
NXT-G – Data Collection and AnalysisArea Measurement
Need to generate (x, y) pairs as the robot follows the line around…
But unlike the plotted curve, the robot does not know what the next pair will be.
Need to find a way to remember the last point and calculate the next one.
Just a little trigonometry…
and a compass.
Inspired by Area the Easy Way
(X old, Y old)
North
Distance
(X new, Y new)
Heading
ΔX
ΔY
X new = X old + ΔX
Y new = Y old + ΔY
ΔX = Dist *Sine (Hdg)
ΔY = Dist *Cosine (Hdg)
NXT-G – Data Collection and AnalysisArea Measurement
Need to generate (x, y) pairs as the robot follows the line around…
But unlike the plotted curve, the robot does not know what the next pair will be.
Need to find a way to remember the last point and calculate the next one.
Just a little trigonometry…
and a compass.
Inspired by Area the Easy Way
(X new, Y new)
Distance
(X old, Y old)
North
Heading
ΔX
ΔY
X new = X old + ΔX
Y new = Y old + ΔY
ΔX = Dist *Sine (Hdg)
ΔY = Dist *Cosine (Hdg)
Sine and cosine provide positive and negative factors that scale the sides of the right triangle.
NXT-G – Data Collection and AnalysisArea Measurement
Show development of the path as the robot follows along the orange curve.
Inspired by Area the Easy Way
X new = X old + ΔX
Y new = Y old + ΔY
ΔX = Dist *Sine (Hdg)
ΔY = Dist *Cosine (Hdg)
Sine and cosine provide positive and negative factors that scale the sides of the right triangle.
NXT-G – Data Collection and AnalysisArea Measurement
Show development of the path as the robot follows along the orange curve.
Inspired by Area the Easy Way
X new = X old + ΔX
Y new = Y old + ΔY
ΔX = Dist *Sine (Hdg)
ΔY = Dist *Cosine (Hdg)
Sine and cosine provide positive and negative factors that scale the sides of the right triangle.
ΔX
ΔY
(X1, Y1)
(X0, Y0)
North
ΔX
ΔY
(X2, Y2)
NXT-G – Data Collection and AnalysisArea Measurement
Example path showing generated (x, y) pairs as the robot follows the line around.
Inspired by Area the Easy Way
X new = X old + ΔX
Y new = Y old + ΔY
ΔX = Dist *Sine (Hdg)
ΔY = Dist *Cosine (Hdg)
Sine and cosine provide positive and negative factors that scale the sides of the right triangle.
(X1, Y1)
(X0, Y0)
North
ΔX
ΔY
(X2, Y2)
(X3, Y3) (X4, Y4)
(X5, Y5)
NXT-G – Data Collection and AnalysisArea Measurement
Example path showing generated (x, y) pairs as the robot follows the line around.
Inspired by Area the Easy Way
X new = X old + ΔX
Y new = Y old + ΔY
ΔX = Dist *Sine (Hdg)
ΔY = Dist *Cosine (Hdg)
Sine and cosine provide positive and negative factors that scale the sides of the right triangle.
NXT-G – Data Collection and AnalysisArea Measurement – two plots
Circle with Distance = 1 inch
Inspired by Area the Easy Way
Rectangle with Distance = 1 inch
NXT-G – Data Collection and AnalysisArea Measurement – two plots
Circle with Distance = 1 inch
Inspired by Area the Easy Way
Rectangle with Distance = 1 inch
Red arrows indicate error accumulated through each run.
Mapping with More Sensors
Mapping with More Sensors
NXT-G – Data Collection and AnalysisPendulum Motion
30
Data Logging
See Pendulum Program pendulum.rbtx
Application• Measuring period of a pendulum
common exercise for students
• Period = 2π √(L/g)
84 ½ inches 12 ½ inches
Pendulum Data
84 ½ inches
Ultrasonic sensor
Pendulum Data
84 ½ inches
Ultrasonic sensor
Pendulum Data
84 ½ inches
Light sensor
Pendulum Data
84 ½ inches
Light sensor
Pendulum Data
84 ½ inches
Acceleration sensor
Pendulum Data
84 ½ inches
Acceleration sensor
Pendulum Relationships
Pendulum Relationships
Maximum Negative Acceleration
Maximum Light
Minimum Ultrasonic Range
40
Math Excursion
See Pendulum Program pendulum.rbtx
Lower the sample Frequency to
Something near thePendulum period.
41
Simple Data Logging
See Pendulum Program pendulum.rbtx
50
Thoughts on Programming
Clear Problem Statement
Pseudocode Draw out what’s being attempted Words First.
Program – Test – Program – Test ---> Repeat
Value of default settings… ? Make things easier to program… Make students think through every block they program
Approaches vary with goals and Team choices
Robot Connections with STEM
Combines disciplines• Engineering• Math• Technology• Scientific Method
Makes abstract ideas real.