mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
SCRIPT Move java files
This commit is contained in:
committed by
Peter Johnson
parent
7ca1be9bae
commit
c350c5f112
@@ -0,0 +1,25 @@
|
||||
// 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 edu.wpi.first.wpilibj.snippets.accelerometercollision;
|
||||
|
||||
import edu.wpi.first.wpilibj.RobotBase;
|
||||
|
||||
/**
|
||||
* Do NOT add any static variables to this class, or any initialization at all. Unless you know what
|
||||
* you are doing, do not modify this file except to change the parameter class to the startRobot
|
||||
* call.
|
||||
*/
|
||||
public final class Main {
|
||||
private Main() {}
|
||||
|
||||
/**
|
||||
* Main initialization function. Do not perform any initialization here.
|
||||
*
|
||||
* <p>If you change your main robot class, change the parameter type.
|
||||
*/
|
||||
public static void main(String... args) {
|
||||
RobotBase.startRobot(Robot::new);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
// 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 edu.wpi.first.wpilibj.snippets.accelerometercollision;
|
||||
|
||||
import edu.wpi.first.wpilibj.OnboardIMU;
|
||||
import edu.wpi.first.wpilibj.OnboardIMU.MountOrientation;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
|
||||
|
||||
/**
|
||||
* Collision detection snippets for frc-docs.
|
||||
* https://docs.wpilib.org/en/stable/docs/software/hardware-apis/sensors/accelerometers-software.html
|
||||
*/
|
||||
@SuppressWarnings("checkstyle:VariableDeclarationUsageDistance")
|
||||
public class Robot extends TimedRobot {
|
||||
double m_prevXAccel;
|
||||
double m_prevYAccel;
|
||||
OnboardIMU m_accelerometer = new OnboardIMU(MountOrientation.kFlat);
|
||||
|
||||
@Override
|
||||
public void robotPeriodic() {
|
||||
// Gets the current accelerations in the X and Y directions
|
||||
double xAccel = m_accelerometer.getAccelX();
|
||||
double yAccel = m_accelerometer.getAccelY();
|
||||
// Calculates the jerk in the X and Y directions
|
||||
// Divides by .02 because default loop timing is 20ms
|
||||
double xJerk = (xAccel - m_prevXAccel) / 0.02;
|
||||
double yJerk = (yAccel - m_prevYAccel) / 0.02;
|
||||
m_prevXAccel = xAccel;
|
||||
m_prevYAccel = yAccel;
|
||||
|
||||
SmartDashboard.putNumber("X Jerk", xJerk);
|
||||
SmartDashboard.putNumber("Y Jerk", yJerk);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// 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 edu.wpi.first.wpilibj.snippets.accelerometerfilter;
|
||||
|
||||
import edu.wpi.first.wpilibj.RobotBase;
|
||||
|
||||
/**
|
||||
* Do NOT add any static variables to this class, or any initialization at all. Unless you know what
|
||||
* you are doing, do not modify this file except to change the parameter class to the startRobot
|
||||
* call.
|
||||
*/
|
||||
public final class Main {
|
||||
private Main() {}
|
||||
|
||||
/**
|
||||
* Main initialization function. Do not perform any initialization here.
|
||||
*
|
||||
* <p>If you change your main robot class, change the parameter type.
|
||||
*/
|
||||
public static void main(String... args) {
|
||||
RobotBase.startRobot(Robot::new);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// 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 edu.wpi.first.wpilibj.snippets.accelerometerfilter;
|
||||
|
||||
import edu.wpi.first.math.filter.LinearFilter;
|
||||
import edu.wpi.first.wpilibj.OnboardIMU;
|
||||
import edu.wpi.first.wpilibj.OnboardIMU.MountOrientation;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
|
||||
|
||||
/**
|
||||
* Accelerometer filtering snippets for frc-docs.
|
||||
* https://docs.wpilib.org/en/stable/docs/software/hardware-apis/sensors/accelerometers-software.html
|
||||
*/
|
||||
public class Robot extends TimedRobot {
|
||||
OnboardIMU m_accelerometer = new OnboardIMU(MountOrientation.kFlat);
|
||||
// Create a LinearFilter that will calculate a moving average of the measured X acceleration over
|
||||
// the past 10 iterations of the main loop
|
||||
LinearFilter m_xAccelFilter = LinearFilter.movingAverage(10);
|
||||
|
||||
@Override
|
||||
public void robotPeriodic() {
|
||||
double xAccel = m_accelerometer.getAccelX();
|
||||
// Get the filtered X acceleration
|
||||
double filteredXAccel = m_xAccelFilter.calculate(xAccel);
|
||||
|
||||
SmartDashboard.putNumber("X Acceleration", xAccel);
|
||||
SmartDashboard.putNumber("Filtered X Acceleration", filteredXAccel);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// 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 edu.wpi.first.wpilibj.snippets.adxlaccelerometers;
|
||||
|
||||
import edu.wpi.first.wpilibj.RobotBase;
|
||||
|
||||
/**
|
||||
* Do NOT add any static variables to this class, or any initialization at all. Unless you know what
|
||||
* you are doing, do not modify this file except to change the parameter class to the startRobot
|
||||
* call.
|
||||
*/
|
||||
public final class Main {
|
||||
private Main() {}
|
||||
|
||||
/**
|
||||
* Main initialization function. Do not perform any initialization here.
|
||||
*
|
||||
* <p>If you change your main robot class, change the parameter type.
|
||||
*/
|
||||
public static void main(String... args) {
|
||||
RobotBase.startRobot(Robot::new);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// 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 edu.wpi.first.wpilibj.snippets.adxlaccelerometers;
|
||||
|
||||
import edu.wpi.first.wpilibj.ADXL345_I2C;
|
||||
import edu.wpi.first.wpilibj.I2C;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
|
||||
/**
|
||||
* ADXL345, 362 Accelerometer snippets for frc-docs.
|
||||
* https://docs.wpilib.org/en/stable/docs/software/hardware-apis/sensors/accelerometers-software.html
|
||||
*/
|
||||
public class Robot extends TimedRobot {
|
||||
// Creates an ADXL345 accelerometer object on the MXP I2C port
|
||||
// with a measurement range from -8 to 8 G's
|
||||
ADXL345_I2C m_accelerometer345I2C = new ADXL345_I2C(I2C.Port.kPort0, ADXL345_I2C.Range.k8G);
|
||||
|
||||
/** Called once at the beginning of the robot program. */
|
||||
public Robot() {}
|
||||
|
||||
@Override
|
||||
public void teleopPeriodic() {
|
||||
// Gets the current acceleration in the X axis
|
||||
m_accelerometer345I2C.getX();
|
||||
// Gets the current acceleration in the Y axis
|
||||
m_accelerometer345I2C.getY();
|
||||
// Gets the current acceleration in the Z axis
|
||||
m_accelerometer345I2C.getZ();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// 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 edu.wpi.first.wpilibj.snippets.analogaccelerometer;
|
||||
|
||||
import edu.wpi.first.wpilibj.RobotBase;
|
||||
|
||||
/**
|
||||
* Do NOT add any static variables to this class, or any initialization at all. Unless you know what
|
||||
* you are doing, do not modify this file except to change the parameter class to the startRobot
|
||||
* call.
|
||||
*/
|
||||
public final class Main {
|
||||
private Main() {}
|
||||
|
||||
/**
|
||||
* Main initialization function. Do not perform any initialization here.
|
||||
*
|
||||
* <p>If you change your main robot class, change the parameter type.
|
||||
*/
|
||||
public static void main(String... args) {
|
||||
RobotBase.startRobot(Robot::new);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// 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 edu.wpi.first.wpilibj.snippets.analogaccelerometer;
|
||||
|
||||
import edu.wpi.first.wpilibj.AnalogAccelerometer;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
|
||||
/**
|
||||
* AnalogAccelerometer snippets for frc-docs.
|
||||
* https://docs.wpilib.org/en/stable/docs/software/hardware-apis/sensors/accelerometers-software.html
|
||||
*/
|
||||
public class Robot extends TimedRobot {
|
||||
// Creates an analog accelerometer on analog input 0
|
||||
AnalogAccelerometer m_accelerometer = new AnalogAccelerometer(0);
|
||||
|
||||
/** Called once at the beginning of the robot program. */
|
||||
public Robot() {
|
||||
// Sets the sensitivity of the accelerometer to 1 volt per G
|
||||
m_accelerometer.setSensitivity(1);
|
||||
// Sets the zero voltage of the accelerometer to 3 volts
|
||||
m_accelerometer.setZero(3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void teleopPeriodic() {
|
||||
// Gets the current acceleration
|
||||
m_accelerometer.getAcceleration();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// 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 edu.wpi.first.wpilibj.snippets.analogencoder;
|
||||
|
||||
import edu.wpi.first.wpilibj.RobotBase;
|
||||
|
||||
/**
|
||||
* Do NOT add any static variables to this class, or any initialization at all. Unless you know what
|
||||
* you are doing, do not modify this file except to change the parameter class to the startRobot
|
||||
* call.
|
||||
*/
|
||||
public final class Main {
|
||||
private Main() {}
|
||||
|
||||
/**
|
||||
* Main initialization function. Do not perform any initialization here.
|
||||
*
|
||||
* <p>If you change your main robot class, change the parameter type.
|
||||
*/
|
||||
public static void main(String... args) {
|
||||
RobotBase.startRobot(Robot::new);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// 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 edu.wpi.first.wpilibj.snippets.analogencoder;
|
||||
|
||||
import edu.wpi.first.wpilibj.AnalogEncoder;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
|
||||
/**
|
||||
* AnalogEncoder snippets for frc-docs.
|
||||
* https://docs.wpilib.org/en/stable/docs/software/hardware-apis/sensors/encoders-software.html
|
||||
*/
|
||||
public class Robot extends TimedRobot {
|
||||
// Initializes an analog encoder on Analog Input pin 0
|
||||
AnalogEncoder m_encoder = new AnalogEncoder(0);
|
||||
|
||||
// Initializes an analog encoder on DIO pins 0 to return a value of 4 for
|
||||
// a full rotation, with the encoder reporting 0 half way through rotation (2
|
||||
// out of 4)
|
||||
AnalogEncoder m_encoderFR = new AnalogEncoder(0, 4.0, 2.0);
|
||||
|
||||
/** Called once at the beginning of the robot program. */
|
||||
public Robot() {}
|
||||
|
||||
@Override
|
||||
public void teleopPeriodic() {
|
||||
// Gets the rotation
|
||||
m_encoder.get();
|
||||
|
||||
m_encoderFR.get();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// 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 edu.wpi.first.wpilibj.snippets.analoginput;
|
||||
|
||||
import edu.wpi.first.wpilibj.RobotBase;
|
||||
|
||||
/**
|
||||
* Do NOT add any static variables to this class, or any initialization at all. Unless you know what
|
||||
* you are doing, do not modify this file except to change the parameter class to the startRobot
|
||||
* call.
|
||||
*/
|
||||
public final class Main {
|
||||
private Main() {}
|
||||
|
||||
/**
|
||||
* Main initialization function. Do not perform any initialization here.
|
||||
*
|
||||
* <p>If you change your main robot class, change the parameter type.
|
||||
*/
|
||||
public static void main(String... args) {
|
||||
RobotBase.startRobot(Robot::new);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
// 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 edu.wpi.first.wpilibj.snippets.analoginput;
|
||||
|
||||
import edu.wpi.first.wpilibj.AnalogInput;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
|
||||
/**
|
||||
* AnalogInput snippets for frc-docs.
|
||||
* https://docs.wpilib.org/en/stable/docs/software/hardware-apis/sensors/analog-inputs-software.html
|
||||
*/
|
||||
public class Robot extends TimedRobot {
|
||||
// Initializes an AnalogInput on port 0
|
||||
AnalogInput m_analog = new AnalogInput(0);
|
||||
|
||||
/** Called once at the beginning of the robot program. */
|
||||
public Robot() {
|
||||
// Sets the AnalogInput to 4-bit oversampling. 16 samples will be added together.
|
||||
// Thus, the reported values will increase by about a factor of 16, and the update
|
||||
// rate will decrease by a similar amount.
|
||||
m_analog.setOversampleBits(4);
|
||||
|
||||
// Sets the AnalogInput to 4-bit averaging. 16 samples will be averaged together.
|
||||
// The update rate will decrease by a factor of 16.
|
||||
m_analog.setAverageBits(4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void teleopPeriodic() {
|
||||
// Gets the raw instantaneous measured value from the analog input, without
|
||||
// applying any calibration and ignoring oversampling and averaging
|
||||
// settings.
|
||||
m_analog.getValue();
|
||||
|
||||
// Gets the instantaneous measured voltage from the analog input.
|
||||
// Oversampling and averaging settings are ignored
|
||||
m_analog.getVoltage();
|
||||
|
||||
// Gets the averaged value from the analog input. The value is not
|
||||
// rescaled, but oversampling and averaging are both applied.
|
||||
m_analog.getAverageValue();
|
||||
|
||||
// Gets the averaged voltage from the analog input. Rescaling,
|
||||
// oversampling, and averaging are all applied.
|
||||
m_analog.getAverageVoltage();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// 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 edu.wpi.first.wpilibj.snippets.analogpotentiometer;
|
||||
|
||||
import edu.wpi.first.wpilibj.RobotBase;
|
||||
|
||||
/**
|
||||
* Do NOT add any static variables to this class, or any initialization at all. Unless you know what
|
||||
* you are doing, do not modify this file except to change the parameter class to the startRobot
|
||||
* call.
|
||||
*/
|
||||
public final class Main {
|
||||
private Main() {}
|
||||
|
||||
/**
|
||||
* Main initialization function. Do not perform any initialization here.
|
||||
*
|
||||
* <p>If you change your main robot class, change the parameter type.
|
||||
*/
|
||||
public static void main(String... args) {
|
||||
RobotBase.startRobot(Robot::new);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
// 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 edu.wpi.first.wpilibj.snippets.analogpotentiometer;
|
||||
|
||||
import edu.wpi.first.wpilibj.AnalogInput;
|
||||
import edu.wpi.first.wpilibj.AnalogPotentiometer;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
|
||||
/**
|
||||
* AnalogPotentiometer snippets for frc-docs.
|
||||
* https://docs.wpilib.org/en/stable/docs/software/hardware-apis/sensors/analog-poteniometers-software.html
|
||||
*/
|
||||
public class Robot extends TimedRobot {
|
||||
// Initializes an AnalogPotentiometer on analog port 0
|
||||
// The full range of motion (in meaningful external units) is 0-180 (this could be degrees, for
|
||||
// instance)
|
||||
// The "starting point" of the motion, i.e. where the mechanism is located when the potentiometer
|
||||
// reads 0v, is 30.
|
||||
AnalogPotentiometer m_pot = new AnalogPotentiometer(0, 180, 30);
|
||||
|
||||
// Initializes an AnalogInput on port 1
|
||||
AnalogInput m_input = new AnalogInput(0);
|
||||
// Initializes an AnalogPotentiometer with the given AnalogInput
|
||||
// The full range of motion (in meaningful external units) is 0-180 (this could be degrees, for
|
||||
// instance)
|
||||
// The "starting point" of the motion, i.e. where the mechanism is located when the potentiometer
|
||||
// reads 0v, is 30.
|
||||
AnalogPotentiometer m_pot1 = new AnalogPotentiometer(m_input, 180, 30);
|
||||
|
||||
/** Called once at the beginning of the robot program. */
|
||||
public Robot() {
|
||||
// Set averaging bits to 2
|
||||
m_input.setAverageBits(2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void teleopPeriodic() {
|
||||
// Get the value of the potentiometer
|
||||
m_pot.get();
|
||||
|
||||
m_pot1.get();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// 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 edu.wpi.first.wpilibj.snippets.digitalinput;
|
||||
|
||||
import edu.wpi.first.wpilibj.RobotBase;
|
||||
|
||||
/**
|
||||
* Do NOT add any static variables to this class, or any initialization at all. Unless you know what
|
||||
* you are doing, do not modify this file except to change the parameter class to the startRobot
|
||||
* call.
|
||||
*/
|
||||
public final class Main {
|
||||
private Main() {}
|
||||
|
||||
/**
|
||||
* Main initialization function. Do not perform any initialization here.
|
||||
*
|
||||
* <p>If you change your main robot class, change the parameter type.
|
||||
*/
|
||||
public static void main(String... args) {
|
||||
RobotBase.startRobot(Robot::new);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// 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 edu.wpi.first.wpilibj.snippets.digitalinput;
|
||||
|
||||
import edu.wpi.first.wpilibj.DigitalInput;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
|
||||
/**
|
||||
* DigitalInput snippets for frc-docs.
|
||||
* https://docs.wpilib.org/en/stable/docs/software/hardware-apis/sensors/digital-inputs-software.html
|
||||
*/
|
||||
public class Robot extends TimedRobot {
|
||||
// Initializes a DigitalInput on DIO 0
|
||||
DigitalInput m_input = new DigitalInput(0);
|
||||
|
||||
@Override
|
||||
public void teleopPeriodic() {
|
||||
// Gets the value of the digital input. Returns true if the circuit is open.
|
||||
m_input.get();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// 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 edu.wpi.first.wpilibj.snippets.dutycycleencoder;
|
||||
|
||||
import edu.wpi.first.wpilibj.RobotBase;
|
||||
|
||||
/**
|
||||
* Do NOT add any static variables to this class, or any initialization at all. Unless you know what
|
||||
* you are doing, do not modify this file except to change the parameter class to the startRobot
|
||||
* call.
|
||||
*/
|
||||
public final class Main {
|
||||
private Main() {}
|
||||
|
||||
/**
|
||||
* Main initialization function. Do not perform any initialization here.
|
||||
*
|
||||
* <p>If you change your main robot class, change the parameter type.
|
||||
*/
|
||||
public static void main(String... args) {
|
||||
RobotBase.startRobot(Robot::new);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
// 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 edu.wpi.first.wpilibj.snippets.dutycycleencoder;
|
||||
|
||||
import edu.wpi.first.wpilibj.DutyCycleEncoder;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
|
||||
/**
|
||||
* DutyCycleEncoder snippets for frc-docs.
|
||||
* https://docs.wpilib.org/en/stable/docs/software/hardware-apis/sensors/encoders-software.html
|
||||
*/
|
||||
public class Robot extends TimedRobot {
|
||||
// Initializes a duty cycle encoder on DIO pins 0
|
||||
DutyCycleEncoder m_encoder = new DutyCycleEncoder(0);
|
||||
|
||||
// Initializes a duty cycle encoder on DIO pins 0 to return a value of 4 for
|
||||
// a full rotation, with the encoder reporting 0 half way through rotation (2
|
||||
// out of 4)
|
||||
DutyCycleEncoder m_encoderFR = new DutyCycleEncoder(0, 4.0, 2.0);
|
||||
|
||||
/** Called once at the beginning of the robot program. */
|
||||
public Robot() {}
|
||||
|
||||
@Override
|
||||
public void teleopPeriodic() {
|
||||
// Gets the rotation
|
||||
m_encoder.get();
|
||||
|
||||
// Gets if the encoder is connected
|
||||
m_encoder.isConnected();
|
||||
|
||||
m_encoderFR.get();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// 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 edu.wpi.first.wpilibj.snippets.encoder;
|
||||
|
||||
import edu.wpi.first.wpilibj.RobotBase;
|
||||
|
||||
/**
|
||||
* Do NOT add any static variables to this class, or any initialization at all. Unless you know what
|
||||
* you are doing, do not modify this file except to change the parameter class to the startRobot
|
||||
* call.
|
||||
*/
|
||||
public final class Main {
|
||||
private Main() {}
|
||||
|
||||
/**
|
||||
* Main initialization function. Do not perform any initialization here.
|
||||
*
|
||||
* <p>If you change your main robot class, change the parameter type.
|
||||
*/
|
||||
public static void main(String... args) {
|
||||
RobotBase.startRobot(Robot::new);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
// 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 edu.wpi.first.wpilibj.snippets.encoder;
|
||||
|
||||
import edu.wpi.first.wpilibj.Encoder;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
|
||||
/**
|
||||
* Encoder snippets for frc-docs.
|
||||
* https://docs.wpilib.org/en/stable/docs/software/hardware-apis/sensors/encoders-software.html
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class Robot extends TimedRobot {
|
||||
// Initializes an encoder on DIO pins 0 and 1
|
||||
// Defaults to 4X decoding and non-inverted
|
||||
Encoder m_encoder = new Encoder(0, 1);
|
||||
|
||||
// Initializes an encoder on DIO pins 0 and 1
|
||||
// 2X encoding and non-inverted
|
||||
Encoder m_encoder2x = new Encoder(0, 1, false, Encoder.EncodingType.k2X);
|
||||
|
||||
/** Called once at the beginning of the robot program. */
|
||||
public Robot() {
|
||||
// Configures the encoder to return a distance of 4 for every 256 pulses
|
||||
// Also changes the units of getRate
|
||||
m_encoder.setDistancePerPulse(4.0 / 256.0);
|
||||
// Configures the encoder to consider itself stopped after .1 seconds
|
||||
m_encoder.setMaxPeriod(0.1);
|
||||
// Configures the encoder to consider itself stopped when its rate is below 10
|
||||
m_encoder.setMinRate(10);
|
||||
// Reverses the direction of the encoder
|
||||
m_encoder.setReverseDirection(true);
|
||||
// Configures an encoder to average its period measurement over 5 samples
|
||||
// Can be between 1 and 127 samples
|
||||
m_encoder.setSamplesToAverage(5);
|
||||
|
||||
m_encoder2x.getRate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void teleopPeriodic() {
|
||||
// Gets the distance traveled
|
||||
m_encoder.getDistance();
|
||||
|
||||
// Gets the current rate of the encoder
|
||||
m_encoder.getRate();
|
||||
|
||||
// Gets whether the encoder is stopped
|
||||
m_encoder.getStopped();
|
||||
|
||||
// Gets the last direction in which the encoder moved
|
||||
m_encoder.getDirection();
|
||||
|
||||
// Gets the current period of the encoder
|
||||
m_encoder.getPeriod();
|
||||
|
||||
// Resets the encoder to read a distance of zero
|
||||
m_encoder.reset();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// 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 edu.wpi.first.wpilibj.snippets.encoderdrive;
|
||||
|
||||
import edu.wpi.first.wpilibj.RobotBase;
|
||||
|
||||
/**
|
||||
* Do NOT add any static variables to this class, or any initialization at all. Unless you know what
|
||||
* you are doing, do not modify this file except to change the parameter class to the startRobot
|
||||
* call.
|
||||
*/
|
||||
public final class Main {
|
||||
private Main() {}
|
||||
|
||||
/**
|
||||
* Main initialization function. Do not perform any initialization here.
|
||||
*
|
||||
* <p>If you change your main robot class, change the parameter type.
|
||||
*/
|
||||
public static void main(String... args) {
|
||||
RobotBase.startRobot(Robot::new);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
// 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 edu.wpi.first.wpilibj.snippets.encoderdrive;
|
||||
|
||||
import edu.wpi.first.wpilibj.Encoder;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
|
||||
import edu.wpi.first.wpilibj.motorcontrol.Spark;
|
||||
|
||||
/**
|
||||
* Encoder drive to distance snippets for frc-docs.
|
||||
* https://docs.wpilib.org/en/stable/docs/software/hardware-apis/sensors/encoders-software.html
|
||||
*/
|
||||
public class Robot extends TimedRobot {
|
||||
// Creates an encoder on DIO ports 0 and 1
|
||||
Encoder m_encoder = new Encoder(0, 1);
|
||||
// Initialize motor controllers and drive
|
||||
Spark m_leftLeader = new Spark(0);
|
||||
Spark m_leftFollower = new Spark(1);
|
||||
Spark m_rightLeader = new Spark(2);
|
||||
Spark m_rightFollower = new Spark(3);
|
||||
DifferentialDrive m_drive = new DifferentialDrive(m_leftLeader::set, m_rightLeader::set);
|
||||
|
||||
/** Called once at the beginning of the robot program. */
|
||||
public Robot() {
|
||||
// Configures the encoder's distance-per-pulse
|
||||
// The robot moves forward 1 foot per encoder rotation
|
||||
// There are 256 pulses per encoder rotation
|
||||
m_encoder.setDistancePerPulse(1.0 / 256.0);
|
||||
// Invert the right side of the drivetrain. You might have to invert the other side
|
||||
m_rightLeader.setInverted(true);
|
||||
// Configure the followers to follow the leaders
|
||||
m_leftLeader.addFollower(m_leftFollower);
|
||||
m_rightLeader.addFollower(m_rightFollower);
|
||||
}
|
||||
|
||||
/** Drives forward at half speed until the robot has moved 5 feet, then stops. */
|
||||
@Override
|
||||
public void autonomousPeriodic() {
|
||||
if (m_encoder.getDistance() < 5.0) {
|
||||
m_drive.tankDrive(0.5, 0.5);
|
||||
} else {
|
||||
m_drive.tankDrive(0.0, 0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// 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 edu.wpi.first.wpilibj.snippets.encoderhoming;
|
||||
|
||||
import edu.wpi.first.wpilibj.RobotBase;
|
||||
|
||||
/**
|
||||
* Do NOT add any static variables to this class, or any initialization at all. Unless you know what
|
||||
* you are doing, do not modify this file except to change the parameter class to the startRobot
|
||||
* call.
|
||||
*/
|
||||
public final class Main {
|
||||
private Main() {}
|
||||
|
||||
/**
|
||||
* Main initialization function. Do not perform any initialization here.
|
||||
*
|
||||
* <p>If you change your main robot class, change the parameter type.
|
||||
*/
|
||||
public static void main(String... args) {
|
||||
RobotBase.startRobot(Robot::new);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
// 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 edu.wpi.first.wpilibj.snippets.encoderhoming;
|
||||
|
||||
import edu.wpi.first.wpilibj.DigitalInput;
|
||||
import edu.wpi.first.wpilibj.Encoder;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
import edu.wpi.first.wpilibj.motorcontrol.Spark;
|
||||
|
||||
/**
|
||||
* Encoder mechanism homing snippets for frc-docs.
|
||||
* https://docs.wpilib.org/en/stable/docs/software/hardware-apis/sensors/encoders-software.html
|
||||
*/
|
||||
public class Robot extends TimedRobot {
|
||||
Encoder m_encoder = new Encoder(0, 1);
|
||||
Spark m_spark = new Spark(0);
|
||||
// Limit switch on DIO 2
|
||||
DigitalInput m_limit = new DigitalInput(2);
|
||||
|
||||
/**
|
||||
* Runs the motor backwards at half speed until the limit switch is pressed then turn off the
|
||||
* motor and reset the encoder.
|
||||
*/
|
||||
@Override
|
||||
public void autonomousPeriodic() {
|
||||
if (!m_limit.get()) {
|
||||
m_spark.set(-0.5);
|
||||
} else {
|
||||
m_spark.set(0.0);
|
||||
m_encoder.reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// 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 edu.wpi.first.wpilibj.snippets.limitswitch;
|
||||
|
||||
import edu.wpi.first.wpilibj.RobotBase;
|
||||
|
||||
/**
|
||||
* Do NOT add any static variables to this class, or any initialization at all. Unless you know what
|
||||
* you are doing, do not modify this file except to change the parameter class to the startRobot
|
||||
* call.
|
||||
*/
|
||||
public final class Main {
|
||||
private Main() {}
|
||||
|
||||
/**
|
||||
* Main initialization function. Do not perform any initialization here.
|
||||
*
|
||||
* <p>If you change your main robot class, change the parameter type.
|
||||
*/
|
||||
public static void main(String... args) {
|
||||
RobotBase.startRobot(Robot::new);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
// 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 edu.wpi.first.wpilibj.snippets.limitswitch;
|
||||
|
||||
import edu.wpi.first.wpilibj.DigitalInput;
|
||||
import edu.wpi.first.wpilibj.Joystick;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
import edu.wpi.first.wpilibj.motorcontrol.PWMVictorSPX;
|
||||
|
||||
/**
|
||||
* Limit Switch snippets for frc-docs.
|
||||
* https://docs.wpilib.org/en/stable/docs/software/hardware-apis/sensors/limit-switch.html
|
||||
*/
|
||||
public class Robot extends TimedRobot {
|
||||
DigitalInput m_toplimitSwitch = new DigitalInput(0);
|
||||
DigitalInput m_bottomlimitSwitch = new DigitalInput(1);
|
||||
PWMVictorSPX m_motor = new PWMVictorSPX(0);
|
||||
Joystick m_joystick = new Joystick(0);
|
||||
|
||||
@Override
|
||||
public void teleopPeriodic() {
|
||||
setMotorSpeed(m_joystick.getRawAxis(2));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the motor speed based on joystick input while respecting limit switches.
|
||||
*
|
||||
* @param speed the desired speed of the motor, positive for up and negative for down
|
||||
*/
|
||||
public void setMotorSpeed(double speed) {
|
||||
if (speed > 0) {
|
||||
if (m_toplimitSwitch.get()) {
|
||||
// We are going up and top limit is tripped so stop
|
||||
m_motor.set(0);
|
||||
} else {
|
||||
// We are going up but top limit is not tripped so go at commanded speed
|
||||
m_motor.set(speed);
|
||||
}
|
||||
} else {
|
||||
if (m_bottomlimitSwitch.get()) {
|
||||
// We are going down and bottom limit is tripped so stop
|
||||
m_motor.set(0);
|
||||
} else {
|
||||
// We are going down but bottom limit is not tripped so go at commanded speed
|
||||
m_motor.set(speed);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// 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 edu.wpi.first.wpilibj.snippets.onboardimu;
|
||||
|
||||
import edu.wpi.first.wpilibj.RobotBase;
|
||||
|
||||
/**
|
||||
* Do NOT add any static variables to this class, or any initialization at all. Unless you know what
|
||||
* you are doing, do not modify this file except to change the parameter class to the startRobot
|
||||
* call.
|
||||
*/
|
||||
public final class Main {
|
||||
private Main() {}
|
||||
|
||||
/**
|
||||
* Main initialization function. Do not perform any initialization here.
|
||||
*
|
||||
* <p>If you change your main robot class, change the parameter type.
|
||||
*/
|
||||
public static void main(String... args) {
|
||||
RobotBase.startRobot(Robot::new);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
// 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 edu.wpi.first.wpilibj.snippets.onboardimu;
|
||||
|
||||
import edu.wpi.first.wpilibj.OnboardIMU;
|
||||
import edu.wpi.first.wpilibj.OnboardIMU.MountOrientation;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
|
||||
/**
|
||||
* on board IMU snippets for frc-docs.
|
||||
* https://docs.wpilib.org/en/stable/docs/software/hardware-apis/sensors/accelerometers-software.html
|
||||
*/
|
||||
public class Robot extends TimedRobot {
|
||||
// Creates an object for the on board IMU
|
||||
OnboardIMU m_iMU = new OnboardIMU(MountOrientation.kFlat);
|
||||
|
||||
/** Called once at the beginning of the robot program. */
|
||||
public Robot() {}
|
||||
|
||||
@Override
|
||||
public void teleopPeriodic() {
|
||||
// Gets the current acceleration in the X axis
|
||||
m_iMU.getAccelX();
|
||||
// Gets the current acceleration in the Y axis
|
||||
m_iMU.getAccelY();
|
||||
// Gets the current acceleration in the Z axis
|
||||
m_iMU.getAccelZ();
|
||||
|
||||
// Gets the current angle in the X axis
|
||||
m_iMU.getAngleX();
|
||||
// Gets the current angle in the Y axis
|
||||
m_iMU.getAngleY();
|
||||
// Gets the current angle in the Z axis
|
||||
m_iMU.getAngleZ();
|
||||
|
||||
// Gets the current angle as a Rotation2D
|
||||
m_iMU.getRotation2d();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// 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 edu.wpi.first.wpilibj.snippets.profiledpidfeedforward;
|
||||
|
||||
import edu.wpi.first.wpilibj.RobotBase;
|
||||
|
||||
/**
|
||||
* Do NOT add any static variables to this class, or any initialization at all. Unless you know what
|
||||
* you are doing, do not modify this file except to change the parameter class to the startRobot
|
||||
* call.
|
||||
*/
|
||||
public final class Main {
|
||||
private Main() {}
|
||||
|
||||
/**
|
||||
* Main initialization function. Do not perform any initialization here.
|
||||
*
|
||||
* <p>If you change your main robot class, change the parameter type.
|
||||
*/
|
||||
public static void main(String... args) {
|
||||
RobotBase.startRobot(Robot::new);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
// 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 edu.wpi.first.wpilibj.snippets.profiledpidfeedforward;
|
||||
|
||||
import edu.wpi.first.math.controller.ProfiledPIDController;
|
||||
import edu.wpi.first.math.controller.SimpleMotorFeedforward;
|
||||
import edu.wpi.first.math.trajectory.TrapezoidProfile;
|
||||
import edu.wpi.first.wpilibj.Encoder;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
import edu.wpi.first.wpilibj.motorcontrol.PWMSparkMax;
|
||||
|
||||
/**
|
||||
* ProfiledPIDController with feedforward snippets for frc-docs.
|
||||
* https://docs.wpilib.org/en/stable/docs/software/advanced-controls/controllers/profiled-pidcontroller.html
|
||||
*/
|
||||
public class Robot extends TimedRobot {
|
||||
private final ProfiledPIDController m_controller =
|
||||
new ProfiledPIDController(1.0, 0.0, 0.0, new TrapezoidProfile.Constraints(5.0, 10.0));
|
||||
private final SimpleMotorFeedforward m_feedforward = new SimpleMotorFeedforward(0.5, 1.5, 0.3);
|
||||
private final Encoder m_encoder = new Encoder(0, 1);
|
||||
private final PWMSparkMax m_motor = new PWMSparkMax(0);
|
||||
|
||||
double m_lastSpeed;
|
||||
|
||||
/** Called once at the beginning of the robot program. */
|
||||
public Robot() {
|
||||
m_encoder.setDistancePerPulse(1.0 / 256.0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Controls a simple motor's position using a SimpleMotorFeedforward and a ProfiledPIDController.
|
||||
*
|
||||
* @param goalPosition the desired position
|
||||
*/
|
||||
public void goToPosition(double goalPosition) {
|
||||
double pidVal = m_controller.calculate(m_encoder.getDistance(), goalPosition);
|
||||
m_motor.setVoltage(
|
||||
pidVal + m_feedforward.calculate(m_lastSpeed, m_controller.getSetpoint().velocity));
|
||||
m_lastSpeed = m_controller.getSetpoint().velocity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void teleopPeriodic() {
|
||||
// Example usage: move to position 10.0
|
||||
goToPosition(10.0);
|
||||
}
|
||||
}
|
||||
175
wpilibjExamples/src/main/java/org/wpilib/snippets/snippets.json
Normal file
175
wpilibjExamples/src/main/java/org/wpilib/snippets/snippets.json
Normal file
@@ -0,0 +1,175 @@
|
||||
[
|
||||
{
|
||||
"name": "Encoder",
|
||||
"description": "Snippets of Encoder class usage for frc-docs.",
|
||||
"tags": [
|
||||
"Hardware",
|
||||
"Encoder"
|
||||
],
|
||||
"foldername": "encoder",
|
||||
"gradlebase": "java",
|
||||
"mainclass": "Main"
|
||||
},
|
||||
{
|
||||
"name": "DutyCycleEncoder",
|
||||
"description": "Snippets of DutyCycleEncoder class usage for frc-docs.",
|
||||
"tags": [
|
||||
"Hardware",
|
||||
"Encoder",
|
||||
"Duty Cycle"
|
||||
],
|
||||
"foldername": "dutycycleencoder",
|
||||
"gradlebase": "java",
|
||||
"mainclass": "Main"
|
||||
},
|
||||
{
|
||||
"name": "AnalogEncoder",
|
||||
"description": "Snippets of AnalogEncoder class usage for frc-docs.",
|
||||
"tags": [
|
||||
"Hardware",
|
||||
"Encoder",
|
||||
"Analog"
|
||||
],
|
||||
"foldername": "analogencoder",
|
||||
"gradlebase": "java",
|
||||
"mainclass": "Main"
|
||||
},
|
||||
{
|
||||
"name": "EncoderDrive",
|
||||
"description": "Snippets of driving to a distance for frc-docs.",
|
||||
"tags": [
|
||||
"Hardware",
|
||||
"Encoder",
|
||||
"Differential Drive"
|
||||
],
|
||||
"foldername": "encoderdrive",
|
||||
"gradlebase": "java",
|
||||
"mainclass": "Main"
|
||||
},
|
||||
{
|
||||
"name": "EncoderHoming",
|
||||
"description": "Snippets of homing a mechanism for frc-docs.",
|
||||
"tags": [
|
||||
"Hardware",
|
||||
"Encoder",
|
||||
"Digital Input"
|
||||
],
|
||||
"foldername": "encoderhoming",
|
||||
"gradlebase": "java",
|
||||
"mainclass": "Main"
|
||||
},
|
||||
{
|
||||
"name": "LimitSwitch",
|
||||
"description": "Snippets of Limit Switch for frc-docs.",
|
||||
"tags": [
|
||||
"Hardware",
|
||||
"Digital Input"
|
||||
],
|
||||
"foldername": "limitswitch",
|
||||
"gradlebase": "java",
|
||||
"mainclass": "Main"
|
||||
},
|
||||
{
|
||||
"name": "DigitalInput",
|
||||
"description": "Snippets of Digital Input for frc-docs.",
|
||||
"tags": [
|
||||
"Hardware",
|
||||
"Digital Input"
|
||||
],
|
||||
"foldername": "digitalinput",
|
||||
"gradlebase": "java",
|
||||
"mainclass": "Main"
|
||||
},
|
||||
{
|
||||
"name": "AnalogInput",
|
||||
"description": "Snippets of Analog Input for frc-docs.",
|
||||
"tags": [
|
||||
"Hardware",
|
||||
"Analog"
|
||||
],
|
||||
"foldername": "analoginput",
|
||||
"gradlebase": "java",
|
||||
"mainclass": "Main"
|
||||
},
|
||||
{
|
||||
"name": "AnalogPotentiometer",
|
||||
"description": "Snippets of Analog Potentiometer for frc-docs.",
|
||||
"tags": [
|
||||
"Hardware",
|
||||
"Analog"
|
||||
],
|
||||
"foldername": "analogpotentiometer",
|
||||
"gradlebase": "java",
|
||||
"mainclass": "Main"
|
||||
},
|
||||
{
|
||||
"name": "AnalogAccelerometer",
|
||||
"description": "Snippets of Analog Accelerometer for frc-docs.",
|
||||
"tags": [
|
||||
"Hardware",
|
||||
"Analog",
|
||||
"Accelerometer"
|
||||
],
|
||||
"foldername": "analogaccelerometer",
|
||||
"gradlebase": "java",
|
||||
"mainclass": "Main"
|
||||
},
|
||||
{
|
||||
"name": "AccelerometerCollisionDetection",
|
||||
"description": "Snippets of Accelerometer for collision detection for frc-docs.",
|
||||
"tags": [
|
||||
"Hardware",
|
||||
"Accelerometer",
|
||||
"IMU"
|
||||
],
|
||||
"foldername": "accelerometercollision",
|
||||
"gradlebase": "java",
|
||||
"mainclass": "Main"
|
||||
},
|
||||
{
|
||||
"name": "AccelerometerFilter",
|
||||
"description": "Snippets of filtering Accelerometer for frc-docs.",
|
||||
"tags": [
|
||||
"Hardware",
|
||||
"Accelerometer",
|
||||
"IMU"
|
||||
],
|
||||
"foldername": "accelerometerfilter",
|
||||
"gradlebase": "java",
|
||||
"mainclass": "Main"
|
||||
},
|
||||
{
|
||||
"name": "ADXLAccelerometers",
|
||||
"description": "Snippets of ADXL 345 and 362 accelerometers for frc-docs.",
|
||||
"tags": [
|
||||
"Hardware",
|
||||
"Accelerometer"
|
||||
],
|
||||
"foldername": "adxlaccelerometers",
|
||||
"gradlebase": "java",
|
||||
"mainclass": "Main"
|
||||
},
|
||||
{
|
||||
"name": "OnboardIMU",
|
||||
"description": "Snippets of Onboard IMU for frc-docs.",
|
||||
"tags": [
|
||||
"Hardware",
|
||||
"Accelerometer",
|
||||
"IMU"
|
||||
],
|
||||
"foldername": "onboardimu",
|
||||
"gradlebase": "java",
|
||||
"mainclass": "Main"
|
||||
},
|
||||
{
|
||||
"name": "ProfiledPIDFeedforward",
|
||||
"description": "Snippets of ProfiledPIDController with feedforward for frc-docs.",
|
||||
"tags": [
|
||||
"PID",
|
||||
"Profiled PID"
|
||||
],
|
||||
"foldername": "profiledpidfeedforward",
|
||||
"gradlebase": "java",
|
||||
"mainclass": "Robot"
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user