# Science and Engineering Festival Some Robotic STEM Ideas

## Presentation on theme: "Science and Engineering Festival Some Robotic STEM Ideas"— Presentation transcript:

Science and Engineering Festival Some Robotic STEM Ideas
Craig Shelden

Robot Connections with STEM
Combines disciplines Engineering Math Technology Scientific Method Makes abstract ideas real.

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.wedo boat_sounds.wedo

WeDo – Complex Capability with Sailor Max
Motion and sound with tilt sensor Motion and sound with tilt triggered by proximity sensor storm.wedo

WeDo – NXT-G Connection
Similar: 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 # 1 Monitor Sensor # 2  Variable # 2 Act Act (Values) Act Record desired data See one of the sumo programs

Subsumptive Programming Architecture
See one of the sumo programs Source: Brooks: A Robust Layered Control System for a Mobile Robot

NXT-G – Data Collection and Analysis Area Measurement

NXT-G – Data Collection and Analysis Area Measurement
How to measure the perimeter and area of an arbitrary closed shape? Pause Here…

NXT-G – Data Collection and Analysis Area Measurement
How to measure the perimeter and area of an arbitrary closed shape? Consider Descartes’ method: INSTRUCTIONS 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. Find the diagonal products from left to right. Find the diagonal products from right to left. Sum each column of products. Find their difference and divide by 2. This is the polygon’s area. Could we do this by driving a robot around the shape? From Area the Easy Way

NXT-G – Data Collection and Analysis Area Measurement
X new = X old + ΔX Y new = Y old + ΔY 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. (X old, Y old) North Distance (X new, Y new) Heading ΔX ΔY ΔX = Dist *Sine (Hdg) ΔY = Dist *Cosine (Hdg) Inspired by Area the Easy Way

NXT-G – Data Collection and Analysis Area Measurement
X new = X old + ΔX Y new = Y old + ΔY 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. Distance (X old, Y old) North Heading ΔX ΔY (X new, Y new) ΔX = Dist *Sine (Hdg) ΔY = Dist *Cosine (Hdg) Sine and cosine provide positive and negative factors that scale the sides of the right triangle. Inspired by Area the Easy Way

NXT-G – Data Collection and Analysis Area Measurement
Show development of the path as the robot follows along the orange curve. 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. Inspired by Area the Easy Way

NXT-G – Data Collection and Analysis Area Measurement
Show development of the path as the robot follows along the orange curve. X new = X old + ΔX Y new = Y old + ΔY ΔX = Dist *Sine (Hdg) ΔY = Dist *Cosine (Hdg) ΔY ΔX Sine and cosine provide positive and negative factors that scale the sides of the right triangle. Inspired by Area the Easy Way

NXT-G – Data Collection and Analysis Area Measurement
Example path showing generated (x, y) pairs as the robot follows the line around. X new = X old + ΔX Y new = Y old + ΔY North ΔX = Dist *Sine (Hdg) ΔY = Dist *Cosine (Hdg) (X2, Y2) (X1, Y1) ΔY (X0, Y0) ΔX Sine and cosine provide positive and negative factors that scale the sides of the right triangle. Inspired by Area the Easy Way

NXT-G – Data Collection and Analysis Area Measurement
Example path showing generated (x, y) pairs as the robot follows the line around. X new = X old + ΔX Y new = Y old + ΔY North ΔX = Dist *Sine (Hdg) ΔY = Dist *Cosine (Hdg) (X2, Y2) (X5, Y5) (X1, Y1) ΔY (X3, Y3) (X4, Y4) (X0, Y0) ΔX Sine and cosine provide positive and negative factors that scale the sides of the right triangle. Inspired by Area the Easy Way

NXT-G – Data Collection and Analysis Area Measurement – two plots
(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) Rectangle with Distance = 1 inch Circle with Distance = 1 inch Inspired by Area the Easy Way

NXT-G – Data Collection and Analysis Area Measurement – two plots
Rectangle with Distance = 1 inch Circle with Distance = 1 inch Red arrows indicate error accumulated through each run. Inspired by Area the Easy Way

Mapping with More Sensors

Mapping with More Sensors

NXT-G – Data Collection and Analysis Pendulum Motion

Data Logging See Pendulum Program pendulum.rbtx

Application Measuring period of a pendulum common exercise for students Period = 2π √(L/g) Exercise taken from Physics with Robotics by William Church, Tony Ford, and Natasha Perova. Section 4.6 Swinging with Gravity 12 ½ inches 84 ½ inches

Pendulum Data 84 ½ inches Ultrasonic sensor
Exercise taken from Physics with Robotics by William Church, Tony Ford, and Natasha Perova. Section 4.6 Swinging with Gravity

Pendulum Data 84 ½ inches Ultrasonic sensor
Exercise taken from Physics with Robotics by William Church, Tony Ford, and Natasha Perova. Section 4.6 Swinging with Gravity

Pendulum Data 84 ½ inches Light sensor
Exercise taken from Physics with Robotics by William Church, Tony Ford, and Natasha Perova. Section 4.6 Swinging with Gravity

Pendulum Data 84 ½ inches Light sensor
Exercise taken from Physics with Robotics by William Church, Tony Ford, and Natasha Perova. Section 4.6 Swinging with Gravity Light sensor

Pendulum Data 84 ½ inches Acceleration sensor
Exercise taken from Physics with Robotics by William Church, Tony Ford, and Natasha Perova. Section 4.6 Swinging with Gravity The Acceleration sensor block measures the three axes of acceleration, x, y and z. It returns the readings as signed values ranging from -400 to +400 thus the scale factor is approximately 200 counts per g, so the sensor can measure +/- 2g. Using data wires, it can send out the x, y and z values and a logic signal (true/false) based on whether the x value is above or below a trigger value.

Pendulum Data 84 ½ inches Acceleration sensor
Exercise taken from Physics with Robotics by William Church, Tony Ford, and Natasha Perova. Section 4.6 Swinging with Gravity The Acceleration sensor block measures the three axes of acceleration, x, y and z. It returns the readings as signed values ranging from -400 to +400 thus the scale factor is approximately 200 counts per g, so the sensor can measure +/- 2g. Using data wires, it can send out the x, y and z values and a logic signal (true/false) based on whether the x value is above or below a trigger value.

Pendulum Relationships
Exercise taken from Physics with Robotics by William Church, Tony Ford, and Natasha Perova. Section 4.6 Swinging with Gravity The Acceleration sensor block measures the three axes of acceleration, x, y and z. It returns the readings as signed values ranging from -400 to +400 thus the scale factor is approximately 200 counts per g, so the sensor can measure +/- 2g. Using data wires, it can send out the x, y and z values and a logic signal (true/false) based on whether the x value is above or below a trigger value.

Pendulum Relationships
Maximum Light Maximum Negative Acceleration Minimum Ultrasonic Range Exercise taken from Physics with Robotics by William Church, Tony Ford, and Natasha Perova. Section 4.6 Swinging with Gravity The Acceleration sensor block measures the three axes of acceleration, x, y and z. It returns the readings as signed values ranging from -400 to +400 thus the scale factor is approximately 200 counts per g, so the sensor can measure +/- 2g. Using data wires, it can send out the x, y and z values and a logic signal (true/false) based on whether the x value is above or below a trigger value.

Math Excursion See Pendulum Program pendulum.rbtx Lower the sample
Frequency to Something near the Pendulum period. See Pendulum Program pendulum.rbtx

Simple Data Logging See Pendulum Program pendulum.rbtx

Not So Automatic Data Logging
Limitations on data logging… No way to automatically log variable values Not all sensor vendors supply data logging capabilities Log only four sensors Use Variables See Heading Log Program heading_log.rbtx See Data Collecting MyBlocks data_logging_myblocks.rbtx

Variables Much of the programming power comes from the ability to
read values store values, change values, and act based on values. Three types: Number – How much? Text – Say What? Logical – True or False?

Consider This Program Architecture
Define Variables Monitor Sensor # 1  Variable # 1 Monitor Sensor # 2  Variable # 2 Act Act (Values) Act Record desired data

Two myBlocks for Data Logging
Technique to log data described in Terry Griffin’s book The Art of LEGO MINDSTORMS NXT-G Programming

Data Consolidation

Sample Data Logging Program
Bang_Bang_multilogger_display.rbtx See: \data\line_data folder

Not So Automatic Data Logging
Technique to log data described in Terry Griffin’s book The Art of LEGO MINDSTORMS NXT-G Programming

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.

Some Robotic STEM Ideas
Science and Engineering Festival Some Robotic STEM Ideas Craig Shelden