VEX PID Control
(→Motors Debug Window) |
(→Motors Debug Window) |
||
| Line 52: | Line 52: | ||
| | | | ||
{| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:center; font-size:100%; border-collapse: separate; border-spacing: 0; border-width: 1px; border-style: solid; border-color: #000;" cellpadding="5%" | {| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:center; font-size:100%; border-collapse: separate; border-spacing: 0; border-width: 1px; border-style: solid; border-color: #000;" cellpadding="5%" | ||
| − | ! style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|'' | + | ! style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|''Debug Parameter'' |
! style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|Comments | ! style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|Comments | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
|- | |- | ||
| style="text-align:left; border-style: solid; border-width: 1px 0px 1px 0px"|<span class="keywordBI" id="dataType_bool">bool</span> | | style="text-align:left; border-style: solid; border-width: 1px 0px 1px 0px"|<span class="keywordBI" id="dataType_bool">bool</span> | ||
| style="text-align:left; border-style: solid; border-width: 1px 0px 1px 0px"|A Boolean value; either <span class="keywordBI">true</span> or <span class="keywordBI">false</span>. | | style="text-align:left; border-style: solid; border-width: 1px 0px 1px 0px"|A Boolean value; either <span class="keywordBI">true</span> or <span class="keywordBI">false</span>. | ||
Note that <span class="keywordBI">false</span> is equivalent to zero (0), and <span class="keywordBI">true</span> is equivalent to any non-zero number (both positive and negative). | Note that <span class="keywordBI">false</span> is equivalent to zero (0), and <span class="keywordBI">true</span> is equivalent to any non-zero number (both positive and negative). | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
|- | |- | ||
| style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|<span class="keywordBI" id="dataType_byte">byte</span> | | style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|<span class="keywordBI" id="dataType_byte">byte</span> | ||
| style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|A whole number ranging from -128 to 127. | | style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|A whole number ranging from -128 to 127. | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
|- | |- | ||
| style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|<span class="keywordBI" id="dataType_char">char</span> | | style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|<span class="keywordBI" id="dataType_char">char</span> | ||
| style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|A whole number ranging from -128 to 127. Can be interpreted as a character value. | | style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|A whole number ranging from -128 to 127. Can be interpreted as a character value. | ||
For example, <span class="codeStringsNums">42</span> = '<span class="codeStringsNums">B</span>' and vice versa. | For example, <span class="codeStringsNums">42</span> = '<span class="codeStringsNums">B</span>' and vice versa. | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
|- | |- | ||
| style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|<span class="keywordBI" id="dataType_float">float</span> | | style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|<span class="keywordBI" id="dataType_float">float</span> | ||
| Line 110: | Line 86: | ||
|} | |} | ||
| style="text-align:right; border-style: solid; border-width: 0px 0px 1px 0px"| | | style="text-align:right; border-style: solid; border-width: 0px 0px 1px 0px"| | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
|- | |- | ||
| style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|<span class="keywordBI" id="dataType_long">long</span> | | style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|<span class="keywordBI" id="dataType_long">long</span> | ||
| style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|A whole number ranging from -2,147,483,648 to 2,147,483,647. | | style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|A whole number ranging from -2,147,483,648 to 2,147,483,647. | ||
| style="text-align:right; border-style: solid; border-width: 0px 0px 1px 0px"| | | style="text-align:right; border-style: solid; border-width: 0px 0px 1px 0px"| | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
|- | |- | ||
| style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|<span class="keywordBI" id="dataType_int">int</span> | | style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|<span class="keywordBI" id="dataType_int">int</span> | ||
| style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|A whole number ranging from -32,768 to 32,767. | | style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|A whole number ranging from -32,768 to 32,767. | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
|- | |- | ||
| style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|<span class="keywordBI" id="dataType_short">short</span> | | style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|<span class="keywordBI" id="dataType_short">short</span> | ||
| style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|A whole number ranging from -32,768 to 32,767. | | style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|A whole number ranging from -32,768 to 32,767. | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
|- | |- | ||
| style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|<span class="keywordBI" id="dataType_string">string</span> | | style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|<span class="keywordBI" id="dataType_string">string</span> | ||
| style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|A sequence of characters. | | style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|A sequence of characters. | ||
| style="text-align:right; border-style: solid; border-width: 0px 0px 1px 0px"| | | style="text-align:right; border-style: solid; border-width: 0px 0px 1px 0px"| | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
|- | |- | ||
| style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|<span class="keywordBI" id="dataType_word">word</span> | | style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|<span class="keywordBI" id="dataType_word">word</span> | ||
| style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|A whole number ranging from -32,768 to 32,767. | | style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|A whole number ranging from -32,768 to 32,767. | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
|- | |- | ||
| style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|<span class="keywordB" id="dataType_ubyte">ubyte</span> | | style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|<span class="keywordB" id="dataType_ubyte">ubyte</span> | ||
| style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|An unsigned byte (0 to 255). | | style="text-align:left; border-style: solid; border-width: 0px 0px 1px 0px"|An unsigned byte (0 to 255). | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
|- | |- | ||
| style="text-align:left; border-style: solid; border-width: 0px 0px 0px 0px"|<span class="keywordBI" id="dataType_void">void</span> | | style="text-align:left; border-style: solid; border-width: 0px 0px 0px 0px"|<span class="keywordBI" id="dataType_void">void</span> | ||
| style="text-align:left; border-style: solid; border-width: 0px 0px 0px 0px"|This means that the function doesn't return anything. | | style="text-align:left; border-style: solid; border-width: 0px 0px 0px 0px"|This means that the function doesn't return anything. | ||
| style="text-align:right; border-style: solid; border-width: 0px 0px 0px 0px"|{{tag-arduino328}} | | style="text-align:right; border-style: solid; border-width: 0px 0px 0px 0px"|{{tag-arduino328}} | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
|- | |- | ||
|} | |} | ||
|} | |} | ||
Revision as of 12:51, 7 December 2012
| For ROBOTC VEX PID Control Functions, see: VEX PID Control Functions. |
|
| |||||||
Getting StartedBefore you can start using PID control for the VEX Cortex in ROBOTC, you must make sure you have all of the required components. There are two main components required to get started: a VEX 269 or 369 motor with an Integrated Motor Encoder (IME) installed, and a copy of ROBOTC for Cortex/PIC version 3.6.1 or higher. If you wish to control more than one motor using PID (on a robot, for example), you will need to make sure each motor that is PID controlled has an IME installed and is connected to the Cortex correctly. If you are unsure of how to configure the IME's inside of ROBOTC, please see our IME programming guide before continuing. |
Enabling PID (Simple)
Enabling basic PID control in ROBOTC is simple; navigate to the 'Robot -> Motors and Sensors Setup' window, find the motor you wish to enable PID control on, and check the 'PID Control'

This will enable basic PID control for the specified motors using ROBOTC's default parameters.
Enabling PID (Advanced)
Motors and Sensors Setup
Caution: Changing the default PID parameters may cause motor behavior which can potentially damage your robot with unexpected movements. As such, we advise that all PID testing be done in a safe area to help mitigate any possible damage.
1. The first thing you need to do before you can use the advanced features of PID control is change the menu level type to 'Super User'. This is done by navigating to the 'Window -> Menu Level' option in ROBOTC and changing the selected level to 'Super User'.
2. Once the Menu Level has been changed to 'Super User', open the Motors and Sensors setup window (under the Robot menu). You will notice that there is now an additional tab for 'PID Settings'; click on it to open the PID Settings window.
3. All of the motors configured with VEX IME's that have PID enabled will appear in the "PID Settings for Motors in This Single Program" box. Double-clicking on one of the listed motors will bring up a separate 'Edit PID Settings' window that can be used to manually tweak the PID settings for that particular motor.
4. There is also the option to change how ROBOTC handles PID for any particular motor setup, even if it is outside of that particular program. To view this menu option, click the 'More' button.
5. Let's assume you would like to change the PID settings for any VEX 269 motor (without a Motor Controller 29) programmed in ROBOTC. Double click on the appropriate motor and change the settings as needed in the 'Edit PID Settings' box that appears. Remember, any changes to these setting will overwrite ROBOTC's defaults and will be applied to any program using PID control!
6. To finalize the changes to PID control, click the 'Apply' button on the Motors and Sensors Setup window. To revert the individual or global PID settings, simply click the 'Reset to Standard Values' or 'Reset to Application Defaults' buttons, respectively.
Motors Debug Window
When a program is running with the menu level set to 'Super User', the Motors Debug window will display the following parameters (whether PID is enabled or not).
|