Running the Identification Routine¶
Once the code has been deployed, we can now run the system identification routine, and record the resulting data for analysis.
Warning
Only log files with a single routine in them are usable for analysis. Multiple motors can be run in one routine, but they must be run at the same time. If you run a routine on one motor and then run a routine on another motor without extracting the log or power-cycling the roboRIO in between, analysis will fail.
Before characterization¶
There are a couple of important things to consider before running the characterization tests.
Characterization Can Be Dangerous:
Danger
Always use caution when mechanisms are moving and ensure that the robot can be disabled swiftly at any time!
Since characterization applies a scaling (quasistatic) or constant (dynamic) voltage to the motor, it can very easily hit a wall (drivetrain) or break the mechanism (elevator) if unprepared. Ensure that the ramp rate is set appropriately and adequate space is given for the tests.
Ensure Adequate Space
If the mechanism is continuous (swerve azimuth or a flywheel), then this is not an issue. However, mechanisms such as a drivetrain or elevator have a limited degree of movement. Ensure the configuration parameters match what is possible, and be prepared to disable the robot early.
For the drivetrain characterization, the WPILib developers recommend 3-6 m and CTRE recommends 15 m of clear space.
The robot drive can not be accurately characterized while on blocks.
Don’t hit the hard stop: Running the mechanism past the end of its range of motion might cause SysID to think the mechanism has more friction than it actually does.
Slow it down: If the routine is running too fast to record high-quality data, change the parameters passed to
SysIdRoutine.Configto make it run slower.
Only Run Each Test Once
Limitations of the SysId desktop utility prevent multiple of the same tests to be properly analyzed. Ensure each test is run exactly once.
Running Tests¶
Perform the tests using the bindings you created in the previous section.
Warning
Watch out for your mechanism and stop the test early if it exceeds safe limits! The routine only creates voltage commands for you to connect to your motors, it is up to you to set up hard or soft limits to prevent injury or damage.
The quasistatic test will slowly ramp up voltage until the button has been released or a timeout has been hit. It is always safe to end the tests early, but at least ~3-5 seconds of data is necessary. Ensure ramp rate is configured such that this can be accomplished.
The dynamic test will immediately run the mechanism at the target voltage. This voltage may need to be adjusted if there is not sufficient room for the test.
With the routines configured and buttons set up, the characterization tests can be performed. To keep things simple and debuggable, perform tests in the following order.
Quasistatic forward
Quasistatic reverse
Dynamic forward
Dynamic reverse
Ensure each test is ran once, and only once. If a test is accidentally started multiple times, stop and restart the Signal Logger and try again.
The entire routine should look something like this:
Note
A drivetrain routine is shown below, but the same motions will occur on any mechanism.
Extracting Logs¶
WPILib logging¶
After recording your log, you must extract it from the roboRIO. WPILib logging will leave a .wpilog on the roboRIO, which can be downloaded remotely using DataLogTool. If a USB flash drive was plugged into the SystemCore and had sufficient free space, the log will have been recorded to it, so unplugging the drive and copying the file onto your computer is also possible.
After the log file is in hand, open the SysId application and proceed to Loading Data.
Phoenix 6 Signal Logger¶
Once you have a log with all the tests, you can use Tuner X or the owlet CLI tool to extract the hoot log to WPILOG. The exported WPILOG can then be loaded into SysId <https://docs.wpilib.org/en/stable/docs/software/advanced-controls/system-identification/loading-data.html>__ for analysis using the Talon FX Position, Velocity, and MotorVoltage signals.
.. important:: We recommend users do not use third-party tools to export a hoot log to WPILOG. Doing so may result in a lossy conversion that impacts the quality of the SysId analysis. This is particularly true in simulation, where a lossy export can result in SysId failing to analyze the data.