|
|
| (5 intermediate revisions by one user not shown) |
| 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 lineTrackForTime(float trackTime = 5.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 time in seconds.
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
|
| trackTime
|
The amount of time in seconds to track a line. (default: 5.0)
|
Any floating point amount:
|
|
|
| 0.####
|
0.0000 to +2,048.0000
|
| 0.###
|
0.000 to +32,768.000
|
| 0.##
|
0.00 to +262,144.00
|
| 0.#
|
0.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
|
lineTrackForTime(); /* track a black line for 5.0 seconds,
using a threshold of 505, with the
line tracking sensors in ports:
in1, in2, in3(default) */
stop();
|
|
| Usage and Sample with Parameters
|
lineTrackForTime(7.5, 99, in6, in7, in8); /* track a black line for 7.5 seconds,
using a threshold of 99, with the
line tracking sensors in ports:
in6, in7, in8 */
stop(); // stop
|
|
| 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
|
|
| void moveStraightForTime(float seconds = 5.0, tSensors rightEncoderPort = dgtl1, tSensors leftEncoderPort = dgtl3)
|
|
|
|
|
(void) The robot will use encoders to maintain a straight course for a length of time in seconds.
- NOTE: This function only supports moving forward and only at one speed setting. Future implementations may include moving backwards and variable speeds.
Acceptable Sensors: digital ports 1 through 11 (and your names for them given in Motors and Sensors Setup.)
|
|
| Parameter
|
Explanation
|
Acceptable Input
|
| seconds
|
The amount of time in seconds to drive straight forward. (default: 5.0)
|
Any floating point amount:
|
|
|
| 0.####
|
0.0000 to +2,048.0000
|
| 0.###
|
0.000 to +32,768.000
|
| 0.##
|
0.00 to +262,144.00
|
| 0.#
|
0.0 to +2,097,200.0
|
|
| rightEncoderPort
|
The right-side motor encoder. (default: dgtl1 [+ dgtl2])
|
dgtl1 to dgtl11 Or their names setup in Motors and Sensors Setup.
|
| leftEncoderPort
|
The left-side motor encoder. (default: dgtl3 [+ dgtl4])
|
dgtl1 to dgtl11 Or their names setup in Motors and Sensors Setup.
|
|
| Default Usage and Sample
|
moveStraightForTime(); /* move straight forward for 5.0 seconds,
using dgtl1 (+ dgtl2) as the right-side encoder and
dgtl3 (+ dgtl4) as the left-side encoder (default) */
stop();
|
|
| Usage and Sample with Parameters
|
moveStraightForTime(7.5, dgtl5, dgtl3); /* move straight forward for 7.5 seconds,
using dgtl5 (+ dgtl6) as the right-side encoder
and dgtl3 (+ dgtl4) as the left-side encoder */
stop(); // stop
|
|
| void moveStraightForRotations(float rotations = 1.0, tSensors rightEncoderPort = dgtl1, tSensors leftEncoderPort = dgtl3)
|
|
|
|
|
(void) The robot will use encoders to maintain a straight course for a distance in rotations (360 encoder counts = 1 rotation).
- NOTE: This function only supports moving forward and only at one speed setting. Future implementations may include moving backwards and variable speeds.
Acceptable Sensors: digital ports 1 through 11 (and your names for them given in Motors and Sensors Setup.)
|
|
| Parameter
|
Explanation
|
Acceptable Input
|
| rotations
|
The amount of axle rotations to drive straight forward. (default: 1.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
|
|
| rightEncoderPort
|
The right-side motor encoder. (default: dgtl1 [+ dgtl2])
|
dgtl1 to dgtl11 Or their names setup in Motors and Sensors Setup.
|
| leftEncoderPort
|
The left-side motor encoder. (default: dgtl3 [+ dgtl4])
|
dgtl1 to dgtl11 Or their names setup in Motors and Sensors Setup.
|
|
| Default Usage and Sample
|
moveStraightForRotations(); /* move straight forward for 1.0 rotations,
using dgtl1 (+ dgtl2) as the right-side encoder and
dgtl3 (+ dgtl4) as the left-side encoder (default) */
stop();
|
|
| Usage and Sample with Parameters
|
moveStraightForRotations(4.95, dgtl5, dgtl3); /* move straight forward for 4.95 rotations,
using dgtl5 (+ dgtl6) as the right-side encoder
and dgtl3 (+ dgtl4) as the left-side encoder */
stop(); // stop
|
|
| void untilRotations(float rotations = 1.0, tSensors sensorPort = dgtl1)
|
|
|
|
|
(void) The robot does what it was doing until the motor encoder rotations match the desired value.
Range: -262,144.00 to +262,144.00
Acceptable Sensors: digital ports 1 through 11 (and your names for them given in Motors and Sensors Setup.)
|
|
| Parameter
|
Explanation
|
Acceptable Input
|
| rotations
|
The amount of axle rotations to reach. (default: 1.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
|
|
| sensorPort
|
The quadrature encoder to use. (default: dgtl1 [+ dgtl1])
|
dgtl1 to dgtl11 Or their names setup in Motors and Sensors Setup.
|
|
| Default Usage and Sample
|
forward();
untilRotations(); /* wait until the quadrature encoder in port
dgtl1 (+ dgtl2) counts 1.0 rotations (default) */
stop();
|
|
| Usage and Sample with Parameters
|
forward(63); // move forward at speed 63
untilRotations(2.75, dgtl3); /* wait until the quadrature encoder in port
dgtl3 (+ dgtl4) counts 2.75 rotations */
stop(); // stop
|
|
| void untilEncoderCounts(long distance = 360, tSensors sensorPort = dgtl1)
|
|
|
|
|
(void) The robot does what it was doing until the motor encoder counts match the desired value.
Range: -2,147,483,648 to +2,147,483,647
Acceptable Sensors: digital ports 1 through 11 (and your names for them given in Motors and Sensors Setup.)
|
|
| Parameter
|
Explanation
|
Acceptable Input
|
| distance
|
The amount of encoder counts to reach. (default: 360)
|
Any whole integer amount from -2,147,483,648 to +2,147,483,647
|
| sensorPort
|
The quadrature encoder to use. (default: dgtl1 [+ dgtl1])
|
dgtl1 to dgtl11 Or their names setup in Motors and Sensors Setup.
|
|
| Default Usage and Sample
|
forward();
untilEncoderCounts(); /* wait until the quadrature encoder in port
dgtl1 (+ dgtl2) counts 360 encoder counts (default) */
stop();
|
|
| Usage and Sample with Parameters
|
forward(63); // move forward at speed 63
untilEncoderCounts(990, dgtl3); /* wait until the quadrature encoder in port
dgtl3 (+ dgtl4) counts 990 encoder counts */
stop(); // stop
|
|