Skip to content

Instantly share code, notes, and snippets.

@jcorcoran
jcorcoran / BlinkinLeds.java
Created February 6, 2024 22:16
Blinkin test code
package frc.robot.subsystems;
import edu.wpi.first.wpilibj.motorcontrol.Spark;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
public class BlinkinLeds extends SubsystemBase {
private Spark m_blinkinLeds;
private double m_currentLedMode;
public static BlinkinLeds instance = null;
@jcorcoran
jcorcoran / Shoulder.java
Created March 12, 2023 15:30
Example subsystem using smart motion on SPARKMax & NEO, angular position controller
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package frc.robot.subsystems;
import com.revrobotics.CANSparkMax;
import com.revrobotics.REVPhysicsSim;
import com.revrobotics.RelativeEncoder;
import com.revrobotics.SparkMaxPIDController;
@jcorcoran
jcorcoran / PigeonHelper.java
Created May 25, 2022 19:30
FRC helper classes to run at reduced can utilization rates
package org.team2168.utils;
import com.ctre.phoenix.sensors.PigeonIMU_StatusFrame;
import com.ctre.phoenix.sensors.WPI_PigeonIMU;
public class PigeonHelper extends WPI_PigeonIMU {
private static final int SLOWEST_REPORT_SPEED_MS = 255;
public PigeonHelper(int deviceID) {
@jcorcoran
jcorcoran / LimelightTest.java
Last active April 14, 2022 15:39
Revised TrajectoryFollow commands for FRC 3476 to fix bug where trajectory commands were not completeing. Upstream: https://github.com/WHS-FRC-3467/Skip-5.12/blob/master/src/main/java/frc/robot/Autonomous/LimelightTest.java
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package frc.robot.Autonomous;
import edu.wpi.first.wpilibj2.command.InstantCommand;
import edu.wpi.first.wpilibj2.command.PrintCommand;
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
import frc.robot.Feedback.Cameras.Limelight;
@jcorcoran
jcorcoran / Robot.java
Last active December 16, 2023 13:55
Example robot code for TalonFX (Falcon500) with MotionMagic
/**
* Phoenix Software License Agreement
*
* Copyright (C) Cross The Road Electronics. All rights
* reserved.
*
* Cross The Road Electronics (CTRE) licenses to you the right to
* use, publish, and distribute copies of CRF (Cross The Road) firmware files (*.crf) and
* Phoenix Software API Libraries ONLY when in use with CTR Electronics hardware products
* as well as the FRC roboRIO when in use in FRC Competition.
@jcorcoran
jcorcoran / ADXRS453Gyro.java
Created April 14, 2015 11:55
Source code to interface with the ADXRS453 Gyro for the 2015 FIRST robotics competition
package org.team2168.PID.sensors;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.BitSet;
import java.util.TimerTask;
import edu.wpi.first.wpilibj.SPI;
import edu.wpi.first.wpilibj.SPI.Port;
import edu.wpi.first.wpilibj.Timer;
@jcorcoran
jcorcoran / configure.xml
Created March 19, 2014 01:00
Stock 2014 ant/configure.xml
<project name="crio-configure">
<macrodef name="crio-configure">
<attribute name="remoteaddress"/>
<attribute name="type"/>
<attribute name="sunspot.home" default="${sunspot.home}"/>
<sequential>
<if>
<available file="${sunspot.home}/cRIO_conf" type="dir" />
@jcorcoran
jcorcoran / build.xml
Created March 19, 2014 00:57
Stock 2014 sunspotfrcsdk build.xml file
<project name="crio-project-build">
<!--
Supported Targets
jar
clean
deploy
run
javadoc
jar-deploy
-->
@jcorcoran
jcorcoran / JoystickAnalogButton.java
Last active February 10, 2024 15:58
This class turns an analog axis on a Joystick device, into a button which can be used to trigger commands.It is intended to be used with the WPILib Command Based robot project on FRC robots.
import edu.wpi.first.wpilibj.GenericHID;
import edu.wpi.first.wpilibj.buttons.Button;
/**
* This class allows you to trigger commands from an analog input on
* a joystick (sich as the triggers - Axis 3).
*
*
* The following example code placed in OI class turns axis 3 into two buttons:
* ----------------------------------------------------------------------------
@jcorcoran
jcorcoran / Camera.java
Created March 23, 2013 17:36
Java image processing code that runs on the cRIO. Written for the 2012 FRC season.
package frc2168.subsystems;
import edu.wpi.first.wpilibj.camera.AxisCamera;
import edu.wpi.first.wpilibj.camera.AxisCameraException;
import edu.wpi.first.wpilibj.command.Subsystem;
import edu.wpi.first.wpilibj.image.BinaryImage;
import edu.wpi.first.wpilibj.image.ColorImage;
import edu.wpi.first.wpilibj.image.NIVisionException;
import edu.wpi.first.wpilibj.image.ParticleAnalysisReport;
import frc2168.RobotMap;