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.configs;
008
009import com.ctre.phoenix6.StatusCode;
010import com.ctre.phoenix6.configs.jni.ConfigJNI;
011import com.ctre.phoenix6.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
037    
038
039    @Override
040    public String toString()
041    {
042        String ss = "Config Group: ClosedLoopGeneral\n";
043        ss += "Name: \"ContinuousWrap\" Value: \"" + ContinuousWrap + "\"" + "\n";
044        return ss;
045    }
046
047    /**
048     *
049     */
050    public StatusCode deserialize(String to_deserialize)
051    {
052        ContinuousWrap = ConfigJNI.Deserializeboolean(SpnValue.Config_ContinuousWrap.value, to_deserialize);
053        return  StatusCode.OK;
054    }
055
056    /**
057     *
058     */
059    public String serialize()
060    {
061        String ss = "";
062        ss += ConfigJNI.Serializeboolean(SpnValue.Config_ContinuousWrap.value, ContinuousWrap);
063        return ss;
064    }
065}
066