001/* 002 * Copyright (C) Cross The Road Electronics. All rights reserved. 003 * License information can be found in CTRE_LICENSE.txt 004 * For support and suggestions contact support@ctr-electronics.com or file 005 * an issue tracker at https://github.com/CrossTheRoadElec/Phoenix-Releases 006 */ 007package com.ctre.phoenix6.signals; 008 009import java.util.HashMap; 010 011/** 012 * The behavior of the gain scheduler on this slot. This specifies which gains 013 * to use while within the configured GainSchedErrorThreshold. The default is to 014 * continue using the specified slot. 015 * <p> 016 * Gain scheduling will not take effect when running velocity closed-loop 017 * controls. 018 */ 019public enum GainSchedBehaviorValue 020{ 021 /** 022 * No gain scheduling will occur. 023 */ 024 Inactive(0), 025 /** 026 * The output of the PID controller will be completely zeroed, except for kG and 027 * the user FeedForward control request parameter. 028 */ 029 ZeroOutput(1), 030 /** 031 * Switch to Slot 0 while within the configured GainSchedErrorThreshold. 032 */ 033 UseSlot0(2), 034 /** 035 * Switch to Slot 1 while within the configured GainSchedErrorThreshold. 036 */ 037 UseSlot1(3), 038 /** 039 * Switch to Slot 2 while within the configured GainSchedErrorThreshold. 040 */ 041 UseSlot2(4),; 042 043 public final int value; 044 045 GainSchedBehaviorValue(int initValue) 046 { 047 this.value = initValue; 048 } 049 050 private static HashMap<Integer, GainSchedBehaviorValue> _map = null; 051 static 052 { 053 _map = new HashMap<Integer, GainSchedBehaviorValue>(); 054 for (GainSchedBehaviorValue type : GainSchedBehaviorValue.values()) 055 { 056 _map.put(type.value, type); 057 } 058 } 059 060 /** 061 * Gets GainSchedBehaviorValue from specified value 062 * @param value Value of GainSchedBehaviorValue 063 * @return GainSchedBehaviorValue of specified value 064 */ 065 public static GainSchedBehaviorValue valueOf(int value) 066 { 067 GainSchedBehaviorValue retval = _map.get(value); 068 if (retval != null) return retval; 069 return GainSchedBehaviorValue.values()[0]; 070 } 071}