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; 010 011/** 012 * Class description for the Pigeon 2 IMU sensor that measures orientation. 013 * 014 * This handles the configurations for the {@link com.ctre.phoenixpro.hardware.Pigeon2} 015 * 016 * @deprecated Classes in the phoenixpro package will be removed in 2024. 017 * Users should instead use classes from the phoenix6 package. 018 */ 019@Deprecated(forRemoval = true) 020public class Pigeon2Configuration implements ParentConfiguration 021{ 022 /** 023 * True if we should factory default newer unsupported configs, 024 * false to leave newer unsupported configs alone. 025 * <p> 026 * This flag addresses a corner case where the device may have 027 * firmware with newer configs that didn't exist when this 028 * version of the API was built. If this occurs and this 029 * flag is true, unsupported new configs will be factory 030 * defaulted to avoid unexpected behavior. 031 * <p> 032 * This is also the behavior in Phoenix 5, so this flag 033 * is defaulted to true to match. 034 */ 035 public boolean FutureProofConfigs = true; 036 037 038 /** 039 * Configs for Pigeon 2's Mount Pose configuration. 040 * <p> 041 * These configs allow the Pigeon2 to be mounted in whatever 042 * orientation that's desired and ensure the reported Yaw/Pitch/Roll 043 * is from the robot's reference. 044 */ 045 public MountPoseConfigs MountPose = new MountPoseConfigs(); 046 047 /** 048 * Configs to trim the Pigeon2's gyroscope. 049 * <p> 050 * Pigeon2 allows the user to trim the gyroscope's sensitivity. While 051 * this isn't necessary for the Pigeon2, as it comes calibrated 052 * out-of-the-box, users can make use of this to make the Pigeon2 053 * even more accurate for their application. 054 */ 055 public GyroTrimConfigs GyroTrim = new GyroTrimConfigs(); 056 057 /** 058 * Configs to enable/disable various features of the Pigeon2. 059 * <p> 060 * These configs allow the user to enable or disable various aspects 061 * of the Pigeon2. 062 */ 063 public Pigeon2FeaturesConfigs Pigeon2Features = new Pigeon2FeaturesConfigs(); 064 065 @Override 066 public String toString() 067 { 068 String ss = ""; 069 ss += MountPose.toString(); 070 ss += GyroTrim.toString(); 071 ss += Pigeon2Features.toString(); 072 return ss; 073 } 074 075 /** 076 * Get the serialized form of this configuration 077 * 078 * @return Serialized form of this config group 079 */ 080 public String serialize() 081 { 082 String ss = ""; 083 ss += MountPose.serialize(); 084 ss += GyroTrim.serialize(); 085 ss += Pigeon2Features.serialize(); 086 return ss; 087 } 088 089 /** 090 * Take a string and deserialize it to this configuration 091 * 092 * @return Return code of the deserialize method 093 */ 094 public StatusCode deserialize(String string) 095 { 096 StatusCode err = StatusCode.OK; 097 err = MountPose.deserialize(string); 098 err = GyroTrim.deserialize(string); 099 err = Pigeon2Features.deserialize(string); 100 return err; 101 } 102};