Robotics Finish presentations Bluetooth Communications Brain storm project ideas Programming...

21
Robotics Finish presentations Bluetooth Communications Brain storm project ideas Programming considerations Homework: Prepare to present proposal for building project

Transcript of Robotics Finish presentations Bluetooth Communications Brain storm project ideas Programming...

Page 1: Robotics Finish presentations Bluetooth Communications Brain storm project ideas Programming considerations Homework: Prepare to present proposal for building.

Robotics

Finish presentationsBluetooth CommunicationsBrain storm project ideas

Programming considerationsHomework:

Prepare to present proposal for building project

Page 2: Robotics Finish presentations Bluetooth Communications Brain storm project ideas Programming considerations Homework: Prepare to present proposal for building.

General comments on presentation

• Good!– and why not—you chose the topic and

enthusiasm/interest is most important ingredient

• Do always consider definitions & context:– opposing views– time line– compared to what

• Follow directions!– 1 pager. Post proposal. Be on time.– There are times/situations when it is appropriate to

break the rules. This wasn't one of them.

Page 3: Robotics Finish presentations Bluetooth Communications Brain storm project ideas Programming considerations Homework: Prepare to present proposal for building.

General communications

• Protocols (Bluetooth is a protocol) work in specific ways– handshaking, polling, timing

• Messages may not get through

• BT checks for messages of a certain data type

• ….

Page 4: Robotics Finish presentations Bluetooth Communications Brain storm project ideas Programming considerations Homework: Prepare to present proposal for building.

Good news• Bluetooth is the protocol for many

gadgets, including cell phones.– Not all BT are the same

• Some PC dongles work with NXT and some do not!

• nxtasy.org and other on-line groups are very responsive– I posed a problem and get responses

• One person said it couldn’t be done• Another (Brian Davis) produced an example that

(according to him) works 80% of the time.

Page 5: Robotics Finish presentations Bluetooth Communications Brain storm project ideas Programming considerations Homework: Prepare to present proposal for building.

General NXT-G

• To get data wires into a switch clause, need to UNCLICK the flat view

• Getting (sharing) other .rbt files is possible, though tricky…– Used Brian’s GetKey– NOTE: this was just to test his code. Your

application need not use this.

Page 6: Robotics Finish presentations Bluetooth Communications Brain storm project ideas Programming considerations Homework: Prepare to present proposal for building.
Page 7: Robotics Finish presentations Bluetooth Communications Brain storm project ideas Programming considerations Homework: Prepare to present proposal for building.
Page 8: Robotics Finish presentations Bluetooth Communications Brain storm project ideas Programming considerations Homework: Prepare to present proposal for building.

Master echo idea

• Problem: how to communicate one slave to another slave

• Solution: slave sends message to the master’s mailbox: 1, 2, 3. The master passes it on to connection 1, 2, or 3.

Page 9: Robotics Finish presentations Bluetooth Communications Brain storm project ideas Programming considerations Homework: Prepare to present proposal for building.

Slave echo (test)

Note: this program, running on all 3 slave robots, is just to test the concept… and along the way demonstrates several (new to us) NXT-G features

• Random number generated to be sent• Concatenation of text• Operator presses 1 of 3 NXT buttons. This

determines the target slave.• Recipient (of passed on message) makes beep

and displays message received.

Page 10: Robotics Finish presentations Bluetooth Communications Brain storm project ideas Programming considerations Homework: Prepare to present proposal for building.

More NXT-G

• Makes use of Display mini-blocks• There also are motor and move mini-

blocks.• Mini-blocks were/are more efficient

versions of original blocks.– Should be present on the class Mindstorms.– If you have your own system, need to follow

directions to download: program for adding blocks AND this particular set.

Page 11: Robotics Finish presentations Bluetooth Communications Brain storm project ideas Programming considerations Homework: Prepare to present proposal for building.

masterecho.rbt

Page 12: Robotics Finish presentations Bluetooth Communications Brain storm project ideas Programming considerations Homework: Prepare to present proposal for building.

slaveecho.rbt

Page 13: Robotics Finish presentations Bluetooth Communications Brain storm project ideas Programming considerations Homework: Prepare to present proposal for building.

Caution

• The parallel threads may be problematic.

• NOTE: the busy-wait for message does cause action on both the master and the slaves according to information on-line…

Page 14: Robotics Finish presentations Bluetooth Communications Brain storm project ideas Programming considerations Homework: Prepare to present proposal for building.

Programming Process

• Make [small] testing programs– The slaveecho program may be bigger than

an actual use of relaying messages

• Use sounds and displays

• Using the NXT buttons for events as opposed to bumper or other sensors may be good for debugging process

Page 15: Robotics Finish presentations Bluetooth Communications Brain storm project ideas Programming considerations Homework: Prepare to present proposal for building.

Programming

• Use MyBlocks: the one great idea of programming is the concept of subroutine.

• Write comments in NXT-G files• Plan / Diagram

– Especially events triggering multi-robot action

• Memory is limited!– Remove unnecessary files. This may include sound

files used in debugging.– Look for use of move vs motor vs mini-blocks.

• Next class

Page 16: Robotics Finish presentations Bluetooth Communications Brain storm project ideas Programming considerations Homework: Prepare to present proposal for building.

MyBlock

• …programs must be stored in MyBlock folder on computer running Mindstorms

• Global variables (variables shared by calling program and the MyBlock) must be defined in both

• MyBlock can have 0, 1 or more inputs and 0, 1 or more outputs, but these must be set up in original definition.– This may lead you to use global variables!

Page 17: Robotics Finish presentations Bluetooth Communications Brain storm project ideas Programming considerations Homework: Prepare to present proposal for building.

Building project Requirements

• Make use of at least 2 if not more sensors• Cause change in the environment

– This could be ‘making’ another robot move• Can build new robot.

– NOTE: the base robot is called the Tribot– Can use on-line directions– Can use on-line programs BUT need to add/amend

them• Can be same teams or different teams.• Can be multiple robots (rather, multiple NXT

bricks)

Page 18: Robotics Finish presentations Bluetooth Communications Brain storm project ideas Programming considerations Homework: Prepare to present proposal for building.

Requirements

• Present proposal next class.• Final project:

– Demonstrate– 1 page summary, including pictures and/or

diagrams– NXT-G code must contain comments– Consider using MyBlocks– Extra credit for making video and uploading to

YouTube

Page 19: Robotics Finish presentations Bluetooth Communications Brain storm project ideas Programming considerations Homework: Prepare to present proposal for building.

Ideas?

www.nxtasy.com (see also the projects archive)

has several project ideas, including:

• more elaborate maze

• Going into 'building' and finding … something

Page 20: Robotics Finish presentations Bluetooth Communications Brain storm project ideas Programming considerations Homework: Prepare to present proposal for building.

Ideas?

mindstorms.lego.com/nxtlog

• Many projects, with photos and code– You must understand the code as well as the

rationale in the physical design.

EXTRA credit for any accepted project.

(Yes, I will change a grade if this happens after grades are submitted.)

Page 21: Robotics Finish presentations Bluetooth Communications Brain storm project ideas Programming considerations Homework: Prepare to present proposal for building.

Homework

• Postings

• Prepare proposal for building project 4/19

• Projects presented 5/7