001package com.ctre.phoenix.motorcontrol; 002 003/** 004 * Choose the control mode for a TalonFX / Falcon 500. 005 */ 006public enum TalonFXControlMode 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 * Plays a single tone. Frequency (hz) is passed into set. 042 */ 043 MusicTone(13), 044 045 /** 046 * Disable Motor Controller 047 */ 048 Disabled(15); 049 050 /** 051 * Value of control mode 052 */ 053 public final int value; 054 055 /** 056 * Create TalonFXControlMode of initValue 057 * @param initValue Value of TalonFXControlMode 058 */ 059 TalonFXControlMode(int initValue) 060 { 061 this.value = initValue; 062 } 063 064 /** 065 * Helper method to convert to generic ControlMode enum. 066 * @return value cast as ControlMode 067 */ 068 public ControlMode toControlMode(){ 069 switch(value){ 070 case 0: return ControlMode.PercentOutput; 071 case 1: return ControlMode.Position; 072 case 2: return ControlMode.Velocity; 073 case 3: return ControlMode.Current; 074 case 5: return ControlMode.Follower; 075 case 6: return ControlMode.MotionProfile; 076 case 7: return ControlMode.MotionMagic; 077 case 10: return ControlMode.MotionProfileArc; 078 case 13: return ControlMode.MusicTone; 079 case 15: return ControlMode.Disabled; 080 default: return ControlMode.PercentOutput; 081 } 082 } 083};