Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jhh
jhh / health_check.md
Last active April 12, 2022 15:58
Requirements for Third Coast Health Check

Requirements

  1. Configure using config.toml and limits.toml in deploy/healthcheck directory. Possibly combine into one file. What is the best way to deal with overwriting in deploy during deployment?
  2. Add a simple interface to Subsystems. This should be the only coding required.
  3. Scan limits.toml and add any missing tests from config.toml with sane limits automatically.
  4. Re-running healthcheck will load the config.toml and limits.toml for faster iterations while tuning tests.
  5. Create robotRIO embedded web server output directory automatically.
  6. Need to test things other than motors?

Tests

@jhh
jhh / odometry_protocol.md
Last active March 18, 2022 12:27
Odometry Test Protocol

Odometry Test Protocol

The objective is to evaluate how well our robot's swerve drive odometry tracks with actual field position while experiencing normal match driving for the duration of a match. We will capture odometry calculated Pose2d field position using the Third Coast telemetry system already on the robot.

Preparation

We need to do some up-front preparation to allow us to correlate the actual position of the robot on the field in the captured odometry Pose2d position time series.

  1. Decide how many field reference positions (1 or more) you will use. These will be field positions the robot drive goes to periodically during the test run. You can mark these on the field however you like (tape, red solo cups, etc).
@jhh
jhh / azimuthEncoder.java
Last active January 16, 2019 19:29
Azimuth Encoder Calcs
public class Main {
public static void main(String[] args) {
minRotationIEEERemainder(4095, 1); // expect +2
minRotationIEEERemainder(10 * 0x1000 + 4095, 1); // same, plus 10 revolutions
minRotationIEEERemainder(-1024, 1024); // expect +/- 2048
minRotationIEEERemainder(10 * 0x1000 - 1024, 1024); // same, plus 10 revolutions
minRotationIEEERemainder(2730, 1365); // 240 -> 120 expect -120 (-1365)
minRotationIEEERemainder(10 * 0x1000 + 2730, 1365); // 240 -> 120 expect -120 (-1365)
@jhh
jhh / azimuth.java
Last active January 16, 2019 15:40
Third Coast Azimuth TalonSRX Settings
// azimuth talon configuration
// NOTE: do not rely on these PID parameters, you should tune for your physical plant
TalonSRXConfiguration azimuthConfig = new TalonSRXConfiguration();
azimuthConfig.primaryPID.selectedFeedbackSensor = FeedbackDevice.CTRE_MagEncoder_Relative;
azimuthConfig.continuousCurrentLimit = 10;
azimuthConfig.peakCurrentDuration = 0;
azimuthConfig.peakCurrentLimit = 0;
azimuthConfig.slot0.kP = 10.0;
azimuthConfig.slot0.kI = 0.0;
@jhh
jhh / wheel.java
Last active January 16, 2019 19:10
Minimum Swerve Wheel Rotation
public class Main {
public static void main(String[] args) {
minRotation(359, 0);
minRotation(359, 1);
minRotation(90, -90);
minRotation(180, -180);
minRotationWithReverse(359, 1);
minRotationWithReverse(90, -90);
minRotationWithReverse(180, -180);
@jhh
jhh / Wheel Test 2018-09-25.ipynb
Created September 26, 2018 13:26
Wheel Test 2018-09-25
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Run Expected (cm) Actual (cm) Comments
1 700 644.0 pA = 0.0, pD = 0.0
2 700 641.0 pA = -0.004, pD = 0.0
3 700 649.0 pA = -0.004, pD = 0.0
4 700 692.0 pA = -0.004, pD = 4e-6
5 700 693.5 pA = -0.004, pD = 4e-6
6 700 693.0 pA = -0.004, pD = 4e-6
Climber
Left CAN=20 PDP=12
Right CAN=21 PDP=13
Intake
Left CAN=30 PDP=10
Right CAN=31 PDP=9
Shoulder
CAN=40 PDP=11
@jhh
jhh / params.java
Last active February 1, 2018 13:35
// factory reset a talon and run these statements in a robot program
double value = talon.configGetParameter(ParamEnum.eBatteryVoltageFilterSize, 0, 10)
System.out.println("voltage filter size = " + value);
value = talon.configGetParameter(ParamEnum.eProfileParamSlot_MaxIAccum, 0, 10)
System.out.println("max I-accum = " + value);
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.