VEX PID Control

Jump to: navigation, search
(Motors Debug Window)
(Motors Debug Window)
Line 46: Line 46:
  
 
=== Motors Debug Window ===
 
=== 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).
+
When a program is running with the menu level set to 'Expert' or 'Super User', the Motors Debug window will display the following parameters (whether PID is enabled or not).
  
 
{| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:left; font-size:100%;" width="100%" cellpadding="5%" cellspacing="0" border="0" class="wikiText"
 
{| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:left; font-size:100%;" width="100%" cellpadding="5%" cellspacing="0" border="0" class="wikiText"

Revision as of 14:01, 7 December 2012

VEX → VEX PID Control

For ROBOTC VEX PID Control Functions, see: VEX PID Control Functions.

Contents

Color Key
Function:
Variable:

Getting Started

Before 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.

VEX motors with IME's installed

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'

PID Checkbox.png

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 'Expert' or 'Super User', the Motors Debug window will display the following parameters (whether PID is enabled or not).

Debug Parameter Comments
Index Displays the index value of the motor, e.g. port1, port2, port3, etc. This is read-only and cannot be changed via the debug window.
Motor Displays the user-defined alias, if any, for the specified motor. This is read-only and cannot be changed via the debug window.
Type Displays the type of motor in the specified port, e.g. VEX 269 Motor. The value is able to be both read and written to.
Power Displays the current motor power being sent from ROBOTC to the Cortex microcontroller. The value is able to be both read and written to and its values range from -127 to +127.
Slew Power Displays the speed the ramping functionality is currently sending to the PID algorithm. This can be used to check if the current "slew" movement has completed. This is read-only and cannot be changed via the debug window.
PWM Power Displays the current PWM value being sent to the motor from the PID Algorithm. The value is read-only and ranges from -127 to +127.
Encoder Displays the current Integrated Motor Encoder's (IME) value for the specified motor. The value is able to be both read and written to
Reversed Displays whether the motor on the specified port is reversed (mirrored) or normal. The value is able to be both read and written to
Error A whole number ranging from -32,768 to 32,767. This is read-only and cannot be changed via the debug window.
Regulation Displays the regulation mode (Speed, or Idle) for the specified motor. This is read-only and cannot be changed via the debug window.
Run State Displays whether the specified motor is running in an Open Loop or state. A value of false denotes no encoder is attached to the motor. This is read-only and cannot be changed via the debug window.
Deadband Displays the deadband for the specified motor; if the absolute value of the motor power level is less than this, the motor will not move. E.g. a Deadband value of 10 means that any motor value between -10 and +10 will not cause the motor to move. This value can be both read and written to.
Pwr Limit Displays the absolute (both negative and positive) limit for the generated PWM power level from the PID Algorithm. This value can be both read and written to.
Slew Up Displays the rate in which the ramping functionality of the PID algorithm will set the motor power level (increasing). The frequency of the rate change is based on the PID Update Internal (set by the mtrPid_Period variable). This value can be both read and written to.
Slew Down Displays the rate in which the ramping functionality of the PID algorithm will set the motor power level (decreasing). The frequency of the rate change is based on the PID Update Internal (set by the mtrPid_Period variable). This value can be both read and written to.
Slop Displays the tolerance (or slop) for the "Move to Position" commands in which the command will report back success. This value is in number of encoder counts and set on a per-motor basis. This value can be both read and written to.
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox