001package com.ctre.phoenix.motorcontrol;
002
003/**
004 * Choose the control mode for a TalonSRX.
005 */
006public enum TalonSRXControlMode
007{
008        /**
009         * Percent output [-1,1]
010         */
011        PercentOutput(0),
012        /**
013         * Position closed loop
014         */
015        Position(1),
016        /**
017         * Velocity closed loop
018         */
019        Velocity(2),
020        /**
021         * Input current closed loop
022         */
023        Current(3),
024        /**
025         * Follow other motor controller
026         */
027        Follower(5),
028        /**
029         * Motion Profile
030         */
031        MotionProfile(6),
032        /**
033         * Motion Magic
034         */
035        MotionMagic(7),
036        /**
037         * Motion Profile with auxiliary output
038         */
039        MotionProfileArc(10),
040
041        /**
042         * Disable Motor Controller
043         */
044        Disabled(15);
045
046        /**
047         * Value of control mode
048         */
049        public final int value;
050
051        /**
052         * Create TalonSRXControlMode of initValue
053         * @param initValue Value of TalonSRXControlMode
054         */
055        TalonSRXControlMode(int initValue)
056        {
057                this.value = initValue;
058        }
059
060        /**
061         * Helper method to convert to generic ControlMode enum.
062         * @return value cast as ControlMode
063         */
064        public ControlMode toControlMode(){
065                switch(value){
066                        case 0: return ControlMode.PercentOutput;
067                        case 1: return ControlMode.Position;
068                        case 2: return ControlMode.Velocity;
069                        case 3: return ControlMode.Current;
070                        case 5: return ControlMode.Follower;
071                        case 6: return ControlMode.MotionProfile;
072                        case 7: return ControlMode.MotionMagic;
073                        case 10: return ControlMode.MotionProfileArc;
074                        case 15: return ControlMode.Disabled;
075                        default: return ControlMode.PercentOutput;
076                }
077        }
078};