sentry system two-way communication

19
© 2006 Carnegie Mellon Robotics Academy Designed for use with the LEGO MINDSTORMS ® Education NXT Software and Base Set #9797 Sentry System Two-Way Communication See Teacher Guide for printing instructions

Upload: gabriel-puckett

Post on 03-Jan-2016

19 views

Category:

Documents


1 download

DESCRIPTION

Sentry System Two-Way Communication. See Teacher Guide for printing instructions. Opening Activity. List 10 different forms of communication, and determine whether they are one-way or two-way in nature. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Sentry System Two-Way Communication

© 2006 Carnegie Mellon Robotics AcademyDesigned for use with the LEGO MINDSTORMS® Education NXT Software and Base Set #9797

Sentry SystemTwo-Way Communication

See Teacher Guide for printing instructions

Page 2: Sentry System Two-Way Communication

© 2006 Carnegie Mellon Robotics AcademyDesigned for use with the LEGO MINDSTORMS® Education NXT Software and Base Set #9797

Opening Activity

List 10 different forms of communication, and determine whether they are one-way or two-way in nature.

• Example: Television is one-way, because the signal only travels from the station to your TV; you can’t send signals back to the TV station

Page 3: Sentry System Two-Way Communication

© 2006 Carnegie Mellon Robotics AcademyDesigned for use with the LEGO MINDSTORMS® Education NXT Software and Base Set #9797

Opening Activity

•Public speech (one-way)•Pager (one-way)•Radio broadcast (one-way)•PA system (one-way)•Remote control (one-way)•Siren (one-way)•Computer monitor (one-way)•Print media (one-way)•Website (one-way)

List 10 different forms of communication, and determine whether they are one-way or two-way in nature.

•Conversation (two-way)•Telephone (two-way)•Text messaging/IM (two-way)•Postal mail (slow two-way)•E-mail (slow two-way)•Touchscreen monitor (two-way)•Message board (two-way)•Sign language (two-way)•Weblog/Blog (two-way)

Page 4: Sentry System Two-Way Communication

© 2006 Carnegie Mellon Robotics AcademyDesigned for use with the LEGO MINDSTORMS® Education NXT Software and Base Set #9797

Opening Activity

• One-way communication(sentry to monitor station)

OR

• Two-way communication(sentry to sentry)

A critical decision: Will your sentry system use…

Page 5: Sentry System Two-Way Communication

© 2006 Carnegie Mellon Robotics AcademyDesigned for use with the LEGO MINDSTORMS® Education NXT Software and Base Set #9797

One-Way Communication• Advantages

– Dedicated functionality of sentry vs. monitor station

– Simpler programming

– No need to add sensors to the Monitor NXT

• Disadvantages

– Only half as many robots actually watching the assigned area

– System more dependent on human assistance

Sentry and MonitorIn the One-Way Communication system,the sentry watches and the monitor alerts

a human guard if the sentry spots anything

Page 6: Sentry System Two-Way Communication

© 2006 Carnegie Mellon Robotics AcademyDesigned for use with the LEGO MINDSTORMS® Education NXT Software and Base Set #9797

Two-Way Communication

• Advantages

– Two sentries can cover more area

– Possibilities for coordinated response to complex threats

• Disadvantages

– No immediate feedback given to human guard (would take a third NXT)

– More complex reactions require more complex programming

Dual Sentry SystemIn the Two-Way Communication system,

two robotic sentries communicatedirectly with each other to watch for and

respond to any problems detected

Page 7: Sentry System Two-Way Communication

© 2006 Carnegie Mellon Robotics AcademyDesigned for use with the LEGO MINDSTORMS® Education NXT Software and Base Set #9797

One-Way or Two-Way?

Make your decision now with your group

Page 8: Sentry System Two-Way Communication

© 2006 Carnegie Mellon Robotics AcademyDesigned for use with the LEGO MINDSTORMS® Education NXT Software and Base Set #9797

Investigation Path (b)

• This version of Investigation 2 is for groups that have chosen a Two-Way Communication Sentry System

• Groups that chose a One-Way system should use Investigation 2a instead

Page 9: Sentry System Two-Way Communication

© 2006 Carnegie Mellon Robotics AcademyDesigned for use with the LEGO MINDSTORMS® Education NXT Software and Base Set #9797

Logistics

• You will pair with another group for this Engineering Project

• Both groups will develop their own sentries

• The two sentries must communicate

• The two groups will remain separate, but plan and coordinate communication issues

Two of a… Kind OfThe two robots in the system willfunction both independently andin conjunction with each other

Page 10: Sentry System Two-Way Communication

© 2006 Carnegie Mellon Robotics AcademyDesigned for use with the LEGO MINDSTORMS® Education NXT Software and Base Set #9797

Two-way Communication:Technical Review

Data Hubs & Wires

Bluetooth Send & Receive

Value Switch

Non-Flat View Switches

“Message Received” and Empty Mailboxes

Loops

Page 11: Sentry System Two-Way Communication

© 2006 Carnegie Mellon Robotics AcademyDesigned for use with the LEGO MINDSTORMS® Education NXT Software and Base Set #9797

Data Hubs & WiresMany blocks have data hubs which can be opened by clicking the notch in the lower-left corner of the block.

A data hub contains many data plugs, which allow information to flow in and out of the block.

Data wires control the flow of data between blocks.

Output plugs typically send out a sensor value, or the result of a computation.

Such information usually goes into another block’s input plug, allowing the reading or result to be used as a value inside the block. Speed Controlled by Sensor

Ultrasonic Sensor distance output plug controlsthe value of the Move Block’s power setting

Page 12: Sentry System Two-Way Communication

© 2006 Carnegie Mellon Robotics AcademyDesigned for use with the LEGO MINDSTORMS® Education NXT Software and Base Set #9797

Bluetooth: Send Message

The Send Message and Receive Message blocks work together to allow information to get from one NXT to another.

Using Bluetooth in a program requires two NXTs connected in advance.

The Send Message block is used to send data from the NXT where it is run, over a specified Connection Number, and places it in a mailbox (also specified in the Send block) on the destination NXT.

Send Ultrasonic Sensor ValueThe Ultrasonic sensor value is read (once) andsent into Mailbox 1 on the NXT on the other end

of Connection Number 1. We assume theConnection has been set up before running.

More information about Bluetooth Messages can be found inAdvanced > Bluetooth > Sending and Receiving Messages

Page 13: Sentry System Two-Way Communication

© 2006 Carnegie Mellon Robotics AcademyDesigned for use with the LEGO MINDSTORMS® Education NXT Software and Base Set #9797

Bluetooth: Receive Message

The Send Message and Receive Message blocks work together to allow information to get from one NXT to another.

Using Bluetooth in a program requires two NXTs connected in advance.

The Receive Message block retrieves a message from a specified mailbox. This also removes the message from the mailbox.

Receive and DisplayWait 3 seconds to give time for a message to arrive,

then display the value of the Number message inMailbox 1 on the NXT’s view screen for 5 seconds

More information about Bluetooth Messages can be found inAdvanced > Bluetooth > Sending and Receiving Messages

Page 14: Sentry System Two-Way Communication

© 2006 Carnegie Mellon Robotics AcademyDesigned for use with the LEGO MINDSTORMS® Education NXT Software and Base Set #9797

Switch Block: Flat ViewSwitch blocks allow the program to observe a value, and choose between different paths of code to follow, based on the observed value.

Most Switch blocks use a simple two-possibility approach to decision making, but some situations require the Switch to be able to discern more than two possibilities.

Unchecking the Flat View box in the configuration panel allows you to add and check additional possibilities for Number and Text Value Switches.

The tabs at the top represent the areas that were previously top and bottom, as well as any additional options.

The World is FlatFlat View (top) shows two possible paths

at once, while Tabbed View (bottom) showsonly one at a time. The other code paths are

accessible by clicking on the other tabs.

Page 15: Sentry System Two-Way Communication

© 2006 Carnegie Mellon Robotics AcademyDesigned for use with the LEGO MINDSTORMS® Education NXT Software and Base Set #9797

Switch Block: Logic Value

Switch blocks allow the program to observe a value, and choose between different paths of code to follow, based on the observed value.

Value Switch Blocks expose a data input plug, which must be wired to an appropriate source in the program. The input from this plug will be used to decide which group of blocks to run.

Logic Value Switch Blocks use a Logic value to decide which blocks to run. A True value will run the top branch, while a False value will run the bottom branch.

Sight or SoundBased on the value of the Logic value coming

through the green wire, this Switch willeither play a sound (if the value is True),or show a picture (if the value is False)

Page 16: Sentry System Two-Way Communication

© 2006 Carnegie Mellon Robotics AcademyDesigned for use with the LEGO MINDSTORMS® Education NXT Software and Base Set #9797

Switch Block: Number Value

Switch blocks allow the program to observe a value, and choose between different paths of code to follow, based on the observed value.

Value Switch Blocks expose a data input plug, which must be wired to an appropriate source in the program. The input from this plug will be used to decide which group of blocks to run.

Number Value Switch Blocks use a Number value to decide which blocks to run. Numbers are specified in the configuration panel, and the input number is checked against them. An exact match will run the appropriate branch. Normally, this type of switch is used with Flat View turned off.

Three Way IntersectionBased on the value of the Logic value coming

through the green wire, this Switch willrun in a different direction. The action

corresponding to a number input of 3 is shown.

Page 17: Sentry System Two-Way Communication

© 2006 Carnegie Mellon Robotics AcademyDesigned for use with the LEGO MINDSTORMS® Education NXT Software and Base Set #9797

Message Received

Bluetooth messages are removed from their mailboxes when a Receive Message block or switch accesses them.

Repeated access of a mailbox can cause problems if a Receive block tries to read from a mailbox that has no messages in it.

The Message Received data plug on the Receive Message block allows a program to first see whether a message was present before attempting to use data from inside it.

Knock Before EnteringInstead of blindly assuming that a message was successfully retrieved,this program first checks the Message Received data plug to make sure

Page 18: Sentry System Two-Way Communication

© 2006 Carnegie Mellon Robotics AcademyDesigned for use with the LEGO MINDSTORMS® Education NXT Software and Base Set #9797

Infinite Loop

The Loop Block runs the blocks inside it over and over again, until a certain stopping condition is met.

The infinite loop or “forever” loop has no stopping condition, and therefore will repeat the blocks inside over and over, forever.

Back and ForthThe loop causes the robot to repeat the

forward-then-back motion forever

Page 19: Sentry System Two-Way Communication

© 2006 Carnegie Mellon Robotics AcademyDesigned for use with the LEGO MINDSTORMS® Education NXT Software and Base Set #9797

• One important choice in your system design will be whether to use a Sentry + Monitor system, or two sentries

• Follow the (b) path investigations in this project if you have chosen to have two active sentries in your system

Summary

• You must connect two NXTs using the Bluetooth menus before you can use Send and Receive blocks in your programs

• Both sentries will run programs with both Send Message and Receive Message blocks to check the data

• See the Advanced > Bluetooth section for more information

• Extra caution must be taken not to accidentally try to read from an empty mailbox