ДО курс по робототехнике

9 апреля 2013 г.

Потеряли сантиметр? Можно сделать свой!


Start by building the Dial Remote Control.  Click the picture for building instructions.

Building Instructions


Area and Volume Calculator Programming
The Area_Vol_Calc program does a 3-step length/area/volume measurement and calculation.  Roll the wheel along the path to measure it (push down to get some traction so the wheel doesn't slip), and press the Enter button when finished to go on to the next step.
The simpler program Length_Calc does a simple length calculation only, so you can start by studying this one if you want to understand how it works. 
A complication with these programs is doing decimal calculations using only the integer numbers and "integer math" calculations available in version 1.X of the NXT programming system.  For example, there are 2.54 cm per inch, so to convert from in to cm, you could multiply by the decimal number 2.54 if decimal numbers were allowed.  So how do you do this without decimals?  Answer: cm = (in x 254) / 100.  The Area_Vol_Calcprogram shows a few other tricks, including rounding and displaying a decimal number on the screen, using only integers. 
The newer NXT-G 2.0 software supports "floating point" (non-integer decimal) numbers and calculations, which would make this much all much easier, but these programs show how to do it the "integer" way.

  • Take a guess how many gallons (or liters = cc / 1000) a box or small room could hold, then measure it and find out.  You might be off by a lot!
  • If you try to measure the inside dimensions of a box or room (rather than the outside of a box), you will find that you can't center the wheel at the beginning of the run because you can't get it far enough into the corner.  An electronic "Rolling Tape" device used by carpenters commonly includes a feature to correct for this by adding the offset from the edge of the device to the center of the wheel when doing an interior measurement.  Can you add a feature to add this in when one of the gray arrow buttons on the NXT is pressed?
  • Study the "Integer Math" calculations in the programs and learn how they work, then see if you can incorporate some math into some programs of your own.

Комментариев нет:

Отправить комментарий