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 to trim the Pigeon2's gyroscope.
015 * <p>
016 *  Pigeon2 allows the user to trim the gyroscope's sensitivity. While
017 *  this isn't necessary for the Pigeon2, as it comes calibrated
018 *  out-of-the-box, users can make use of this to make the Pigeon2
019 *  even more accurate for their application.
020 *
021 * @deprecated Classes in the phoenixpro package will be removed in 2024.
022 *             Users should instead use classes from the phoenix6 package.
023 */
024@Deprecated(forRemoval = true)
025public class GyroTrimConfigs implements ParentConfiguration
026{
027    /**
028     * The gyro scalar component for the X axis
029     *
030     *  <ul>
031     *  <li> <b>Minimum Value:</b> -180
032     *  <li> <b>Maximum Value:</b> 180
033     *  <li> <b>Default Value:</b> 0
034     *  <li> <b>Units:</b> deg per rotation
035     *  </ul>
036     */
037    public double GyroScalarX = 0;
038    /**
039     * The gyro scalar component for the Y axis
040     *
041     *  <ul>
042     *  <li> <b>Minimum Value:</b> -180
043     *  <li> <b>Maximum Value:</b> 180
044     *  <li> <b>Default Value:</b> 0
045     *  <li> <b>Units:</b> deg per rotation
046     *  </ul>
047     */
048    public double GyroScalarY = 0;
049    /**
050     * The gyro scalar component for the Z axis
051     *
052     *  <ul>
053     *  <li> <b>Minimum Value:</b> -180
054     *  <li> <b>Maximum Value:</b> 180
055     *  <li> <b>Default Value:</b> 0
056     *  <li> <b>Units:</b> deg per rotation
057     *  </ul>
058     */
059    public double GyroScalarZ = 0;
060
061    @Override
062    public String toString()
063    {
064        String ss = "Config Group: GyroTrim\n";
065        ss += "Name: \"GyroScalarX\" Value: \"" + GyroScalarX + "deg per rotation\"" + "\n";
066        ss += "Name: \"GyroScalarY\" Value: \"" + GyroScalarY + "deg per rotation\"" + "\n";
067        ss += "Name: \"GyroScalarZ\" Value: \"" + GyroScalarZ + "deg per rotation\"" + "\n";
068        return ss;
069    }
070
071    /**
072     *
073     */
074    public StatusCode deserialize(String string)
075    {
076        GyroScalarX = ConfigJNI.Deserializedouble(SpnValue.Pigeon2GyroScalarX.value, string);
077        GyroScalarY = ConfigJNI.Deserializedouble(SpnValue.Pigeon2GyroScalarY.value, string);
078        GyroScalarZ = ConfigJNI.Deserializedouble(SpnValue.Pigeon2GyroScalarZ.value, string);
079        return  StatusCode.OK;
080    }
081
082    /**
083     *
084     */
085    public String serialize()
086    {
087        String ss = "";
088        ss += ConfigJNI.Serializedouble(958, GyroScalarX);
089        ss += ConfigJNI.Serializedouble(959, GyroScalarY);
090        ss += ConfigJNI.Serializedouble(960, GyroScalarZ);
091        return ss;
092    }
093}
094