|
|
| Line 747: |
Line 747: |
| | and in3 as the left-side encoder */ | | and in3 as the left-side encoder */ |
| | stop(); // stop | | stop(); // stop |
| − | </syntaxhighlight>
| |
| − | |-
| |
| − | |}
| |
| − | |-
| |
| − | |}
| |
| − | <br />
| |
| − |
| |
| − | === tankControl ===
| |
| − | {| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0"
| |
| − | |-
| |
| − | | class="functionType"| <span class="bigKeywordBI">void </span><span class="bigKeywordB">tankControl</span><span class="bigCodePunc">(</span><span class="bigKeywordB">TVexJoysticks </span><span class="bigCodeBasic">rightJoystick</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">Ch2</span><span class="bigCodePunc">, </span><span class="bigKeywordB">TVexJoysticks </span><span class="bigCodeBasic">leftJoystick</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">Ch3</span><span class="bigCodePunc">, </span><span class="bigKeywordBI">short </span><span class="bigCodeBasic">threshold</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">10</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:tank_control_vex.png]]
| |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|([[Data_Types#dataType_void|void]]) The robot will be remote controlled in such a way that the left motor is mapped to the left joystick and the right motor is mapped to the right joystick.
| |
| − |
| |
| − | *NOTE: This function only supports 2 channels and works best with the joystics.
| |
| − | |-
| |
| − | |}
| |
| − | |-
| |
| − | |
| |
| − | {| 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"|''rightJoystick''
| |
| − | | style="border-style: solid; border-width: 1px 0px 1px 0px"|The joystick to use as the RIGHT-side joystick.<br />(default: <span class="codeStringsNums">Ch2</span>)
| |
| − | | style="border-style: solid; border-width: 1px 0px 1px 0px"|Any channel:<br /><span class="codeStringsNums">Ch1<br />Ch2<br />Ch3<br />Ch4</span>
| |
| − | |-
| |
| − | | style="border-style: solid; border-width: 0px 0px 1px 0px"|''leftJoystick''
| |
| − | | style="border-style: solid; border-width: 0px 0px 1px 0px"|The joystick to use as the LEFT-side joystick.<br />(default: <span class="codeStringsNums">Ch3</span>)
| |
| − | | style="border-style: solid; border-width: 0px 0px 1px 0px"|Any channel:<br /><span class="codeStringsNums">Ch1<br />Ch2<br />Ch3<br />Ch4</span>
| |
| − | |-
| |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|''threshold''
| |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|This variable eliminates 'noise' caused by joysticks not returning back to the exact center.<br />(default: <span class="codeStringsNums">10</span>)
| |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|0 to 127
| |
| − | |-
| |
| − | |}
| |
| − | |-
| |
| − | |
| |
| − | {| 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">
| |
| − | while(true)
| |
| − | {
| |
| − | tankControl(); /* control the robot in 'tank' fashion
| |
| − | with the RIGHT joystick as Ch2 and
| |
| − | the LEFT joystick as Ch1, with a
| |
| − | threshold of 10 (default) */
| |
| − | }
| |
| − | </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">
| |
| − | while(true)
| |
| − | {
| |
| − | tankControl(Ch1, Ch4, 5); /* control the robot in 'tank' fashion
| |
| − | with the RIGHT joystick as Ch1 and
| |
| − | the LEFT joystick as Ch2, with a
| |
| − | threshold of 5 */
| |
| − | }
| |
| − | </syntaxhighlight>
| |
| − | |-
| |
| − | |}
| |
| − | |-
| |
| − | |}
| |
| − | <br />
| |
| − |
| |
| − | === arcadeControl ===
| |
| − | {| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0"
| |
| − | |-
| |
| − | | class="functionType"| <span class="bigKeywordBI">void </span><span class="bigKeywordB">arcadeControl</span><span class="bigCodePunc">(</span><span class="bigKeywordB">TVexJoysticks </span><span class="bigCodeBasic">verticalJoystick</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">Ch2</span><span class="bigCodePunc">, </span><span class="bigKeywordB">TVexJoysticks </span><span class="bigCodeBasic">horizontalJoystick</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">Ch1</span><span class="bigCodePunc">, </span><span class="bigKeywordBI">short </span><span class="bigCodeBasic">threshold</span><span class="bigCodePunc"> = </span><span class="bigCodeStringsNums">10</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:arcade_control_vex.png]]
| |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|([[Data_Types#dataType_void|void]]) The robot will be remote controlled in such a way that the movement of the robot is mapped to a single joystick, much like a retro arcade game.
| |
| − |
| |
| − | *NOTE: This function only supports 2 channels and works best with the joystics.
| |
| − | |-
| |
| − | |}
| |
| − | |-
| |
| − | |
| |
| − | {| 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"|''verticalJoystick''
| |
| − | | style="border-style: solid; border-width: 1px 0px 1px 0px"|The joystick to use as the VERTICAL joystick.<br />(default: <span class="codeStringsNums">Ch2</span>)
| |
| − | | style="border-style: solid; border-width: 1px 0px 1px 0px"|Any channel:<br /><span class="codeStringsNums">Ch1<br />Ch2<br />Ch3<br />Ch4</span>
| |
| − | |-
| |
| − | | style="border-style: solid; border-width: 0px 0px 1px 0px"|''horizontalJoystick''
| |
| − | | style="border-style: solid; border-width: 0px 0px 1px 0px"|The joystick to use as the HORIZONTAL joystick.<br />(default: <span class="codeStringsNums">Ch1</span>)
| |
| − | | style="border-style: solid; border-width: 0px 0px 1px 0px"|Any channel:<br /><span class="codeStringsNums">Ch1<br />Ch2<br />Ch3<br />Ch4</span>
| |
| − | |-
| |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|''threshold''
| |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|This variable eliminates 'noise' caused by joysticks not returning back to the exact center.<br />(default: <span class="codeStringsNums">10</span>)
| |
| − | | style="border-style: solid; border-width: 0px 0px 0px 0px"|0 to 127
| |
| − | |-
| |
| − | |}
| |
| − | |-
| |
| − | |
| |
| − | {| 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">
| |
| − | while(true)
| |
| − | {
| |
| − | arcadeControl(); /* control the robot in 'arcade' fashion
| |
| − | with the VERTICAL joystick as Ch2
| |
| − | and the HORIZONTAL joystick as Ch1,
| |
| − | with a threshold of 10 (default) */
| |
| − | }
| |
| − | </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">
| |
| − | while(true)
| |
| − | {
| |
| − | arcadeControl(Ch3, Ch4, 5); /* control the robot in 'arcade' fashion
| |
| − | with the VERTICAL joystick as Ch3
| |
| − | and the HORIZONTAL joystick as Ch4,
| |
| − | with a threshold of 5 */
| |
| − | }
| |
| | </syntaxhighlight> | | </syntaxhighlight> |
| | |- | | |- |