13
Robotics Catchup/Review: switch, arithmetic, range, loop Bluetooth Lab: Finish parallel parking. Next: Use Bluetooth communication for calculate & send location exercise.

Robotics

Embed Size (px)

DESCRIPTION

Robotics. Catchup/Review: switch, arithmetic, range, loop Bluetooth Lab: Finish parallel parking. Next: Use Bluetooth communication for calculate & send location exercise. Review NXT-G. Switch block Arithmetic block Two operands or operand & constant Range Inside or outside - PowerPoint PPT Presentation

Citation preview

Page 1: Robotics

Robotics

Catchup/Review: switch, arithmetic, range, loopBluetooth

Lab: Finish parallel parking. Next: Use Bluetooth communication for calculate

& send location exercise.

Page 2: Robotics

Review NXT-G

• Switch block

• Arithmetic block– Two operands or operand & constant

• Range– Inside or outside– Data wires or constants

• Loop– Infinite, counter, logic

Page 3: Robotics

More NXT-G

• Check out the random block to produce random number: Complete palette, DICE icon, you can set min and max (or use data wires to set min and max)

• Consider using sound and then display to show the random number and make sure you include a wait (time or button push) so you can see it!

Page 4: Robotics

Bluetooth• Master / slave(s)• Need to turn off / stop PC to NXT• Master sets up connection

– Done using the NXT brick • Prior to running programs• Start off with seach/scan for devices• Choose connection number 1, 2, 3• Password exchange

• Slave NXTs will refer to Master as 0 • Slave NXTs communicate ONLY WITH

THE MASTER NXT.

Page 5: Robotics

"Relay" message system

• For 3-robot relay, make the master the middle robot on the team.– Robot A starts. Sends message to master using

connection 0– Robot B, the master, receives the message. Then

sends message to Robot C using 1 or 2.

• For 4-robot relay, set up Robot B (master) to wait for messages on 2 mailboxes (use parallel beams), when it receives a message from Robot C, it sends a message to Robot D.

Page 6: Robotics

Connection procedure• Turn on both NXT bricks• On master, use buttons to get to Bluetooth

search (magnifier with bluetooth symbol)– Will say searching … and then stop, will have

symbols for found Bluetooth devices.OTHER NXT BRICKS WILL APPEAR BY NAME

– Click on the specific brick to make connectionClick again on number (1, 2, or 3). Symbol with name will now show up at number.ON OTHER BRICK, go to Bluetooth connections. The master should show up as 0.

– NOTE: first time (and maybe other times), there will be request for password: DON’T CHANGE FROM 1234

Page 7: Robotics

Bluetooth send

• Sends message to – Connection number 0, 1, 2, 3

• Think of this as address

– Mailbox• 10 mailboxes, • Each can hold 5 messages. Oldest gets erased

if/when 6th message sent.

• Message is specific data type– Text, number, logic

Page 8: Robotics

Bluetooth receive

• Receive block does NOT specify connection! This NXT bricks receives at/on its own address.

• Receive block does specify mailbox• Prior agreement on the datatype expected.• Use receive message block in loop

– Can output message using appropriate data wire hub.

• If you know what a message will be, can use Wait for specific message in mailbox

Page 9: Robotics

Slave to master

Page 10: Robotics
Page 11: Robotics

Lab

• Use brick / tribot furnished by Glenn and Kyle to receive messages and send messages. You need to– check program on these bricks– do initial handshake– Think about which program to start first.

Page 12: Robotics

Lab, cont.

• Use Bluetooth to send ‘discovered’ information – Send (logic) message when one robot

reaches wall– Send message with position information on

wall

Page 13: Robotics

Homework

• Make posting on library research project!– start work

• Plan another / more BT applications