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.phoenixpro.StatusCode;
010import com.ctre.phoenixpro.configs.jni.ConfigJNI;
011import com.ctre.phoenixpro.spns.*;
012
013/**
014 *  Configs that affect general behavior during closed-looping.
015 * <p>
016 *  Includes Continuous Wrap features.
017 */
018public class ClosedLoopGeneralConfigs implements ParentConfiguration
019{
020    /**
021     * Wrap position error within [-0.5,+0.5) mechanism rotations. 
022     * Typically used for continuous position closed-loops like swerve
023     * azimuth.
024     * <p>
025     * This uses the mechanism rotation value. If there is a gear ratio
026     * between the sensor and the mechanism, make sure to apply a
027     * SensorToMechanismRatio so the closed loop operates on the full
028     * rotation.
029     *
030     *  <ul>
031     *  <li> <b>Default Value:</b> False
032     *  </ul>
033     */
034    public boolean ContinuousWrap = false;
035
036    @Override
037    public String toString()
038    {
039        String ss = "Config Group: ClosedLoopGeneral\n";
040        ss += "Name: \"ContinuousWrap\" Value: \"" + ContinuousWrap + "\"" + "\n";
041        return ss;
042    }
043
044    /**
045     *
046     */
047    public StatusCode deserialize(String string)
048    {
049        ContinuousWrap = ConfigJNI.Deserializeboolean(SpnValue.Config_ContinuousWrap.value, string);
050        return  StatusCode.OK;
051    }
052
053    /**
054     *
055     */
056    public String serialize()
057    {
058        String ss = "";
059        ss += ConfigJNI.Serializeboolean(1499, ContinuousWrap);
060        return ss;
061    }
062}
063