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.phoenixpro.configs; 008 009import com.ctre.phoenix6.StatusCode; 010import com.ctre.phoenix6.configs.jni.ConfigJNI; 011import com.ctre.phoenix6.spns.*; 012 013/** 014 * Configs that directly affect motor-output. 015 * <p> 016 * Includes Motor Invert and various limit features. 017 * 018 * @deprecated Classes in the phoenixpro package will be removed in 2024. 019 * Users should instead use classes from the phoenix6 package. 020 */ 021@Deprecated(forRemoval = true) 022public class MotionMagicConfigs implements ParentConfiguration 023{ 024 /** 025 * This is the maximum velocity Motion Magic® based control modes are 026 * allowed to use. 027 * 028 * <ul> 029 * <li> <b>Minimum Value:</b> 0 030 * <li> <b>Maximum Value:</b> 3.4e+38 031 * <li> <b>Default Value:</b> 0 032 * <li> <b>Units:</b> rps 033 * </ul> 034 */ 035 public double MotionMagicCruiseVelocity = 0; 036 /** 037 * This is the target acceleration Motion Magic® based control modes 038 * are allowed to use. 039 * 040 * <ul> 041 * <li> <b>Minimum Value:</b> 0 042 * <li> <b>Maximum Value:</b> 3.4e+38 043 * <li> <b>Default Value:</b> 0 044 * <li> <b>Units:</b> rot per sec² 045 * </ul> 046 */ 047 public double MotionMagicAcceleration = 0; 048 /** 049 * This is the target jerk (acceleration derivative) Motion Magic® 050 * based control modes are allowed to use. This allows Motion Magic® 051 * support of S-Curves. If this is set to zero, then Motion Magic® 052 * will not apply a Jerk limit. 053 * 054 * <ul> 055 * <li> <b>Minimum Value:</b> 0 056 * <li> <b>Maximum Value:</b> 3.4e+38 057 * <li> <b>Default Value:</b> 0 058 * <li> <b>Units:</b> rot per sec³ 059 * </ul> 060 */ 061 public double MotionMagicJerk = 0; 062 063 @Override 064 public String toString() 065 { 066 String ss = "Config Group: MotionMagic\n"; 067 ss += "Name: \"MotionMagicCruiseVelocity\" Value: \"" + MotionMagicCruiseVelocity + "rps\"" + "\n"; 068 ss += "Name: \"MotionMagicAcceleration\" Value: \"" + MotionMagicAcceleration + "rot per sec²\"" + "\n"; 069 ss += "Name: \"MotionMagicJerk\" Value: \"" + MotionMagicJerk + "rot per sec³\"" + "\n"; 070 return ss; 071 } 072 073 /** 074 * 075 */ 076 public StatusCode deserialize(String string) 077 { 078 MotionMagicCruiseVelocity = ConfigJNI.Deserializedouble(SpnValue.Config_MotionMagicCruiseVelocity.value, string); 079 MotionMagicAcceleration = ConfigJNI.Deserializedouble(SpnValue.Config_MotionMagicAcceleration.value, string); 080 MotionMagicJerk = ConfigJNI.Deserializedouble(SpnValue.Config_MotionMagicJerk.value, string); 081 return StatusCode.OK; 082 } 083 084 /** 085 * 086 */ 087 public String serialize() 088 { 089 String ss = ""; 090 ss += ConfigJNI.Serializedouble(1465, MotionMagicCruiseVelocity); 091 ss += ConfigJNI.Serializedouble(1466, MotionMagicAcceleration); 092 ss += ConfigJNI.Serializedouble(1467, MotionMagicJerk); 093 return ss; 094 } 095} 096