|
|
| Line 655: |
Line 655: |
| | wait(2.0); // wait 2.0 seconds | | wait(2.0); // wait 2.0 seconds |
| | stop(); // stop | | stop(); // stop |
| − | </syntaxhighlight>
| |
| − | |-
| |
| − | |}
| |
| − | |-
| |
| − | |}
| |
| − | <br />
| |
| − |
| |
| − | === lineTrackForTime ===
| |
| − | {| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0"
| |
| − | |-
| |
| − | | class="functionType"| <span class="bigKeywordBI">void </span><span class="bigKeywordB">lineTrackForTime</span><span class="bigCodePunc">(</span><span class="bigKeywordBI">float </span><span class="bigCodeBasic">trackTime</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">5.0</span><span class="bigCodePunc">, </span><span class="bigKeywordBI">int </span><span class="bigCodeBasic">threshold</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">505</span><span class="bigCodePunc">, </span><span class="bigCodeBasic">tSensors </span><span class="bigCodeBasic">sensorLeft</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">in1</span><span class="bigCodePunc">, </span><span class="bigCodeBasic">tSensors </span><span class="bigCodeBasic">sensorCenter</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">in2</span><span class="bigCodePunc">, </span><span class="bigCodeBasic">tSensors </span><span class="bigCodeBasic">sensorRight</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">in3</span><span class="bigCodePunc">)</span>
| |
| − | |-
| |
| − | |
| |
| − | {| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:left; font-size:100%; border-collapse: separate; border-spacing: 0; border-width: 0px; border-style: solid; border-color: #000;" cellpadding="5%"
| |
| − | ! style="border-style: solid; border-width: 0px 0px 0px 0px"|
| |
| − | ! style="border-style: solid; border-width: 0px 0px 0px 0px"|
| |
| − | |-
| |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|[[File:lineTrackTime_vex.png]]
| |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|([[Data_Types#dataType_void|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.)
| |
| − | |-
| |
| − | |}
| |
| − | |-
| |
| − | |
| |
| − | {| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#F2F2F2; text-align:left; font-size:100%; border-collapse: separate; border-spacing: 0; border-width: 0px; border-style: solid; border-color: #000;" cellpadding="5%"
| |
| − | ! style="border-style: solid; border-width: 0px 0px 1px 0px"|Parameter
| |
| − | ! style="border-style: solid; border-width: 0px 0px 1px 0px"|Explanation
| |
| − | ! style="border-style: solid; border-width: 0px 0px 1px 0px"|Acceptable Input
| |
| − | |-
| |
| − | | style="border-style: solid; border-width: 1px 0px 1px 0px"|''trackTime''
| |
| − | | style="border-style: solid; border-width: 1px 0px 1px 0px"|The amount of time in seconds to track a line.<br />(default: <span class="codeStringsNums">5.0</span>)
| |
| − | | style="border-style: solid; border-width: 1px 0px 1px 0px"|Any floating point amount:
| |
| − | {| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#F2F2F2; text-align:left; font-size:100%; border-collapse: separate; border-spacing: 0; border-width: 0px; border-style: solid; border-color: #000;" cellpadding="5%"
| |
| − | ! style="border-style: solid; border-width: 0px 0px 0px 0px"|
| |
| − | !
| |
| − | |-
| |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|0.####
| |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|0.0000 to +2,048.0000
| |
| − | |-
| |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|0.###
| |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|0.000 to +32,768.000
| |
| − | |-
| |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|0.##
| |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|0.00 to +262,144.00
| |
| − | |-
| |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|0.#
| |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|0.0 to +2,097,200.0
| |
| − | |-
| |
| − | |}
| |
| − | |-
| |
| − | | style="border-style: solid; border-width: 0px 0px 1px 0px"|''threshold''
| |
| − | | style="border-style: solid; border-width: 0px 0px 1px 0px"|The threshold to compare colors against.<br />(default: <span class="codeStringsNums">505</span>)
| |
| − | | style="border-style: solid; border-width: 0px 0px 1px 0px"|0 to +4095
| |
| − | |-
| |
| − | | style="border-style: solid; border-width: 0px 0px 1px 0px"|''sensorLeft''
| |
| − | | style="border-style: solid; border-width: 0px 0px 1px 0px"|The sensor port to use for the LEFT line tracking sensor.<br />(default: <span class="codeStringsNums">in1</span>)
| |
| − | | style="border-style: solid; border-width: 0px 0px 1px 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 1px 0px"|''sensorCenter''
| |
| − | | style="border-style: solid; border-width: 0px 0px 1px 0px"|The sensor port to use for the CENTER line tracking sensor.<br />(default: <span class="codeStringsNums">in2</span>)
| |
| − | | style="border-style: solid; border-width: 0px 0px 1px 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"|''sensorRight''
| |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|The sensor port to use for the RIGHT line tracking sensor.<br />(default: <span class="codeStringsNums">in3</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="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:left; font-size:100%; border-collapse: separate; border-spacing: 0; border-width: 0px; border-style: solid; border-color: #000;" cellpadding="5%"
| |
| − | ! style="border-style: solid; border-width: 0px 0px 0px 0px"|Default Usage and Sample
| |
| − | |-
| |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<syntaxhighlight lang="ROBOTC">
| |
| − | 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();
| |
| − | </syntaxhighlight>
| |
| − | |-
| |
| − | |}
| |
| − | |-
| |
| − | |
| |
| − | {| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:left; font-size:100%; border-collapse: separate; border-spacing: 0; border-width: 0px; border-style: solid; border-color: #000;" cellpadding="5%"
| |
| − | ! style="border-style: solid; border-width: 0px 0px 0px 0px"|Usage and Sample with Parameters
| |
| − | |-
| |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<syntaxhighlight lang="ROBOTC">
| |
| − | 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
| |
| − | </syntaxhighlight>
| |
| − | |-
| |
| − | |}
| |
| − | |-
| |
| − | |}
| |
| − | <br />
| |
| − |
| |
| − | === lineTrackForRotations ===
| |
| − | {| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0"
| |
| − | |-
| |
| − | | class="functionType"| <span class="bigKeywordBI">void </span><span class="bigKeywordB">lineTrackForRotations</span><span class="bigCodePunc">(</span><span class="bigKeywordBI">float </span><span class="bigCodeBasic">rotations</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">3.0</span><span class="bigCodePunc">, </span><span class="bigKeywordBI">int </span><span class="bigCodeBasic">threshold</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">505</span><span class="bigCodePunc">, </span><span class="bigCodeBasic">tSensors </span><span class="bigCodeBasic">sensorLeft</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">in1</span><span class="bigCodePunc">, </span><span class="bigCodeBasic">tSensors </span><span class="bigCodeBasic">sensorCenter</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">in2</span><span class="bigCodePunc">, </span><span class="bigCodeBasic">tSensors </span><span class="bigCodeBasic">sensorRight</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">in3</span><span class="bigCodePunc">)</span>
| |
| − | |-
| |
| − | |
| |
| − | {| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:left; font-size:100%; border-collapse: separate; border-spacing: 0; border-width: 0px; border-style: solid; border-color: #000;" cellpadding="5%"
| |
| − | ! style="border-style: solid; border-width: 0px 0px 0px 0px"|
| |
| − | ! style="border-style: solid; border-width: 0px 0px 0px 0px"|
| |
| − | |-
| |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|[[File:lineTrackDist_vex.png]]
| |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|([[Data_Types#dataType_void|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.)
| |
| − | |-
| |
| − | |}
| |
| − | |-
| |
| − | |
| |
| − | {| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#F2F2F2; text-align:left; font-size:100%; border-collapse: separate; border-spacing: 0; border-width: 0px; border-style: solid; border-color: #000;" cellpadding="5%"
| |
| − | ! style="border-style: solid; border-width: 0px 0px 1px 0px"|Parameter
| |
| − | ! style="border-style: solid; border-width: 0px 0px 1px 0px"|Explanation
| |
| − | ! style="border-style: solid; border-width: 0px 0px 1px 0px"|Acceptable Input
| |
| − | |-
| |
| − | | style="border-style: solid; border-width: 1px 0px 1px 0px"|''rotations''
| |
| − | | style="border-style: solid; border-width: 1px 0px 1px 0px"|The amount of axle rotations to track a line.<br />(default: <span class="codeStringsNums">3.0</span>)
| |
| − | | style="border-style: solid; border-width: 1px 0px 1px 0px"|Any floating point amount:
| |
| − | {| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#F2F2F2; text-align:left; font-size:100%; border-collapse: separate; border-spacing: 0; border-width: 0px; border-style: solid; border-color: #000;" cellpadding="5%"
| |
| − | ! style="border-style: solid; border-width: 0px 0px 0px 0px"|
| |
| − | !
| |
| − | |-
| |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|0.####
| |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|-2,048.0000 to +2,048.0000
| |
| − | |-
| |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|0.###
| |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|-32,768.000 to +32,768.000
| |
| − | |-
| |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|0.##
| |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|-262,144.00 to +262,144.00
| |
| − | |-
| |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|0.#
| |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|-2,097,200.0 to +2,097,200.0
| |
| − | |-
| |
| − | |}
| |
| − | |-
| |
| − | | style="border-style: solid; border-width: 0px 0px 1px 0px"|''threshold''
| |
| − | | style="border-style: solid; border-width: 0px 0px 1px 0px"|The threshold to compare colors against.<br />(default: <span class="codeStringsNums">505</span>)
| |
| − | | style="border-style: solid; border-width: 0px 0px 1px 0px"|0 to +4095
| |
| − | |-
| |
| − | | style="border-style: solid; border-width: 0px 0px 1px 0px"|''sensorLeft''
| |
| − | | style="border-style: solid; border-width: 0px 0px 1px 0px"|The sensor port to use for the LEFT line tracking sensor.<br />(default: <span class="codeStringsNums">in1</span>)
| |
| − | | style="border-style: solid; border-width: 0px 0px 1px 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 1px 0px"|''sensorCenter''
| |
| − | | style="border-style: solid; border-width: 0px 0px 1px 0px"|The sensor port to use for the CENTER line tracking sensor.<br />(default: <span class="codeStringsNums">in2</span>)
| |
| − | | style="border-style: solid; border-width: 0px 0px 1px 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"|''sensorRight''
| |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|The sensor port to use for the RIGHT line tracking sensor.<br />(default: <span class="codeStringsNums">in3</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="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:left; font-size:100%; border-collapse: separate; border-spacing: 0; border-width: 0px; border-style: solid; border-color: #000;" cellpadding="5%"
| |
| − | ! style="border-style: solid; border-width: 0px 0px 0px 0px"|Default Usage and Sample
| |
| − | |-
| |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<syntaxhighlight lang="ROBOTC">
| |
| − | 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();
| |
| − | </syntaxhighlight>
| |
| − | |-
| |
| − | |}
| |
| − | |-
| |
| − | |
| |
| − | {| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:left; font-size:100%; border-collapse: separate; border-spacing: 0; border-width: 0px; border-style: solid; border-color: #000;" cellpadding="5%"
| |
| − | ! style="border-style: solid; border-width: 0px 0px 0px 0px"|Usage and Sample with Parameters
| |
| − | |-
| |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|<syntaxhighlight lang="ROBOTC">
| |
| − | 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
| |
| | </syntaxhighlight> | | </syntaxhighlight> |
| | |- | | |- |