Use CTRE Tuner X documentation.
https://v6.docs.ctr-electronics.com/en/stable/docs/tuner/tuner-swerve/index.html
Raise robot so wheels are off of surfaces
Straighten wheels out
Connect to RoboRIO using USB-B cord
3. Self-Test Snapshot the wheel using Phoenix Tuner
4. Copy Absolute Position
5. Paste into SwerveModuleConstant angle offsets
6. Rinse and repeat
Proportional, Integral, Derivative
(orange is before characterization and the green is after)
For PID we focus on the P and when there is oscillation D brings the oscillating down and stops the over correcting
When using SysID, you have 4 auto options for characterization and tuning: Quasistatic Forward & Backward, and Dynamic Forward & Backward. It is recommended to map these to buttons on a controller (temporarily):
controller.back().and(controller.y()).whileTrue(drive.sysIdDynamic(Direction.kForward));
controller.back().and(controller.x()).whileTrue(drive.sysIdDynamic(Direction.kReverse));
controller.start().and(controller.y()).whileTrue(drive.sysIdQuasistatic(Direction.kForward));
controller.start().and(controller.x()).whileTrue(drive.sysIdQuasistatic(Direction.kReverse));
Typically use a USB drive in the RoboRio for logging. After running all four of these tests, it will log the values in the latest WpiLog under /logs/.
You can use the SysID tool included in AdvantageKit to open the WpiLog.
In the top left window, click [Open data log file...] and open your .wpilog.
With this WpiLog open, you need to set the Test State (bottom left window). Drag from the top left window, usually under RealOutputs/Drive/SysIdState.
Change the analysis type to simple
Drag one of the modules' values for Velocity, Position, and Voltage to the empty fields.
Set the units to Radians (if not using hoot), then click "load".
Once loaded, the calculated values will appear in the center, and graphs on the right will reflect the data. On the diagnostic plots, for all of the R2 values, aim to get them as close to 1.0 as possible, by running longer characterization sessions.
It is recommended to use .hoot files to record the SysIDs, as .hoot files are way lighter and easier to use once set up. Use SignalLogger to log the session (and the characterization) to a .hoot file. You need to use the SignalLogger to log .hoot files.
At the start of the session:
SignalLogger.setPath("/media/sda1/"); // Or whatever path we want to log to
SignalLogger.start();
At the end of the session:
SignalLogger.stop();
It is recommended to place the start in a TeleopInit method or otherwise, and to place the stop in a DisabledInit method, so it only logs the enabled session. To make sure that the SysIdState is logged to the hoot, change the definition of the SysIDRoutine (usually in Drive.java) to use:
(state) -> Logger.recordOutput("Drive/SysIdState", state.toString())),
Turns into:
(state) -> SignalLogger.wr
iteString("state", state.toString())),
Then, use Phoenix Tuner X (after running Characterization) to download the .hoots, and to convert them to .wpilog files. You can load these into the SysId tool and use them like before,but instead of using modules, you will need to find the IDs of the drive motors and look at those. You will also need to change the units to Rotations.
Set P to 1 and increase until the wheels start oscillating
Then you will increase D until it stops oscillating
What this does is P gets it to the set point and D
Path planner is an app downloaded from the microsoft store
Max speed, Max exelaration, Width, length in path planner must match the code
Make sure the robot facings in pathpplanner match the physical robot facing.
There is an opeion in simulation to add a field2D
Adding the field image- the three lines on the top right select field image and upload image
download-https://github.com/Mechanical-Advantage/AdvantageScope
On the bottom of this site there is a installation for advantage scope
You can connect to simulation or the actual robot using file -> connect to
robot or file -> connect to simulation
You must be connected to the robot threw wifi in order to connect
Plus sign in the top right allows you to add tools such as, odometry, 2D and 3d fields controllers, table and swerve
Ghost shows where the robot physically is compared to what the robot should be doing
This helps to tune PID controllers
Add Smart dashboard/PPSwerveControllerCommand_feild/robot to
2DPose in 3D Feild
Pose in odomitry
Fields in swerve
Or add the outputs and inputs to table