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 * Gravity Feedforward/Feedback Type 013 * <p> 014 * This determines the type of the gravity feedforward/feedback. 015 * <p> 016 * Choose Elevator_Static for systems where the gravity feedforward is constant, 017 * such as an elevator. The gravity feedforward output will always have the same 018 * sign. 019 * <p> 020 * Choose Arm_Cosine for systems where the gravity feedback is dependent on the 021 * angular position of the mechanism, such as an arm. The gravity feedback 022 * output will vary depending on the mechanism angular position. Note that the 023 * sensor offset and ratios must be configured so that the sensor reports a 024 * position of 0 when the mechanism is horizonal (parallel to the ground), and 025 * the reported sensor position is 1:1 with the mechanism. 026 */ 027public enum GravityTypeValue 028{ 029 Elevator_Static(0), 030 Arm_Cosine(1),; 031 032 public final int value; 033 034 GravityTypeValue(int initValue) 035 { 036 this.value = initValue; 037 } 038 039 private static HashMap<Integer, GravityTypeValue> _map = null; 040 static 041 { 042 _map = new HashMap<Integer, GravityTypeValue>(); 043 for (GravityTypeValue type : GravityTypeValue.values()) 044 { 045 _map.put(type.value, type); 046 } 047 } 048 049 /** 050 * Gets GravityTypeValue from specified value 051 * @param value Value of GravityTypeValue 052 * @return GravityTypeValue of specified value 053 */ 054 public static GravityTypeValue valueOf(int value) 055 { 056 GravityTypeValue retval = _map.get(value); 057 if (retval != null) return retval; 058 return GravityTypeValue.values()[0]; 059 } 060}