|
|
| (9 intermediate revisions by one user not shown) |
| Line 1,246: |
Line 1,246: |
| | |- | | |- |
| | | style="border-style: solid; border-width: 1px 0px 0px 0px"|''sensorPort'' | | | style="border-style: solid; border-width: 1px 0px 0px 0px"|''sensorPort'' |
| − | | style="border-style: solid; border-width: 1px 0px 0px 0px"|The sensor port to use for the light sensor.<br />(default: <span class="codeStringsNums">dgtl6</span>) | + | | style="border-style: solid; border-width: 1px 0px 0px 0px"|The sensor port to use for the touch sensor.<br />(default: <span class="codeStringsNums">dgtl6</span>) |
| | | style="border-style: solid; border-width: 1px 0px 0px 0px"|<span class="codeStringsNums">dgtl1</span> to <span class="codeStringsNums">dgtl12</span><br />Or their names setup in Motors and Sensors Setup. | | | style="border-style: solid; border-width: 1px 0px 0px 0px"|<span class="codeStringsNums">dgtl1</span> to <span class="codeStringsNums">dgtl12</span><br />Or their names setup in Motors and Sensors Setup. |
| | |- | | |- |
| Line 1,305: |
Line 1,305: |
| | |- | | |- |
| | | style="border-style: solid; border-width: 1px 0px 1px 0px"|''sensorPort'' | | | style="border-style: solid; border-width: 1px 0px 1px 0px"|''sensorPort'' |
| − | | style="border-style: solid; border-width: 1px 0px 1px 0px"|The sensor port to use for the light sensor.<br />(default: <span class="codeStringsNums">dgtl6</span>) | + | | style="border-style: solid; border-width: 1px 0px 1px 0px"|The sensor port to use for the touch sensor.<br />(default: <span class="codeStringsNums">dgtl6</span>) |
| | | style="border-style: solid; border-width: 1px 0px 1px 0px"|<span class="codeStringsNums">dgtl1</span> to <span class="codeStringsNums">dgtl12</span><br />Or their names setup in Motors and Sensors Setup. | | | style="border-style: solid; border-width: 1px 0px 1px 0px"|<span class="codeStringsNums">dgtl1</span> to <span class="codeStringsNums">dgtl12</span><br />Or their names setup in Motors and Sensors Setup. |
| | |- | | |- |
| Line 1,501: |
Line 1,501: |
| | |- | | |- |
| | | style="border-style: solid; border-width: 0px 0px 0px 0px"|''sensorPort'' | | | style="border-style: solid; border-width: 0px 0px 0px 0px"|''sensorPort'' |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|The sensor port to use for the sonar sensor.<br />(default: <span class="codeStringsNums">in6</span>) | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|The sensor port to use for the potentiometer sensor.<br />(default: <span class="codeStringsNums">in6</span>) |
| | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<span class="codeStringsNums">in1</span> to <span class="codeStringsNums">in8</span><br />Or their names setup in Motors and Sensors Setup. | | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<span class="codeStringsNums">in1</span> to <span class="codeStringsNums">in8</span><br />Or their names setup in Motors and Sensors Setup. |
| | |- | | |- |
| Line 1,565: |
Line 1,565: |
| | |- | | |- |
| | | style="border-style: solid; border-width: 0px 0px 0px 0px"|''sensorPort'' | | | style="border-style: solid; border-width: 0px 0px 0px 0px"|''sensorPort'' |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|The sensor port to use for the sonar sensor.<br />(default: <span class="codeStringsNums">in6</span>) | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|The sensor port to use for the potentiometer sensor.<br />(default: <span class="codeStringsNums">in6</span>) |
| | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<span class="codeStringsNums">in1</span> to <span class="codeStringsNums">in8</span><br />Or their names setup in Motors and Sensors Setup. | | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<span class="codeStringsNums">in1</span> to <span class="codeStringsNums">in8</span><br />Or their names setup in Motors and Sensors Setup. |
| | |- | | |- |
| Line 1,688: |
Line 1,688: |
| | |- | | |- |
| | | style="border-style: solid; border-width: 0px 0px 0px 0px"|''sensorPort'' | | | style="border-style: solid; border-width: 0px 0px 0px 0px"|''sensorPort'' |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|The sensor port to use for the sonar sensor.<br />(default: <span class="codeStringsNums">in2</span>) | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|The sensor port to use for the potentiometer sensor.<br />(default: <span class="codeStringsNums">in2</span>) |
| | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<span class="codeStringsNums">in1</span> to <span class="codeStringsNums">in8</span><br />Or their names setup in Motors and Sensors Setup. | | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<span class="codeStringsNums">in1</span> to <span class="codeStringsNums">in8</span><br />Or their names setup in Motors and Sensors Setup. |
| | |- | | |- |
| Line 1,752: |
Line 1,752: |
| | |- | | |- |
| | | style="border-style: solid; border-width: 0px 0px 0px 0px"|''sensorPort'' | | | style="border-style: solid; border-width: 0px 0px 0px 0px"|''sensorPort'' |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|The sensor port to use for the sonar sensor.<br />(default: <span class="codeStringsNums">in2</span>) | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|The sensor port to use for the potentiometer sensor.<br />(default: <span class="codeStringsNums">in2</span>) |
| | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<span class="codeStringsNums">in1</span> to <span class="codeStringsNums">in8</span><br />Or their names setup in Motors and Sensors Setup. | | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<span class="codeStringsNums">in1</span> to <span class="codeStringsNums">in8</span><br />Or their names setup in Motors and Sensors Setup. |
| | |- | | |- |
| Line 1,858: |
Line 1,858: |
| | forward(63); // move forward at speed 63 | | forward(63); // move forward at speed 63 |
| | untilRotations(2.75, dgtl3); /* wait until the quadrature encoder in port | | untilRotations(2.75, dgtl3); /* wait until the quadrature encoder in port |
| − | dgtl3 (+ dgtl4)counts 2.75 rotations */ | + | dgtl3 (+ dgtl4) counts 2.75 rotations */ |
| | stop(); // stop | | stop(); // stop |
| | </syntaxhighlight> | | </syntaxhighlight> |
| Line 1,922: |
Line 1,922: |
| | forward(63); // move forward at speed 63 | | forward(63); // move forward at speed 63 |
| | untilEncoderCounts(990, dgtl3); /* wait until the quadrature encoder in port | | untilEncoderCounts(990, dgtl3); /* wait until the quadrature encoder in port |
| − | dgtl3 (+ dgtl4)counts 990 encoder counts */ | + | dgtl3 (+ dgtl4) counts 990 encoder counts */ |
| | stop(); // stop | | stop(); // stop |
| | </syntaxhighlight> | | </syntaxhighlight> |
| Line 2,068: |
Line 2,068: |
| | |- | | |- |
| | | style="border-style: solid; border-width: 0px 0px 0px 0px"|''brightness'' | | | style="border-style: solid; border-width: 0px 0px 0px 0px"|''brightness'' |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|The level of brightness to<br />set the VEX Flashlight to.<br />(default: <span class="codeStringsNums">dgtl2</span>) | + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|The level of brightness to<br />set the VEX Flashlight to.<br />(default: <span class="codeStringsNums">63</span>) |
| | | style="border-style: solid; border-width: 0px 0px 0px 0px"|Any whole integer amount from 0 to 127. | | | style="border-style: solid; border-width: 0px 0px 0px 0px"|Any whole integer amount from 0 to 127. |
| | |- | | |- |
| void lineTrackForRotations(float rotations = 3.0, int threshold = 505, tSensors sensorLeft = in1, tSensors sensorCenter = in2, tSensors sensorRight = in3)
|
|
|
|
|
(void) The robot will track a black line on a white surface for a specified distance in rotations.
Threshold Range: (dark) 0 to 4095 (light)
Acceptable Sensors: analog ports 1 through 8 (and your names for them given in Motors and Sensors Setup.)
|
|
| Parameter
|
Explanation
|
Acceptable Input
|
| rotations
|
The amount of axle rotations to track a line. (default: 3.0)
|
Any floating point amount:
|
|
|
| 0.####
|
-2,048.0000 to +2,048.0000
|
| 0.###
|
-32,768.000 to +32,768.000
|
| 0.##
|
-262,144.00 to +262,144.00
|
| 0.#
|
-2,097,200.0 to +2,097,200.0
|
|
| threshold
|
The threshold to compare colors against. (default: 505)
|
0 to +4095
|
| sensorLeft
|
The sensor port to use for the LEFT line tracking sensor. (default: in1)
|
in1 to in8 Or their names setup in Motors and Sensors Setup.
|
| sensorCenter
|
The sensor port to use for the CENTER line tracking sensor. (default: in2)
|
in1 to in8 Or their names setup in Motors and Sensors Setup.
|
| sensorRight
|
The sensor port to use for the RIGHT line tracking sensor. (default: in3)
|
in1 to in8 Or their names setup in Motors and Sensors Setup.
|
|
| Default Usage and Sample
|
lineTrackForRotations(); /* track a black line for 3.0 rotations,
using a threshold of 505, with the
line tracking sensors in ports:
in1, in2, in3(default) */
stop();
|
|
| Usage and Sample with Parameters
|
lineTrackForRotations(4.75, 99, in6, in7, in8); /* track a black line for 4.75 rotations,
using a threshold of 99, with the
line tracking sensors in ports:
in6, in7, in8 */
stop(); // stop
|
|