210 likes | 591 Views
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.
E N D
Sentry SystemTwo-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. • 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
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) Opening Activity 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)
Opening Activity A critical decision: Will your sentry system use… • One-way communication(sentry to monitor station) OR • Two-way communication(sentry to sentry)
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 Monitor In the One-Way Communication system,the sentry watches and the monitor alertsa human guard if the sentry spots anything
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 System In the Two-Way Communication system,two robotic sentries communicatedirectly with each other to watch for andrespond to any problems detected
One-Way or Two-Way? Make your decision now with your group
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
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 Of The two robots in the system willfunction both independently andin conjunction with each other
Data Hubs & Wires Bluetooth Send & Receive Value Switch Non-Flat View Switches “Message Received” and Empty Mailboxes Loops Two-way Communication:Technical Review
Data Hubs & Wires Many 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
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 Value The Ultrasonic sensor value is read (once) andsent into Mailbox 1 on the NXT on the other endof 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
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 Display Wait 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
Switch Block: Flat View Switch 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 Flat Flat View (top) shows two possible pathsat once, while Tabbed View (bottom) showsonly one at a time. The other code paths areaccessible by clicking on the other tabs.
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 Sound Based on the value of the Logic value comingthrough the green wire, this Switch willeither play a sound (if the value is True),or show a picture (if the value is False)
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 Intersection Based on the value of the Logic value comingthrough the green wire, this Switch willrun in a different direction. The action corresponding to a number input of 3 is shown.
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 Entering Instead of blindly assuming that a message was successfully retrieved,this program first checks the Message Received data plug to make sure
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 Forth The loop causes the robot to repeat theforward-then-back motion forever
Summary • 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 • 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