Mrs. B's Disclaimer:

Mrs. B does not manage the entire Internet. :) Please view these links with your parents.

Tuesday, December 13, 2011

Why learn MATH?
“Why do I need to know fractions? Square roots? Algebra or geometry? I mean, why do we ever even need them in real life? I am never going to be a mathematician, and I hate math. So why do I have to learn this?”

Unfortunately, because of the way math is usually taught, this is the attitude of a lot of otherwise intelligent people.

Did you ever wonder why almost nobody says, “Why do I have to learn how to read? I am not going to be a writer or a teacher.” Almost no one says, “Why do I have to learn how to walk? I am not going to be a hiker or an athlete.” Wouldn’t it sound silly if someone said that? Yet it makes as much sense as the argument against learning math.

You don’t learn to read so that you can just read schoolbooks. Reading is a tool to gather information. That information may help you learn material, it may entertain you,it may open your mind to new Ideas, it may change your life.
The same goes for walking. You walk to get somewhere. To go and experience things. When you learned to walk, you were (luckily) too young to have negative feelings towards learning. Otherwise you might have said, “What the heck do I want to walk to Daddy for? He can already walk, let him walk to me!”
Now that you are older, you know that it wasn’t just about walking to Daddy. It was the beginning steps to get you to be able to walk anywhere you want and get to new experiences. You don’t have to be a hiker to know the value you get from walking.

Walking and reading are more basic things than most of the math you may learn in school. They are easy. But walking is easier than reading, yet you didn’t stop there; you did learn how to read.  Why are so many people then, satisfied with stopping at something as simple as reading, and then being beaten so easily by math?
One reason may be because it is not so easily apparent that math and critical thinking have as many payoffs as walking and reading. One of the main payoffs is that it helps you to understand patterns in life and use them in ways you never have before.  But it is not apparent and it is not likely for you to realize the payoff until many many years later, not unlike teenagers would not appreciate parenting until they are parents themselves.

If you can ask a person, “Do you respect your mind? Are you curious about your world?” and he says “yes”, he’s just answered the question about why he should learn math. If he says, “no,” then the problem isn’t math, is it?

- Copied and edited from an article in Math Mojo Chronicles.  http://www.mathmojo.com/chronicles/2007/08/06/why-shuld-we-learn-math/

Sunday, October 30, 2011

Using "My Block" in Mindstorms NXT-G Programming

There are many reasons why one may want to use "My Block" in NXT-G Programming.  I will only discuss the writing of My Block for the purpose of streamlining/modularizing the program.  With the use of My Block for a group of blocks that are intended for a specific task, it may be possible to have a complete program fit in one page on screen, with each My Block being an individual page.


For FLL competition where the team jointly work on programming, the ease of program distribution is very important.  Without knowing how to save "My Block" inside the main program, the distribution of program can be a nightmare.

When a "My Block" is created, the "My Block.RBT" is saved in a default directory, usually as "...\My Documents\LEGO Creations\MINDSTORMS Projects\Profiles\Default\Blocks\My Blocks".  This is usually different from your working directory where you save your main program.  If you simply save your main program and distribute it, the other user will get a "Broken My Block" (see picture below.)



Note: An NXT-G program that contains a use of a My Block (an instance of a My Block inserted from the Custom Palette) does not actually store the contents My Block inside the main program file. Instead, the program contains only a reference to the My Block, which is essentially the name of the My Block along with some information about where the block came from.

To save your program with My Block altogether, do the following.  Select "Tools - Create Pack and Go" from the top menu bar.  This will generate an .RBTX file format which allows you to share the complete program (with My Block files).

Important Note!!!  If you have an earlier version of .RBTX and you have since modified your program (either My_Block.RBT or Main_Program.RBT), do NOT select "overwrite" when you open the earlier version of .RBTX.  If you select "overwrite", your updated "My_Block.RBT" will be lost.  I recommend that you save both .RBTX (by Creating Pack and Go) and .RBT (by save) each time you modify your programs.


Note:  The Create Pack and Go feature is not available on versions of the NXT software prior to NXT 2.0, and the Pack and Go file storage format (.rbtx) is not readable by earlier versions either.  If you save a program in this format, it will not be directly readable by users with the NXT 1.X software or the “NXT-G 2.0” software from LEGO Education.
 

For (lots) more information about My Block, please see the NXTPrograms page

Logging Data in Mindstorms NXT-G Program

In most situations where the robot does not perform as you expect it to, writing a test program to isolate and execute only the part in question would be a good way to debug your program.  In some cases, you can also monitor the robot sensor reading and/or other internal variables from the NXT view window and/or your laptop if the USB cable is connected.  However, if the reading is dynamic and the change is faster than your eyes can read, you would need to log your data.

Data Logging is a very good way to debug your software.  However, you should keep in mind that with NXT writing information to its memory, the data log block does take time and it may slow down the program execution just a tiny bit. 

A good example of data logging with NXT-G is shown in the figure above and its detailed description can be found in
http://thenxtstep.blogspot.com/2007/09/datalogging-with-nxt-g.html

Other data logging information can be found in

http://www.teamhassenplug.org/NXT/DataLogging/Beginning_Datalogging.htm

Note that the Education Version of NXT-G 2.0 offers a new and improved Data Logging Block.  However, most of us have the commercial NXT-G 2.0 software.  If you do have the Educational Version, you can read the link below about how to use the Data Logging Block.
http://thenxtstep.blogspot.com/2009/02/nxt-g-20-datalogging.html

Monday, October 24, 2011

Light and Color Sensors Calibration


The light sensor reads light intensity and its raw value reading ranges from 0 to 1023.  By using the Calibration Tool for light sensor that's built in in Mindstorm NXT-G software, one can NORMALIZE the light intensity reading to range between 0 and 100.  You want to calibrate the light sensor because
1)It is easier to work with a number between 0 and 100.
2)During the calibration, you already tell NXT brick/brain about the MINIMUM, i.e. the darkest black, you can find on the mat, and the MAXIMUM, i.e., the brightest white you can find.  So the NXT brick/brain doesn't need to worry about any raw value reading that's beyond the minimum and maximum.  This allow you to work with a better resolution.  That is, it allows you to read the different grey area, say, from 1 to 99.


The calibration procedure is best explain in this Millerbots instruction video


As for the color sensor, the Mindstorm NXT-G software does not have an equivalent calibration software for it.  Moreover, there is no proper built-in viewer to read the color sensor reading from the small viewing window of NXT brick.  I recommend reading the light intensity reading of a color sensor directly from the laptop, as explained in this video.  And I recommend a manual "calibration" procedure as below.  You place the robot/color sensor on the darkest black, make a note of the laptop reading.  This will be your manual minimum value.  Then you place the robot/color sensor on the brightest white, make a note of the laptop reading.  This will be your manual maximum value.  Therefore, if you need a threshold for line following, it can be the average of the two values.

P.S. I have found the line following performance using either a calibrated light and color sensor is about the same.