Mercs-MSA / 2024_V2

Other
1 stars 0 forks source link

Standard mechanism tuning feature using SysID #8

Open andvari101 opened 1 month ago

andvari101 commented 1 month ago

This project is to develop a standard SysID - based approach to mechanism tuning. This feature will provide a means for each mechanism, regardless of what it is, to have its PID and other control parameters quickly and easily tuned. A high level explanation of how this process works is described here: https://docs.wpilib.org/en/stable/docs/software/advanced-controls/system-identification/introduction.html

Example implementation for Phoenix6 API can found here: https://github.com/CrossTheRoadElec/Phoenix6-Examples/tree/main/java/PhoenixSysId

A template for mechanism classes which include support with the 4 test types (+/- Dynamic and +/- Quasi-Static) would allow for simple usage during the robot season. Ideally, there would be some code in the "TestPeriodic()" or similar method including something like:

        m_joystick.y().whileTrue(m_mechanism.sysIdQuasistatic(SysIdRoutine.Direction.kForward));
        m_joystick.a().whileTrue(m_mechanism.sysIdQuasistatic(SysIdRoutine.Direction.kReverse));
        m_joystick.b().whileTrue(m_mechanism.sysIdDynamic(SysIdRoutine.Direction.kForward));
        m_joystick.x().whileTrue(m_mechanism.sysIdDynamic(SysIdRoutine.Direction.kReverse));