210 likes | 563 Views
Robotics. Finish presentations Bluetooth Communications Brain storm project ideas Programming considerations Homework: Prepare to present proposal for building project. General comments on presentation. Good!
E N D
Robotics Finish presentations Bluetooth Communications Brain storm project ideasProgramming considerationsHomework: Prepare to present proposal for building project
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.
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 • ….
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.
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.
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.
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.
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.
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…
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
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
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!
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)
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
Ideas? www.nxtasy.com (see also the projects archive) has several project ideas, including: • more elaborate maze • Going into 'building' and finding … something
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.)
Homework • Postings • Prepare proposal for building project 4/19 • Projects presented 5/7