Professional Documents
Culture Documents
The circumference of a circle is the length around it. The circumference of a circle can be calculated from its diameter using the formula:
where r is the radius and d is the diameter of the circle, and the Greek letter is defined as the ratio of the circumference of the circle to its diameter. The numerical value of is 3.141 592 653 589 793....
Worksheet:
Directions: Given the known values of the diameter of a Robot wheel and the distance between wheels on the Robot, calculate the degrees of rotation needed and movement block programming for the robot to complete the following moves: Given Values: Robot wheel diameter: Distance between wheels: Pi: Degrees in a Circle:
(20 cm)
Rotations * 360 =
(Degrees)
5.6 cm
(Diameter)
2. Calculate the Circumference of the big circle the robot would make if it turned all the way around in a swing turn.
3. Calculate the arc segment the robot wheel has to travel to make the swing turn:
4. Figure Out wheel rotations needed to travel arc segment: Arc Segment = Rotations Wheel Circumference
6. Decide which wheel to rotate: Turning Left -> use wheel on right side of robot Turning Right -> use wheel on left side of robot
3. Calculate the arc segment the robot wheel has to travel to make the swing turn:
4. Figure Out wheel rotations needed to travel arc segment: Arc Segment = Rotations Wheel Circumference 5. Change Rotations to Degrees for Motor Block:
Rotations * 360 =
(Degrees)
6. Decide which wheels to rotate: Turning Left -> Right wheel forward Number of Degrees, Left wheel backward Number of Degrees. Turning Right -> Left wheel forward Number of Degrees, Right wheel backward number of Degrees.
To summarize, the X/Y value of a pixel in the lower-left corner is 0/0. For the upper-right corner, the value would be 99/63. Remember, the Y value increases only as you move up the LCD screen, so the value of a pixel in the upper-left corner is 0/63, and a pixel in the lowerright corner is 99/0.
In the Operation section, there is a drop-down menu for you to select the type of operation to be performed. If you click the drop-down menu, you should see the following options:
Addition: This option will add values A and B. Subtraction: This option will subtract value B from value A. Multiplication: This option will multiply value A by value B. Division: This option will divide value A by value B. Absolute value: This option will calculate the absolute value of A. Square root: This option will calculate the square root of value A.
The MATH block uses two values: A and B. For the NXT-G 1.0 users, these values can be positive or negative integers. An integer is a whole number with no decimal values. If you attempt to enter in a number such as 4.3 or 10.8 the MATH block will round the values up or down to the nearest integer (4 and 11 for my examples). But for NXT-G 2.0 users, you are not limited to integer math. Decimal values are allowed.
The data hub on the MATH block shows that there are two input data wire plugs (one for value A and one for value B) and three output data wire plugs. The MATH block requires one or two integer values, depending on the option you selected in the Operation section: if A or B is left blank, its value defaults to 0, except for Absolute Value or Square Root where only Value A is used. Numbers can be entered manually by typing a value for A and a value for B in the configuration panel, or they can be provided by running one data wire into plug A and another data wire into plug B.
Example: Try the sample program (taken from LEGO MINDSTORMS NXT-G Second Edition Programming Guide) that makes use of two random numbers (generated by two RANDOM blocks). Each RANDOM block uses its output data plug to run a wire into the A and B input data plugs on the MATH block. Once values A and B have been added together, you want to see the answer on the LCD screen. To do this, you have to first convert the number to text. Drop in a NUMBER TO TEXT block and drag a data wire from the Result data plug on the MATH block into the Number data plug on the NUMBER TO TEXT block. In order to see the answer on the Bricks LCD screen, drag a data wire out of the Text data plug on the NUMBER TO TEXT block and into the Text data plug on the DISPLAY block.
2. Lets build the measuring device. This simple device can be used to calculate length, area, and volume by rolling the wheel along surfaces. The NXT does the math and displays the results on the screen in both metric and English units.
3. It is time to create the program (instructions) that will automatically work out the area and volume on our behalf.
Getting Length .