mirror of
https://github.com/Team4388/2023WayOfTheRobot.git
synced 2026-06-09 08:38:02 -06:00
Merge moment
This commit is contained in:
@@ -113,6 +113,8 @@ public class Robot extends TimedRobot {
|
||||
m_autonomousCommand.cancel();
|
||||
}
|
||||
m_robotTime.startMatchTime();
|
||||
|
||||
m_robotContainer.gyroRef.reset();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -123,6 +125,9 @@ public class Robot extends TimedRobot {
|
||||
SmartDashboard.putNumber("Gyro Yaw", gyro.getYaw());
|
||||
SmartDashboard.putNumber("Gyro Pitch", gyro.getPitch());
|
||||
SmartDashboard.putNumber("Gyro Roll", gyro.getRoll());
|
||||
SmartDashboard.putNumber("yaw", m_robotContainer.gyroRef.getAngle());
|
||||
SmartDashboard.putNumber("pitch", m_robotContainer.gyroRef.getPitch());
|
||||
SmartDashboard.putNumber("roll", m_robotContainer.gyroRef.getRoll());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,6 +15,7 @@ import edu.wpi.first.wpilibj2.command.button.JoystickButton;
|
||||
import frc4388.robot.Constants.*;
|
||||
import frc4388.robot.subsystems.LED;
|
||||
import frc4388.utility.LEDPatterns;
|
||||
import frc4388.utility.RobotGyro;
|
||||
import frc4388.utility.controller.IHandController;
|
||||
import frc4388.utility.controller.XboxController;
|
||||
|
||||
@@ -36,6 +37,8 @@ public class RobotContainer {
|
||||
private final XboxController m_driverXbox = new XboxController(OIConstants.XBOX_DRIVER_ID);
|
||||
private final XboxController m_operatorXbox = new XboxController(OIConstants.XBOX_OPERATOR_ID);
|
||||
|
||||
public RobotGyro gyroRef = m_robotMap.gyro;
|
||||
|
||||
/**
|
||||
* The container for the robot. Contains subsystems, OI devices, and commands.
|
||||
*/
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.ctre.phoenix.motorcontrol.InvertType;
|
||||
import com.ctre.phoenix.motorcontrol.NeutralMode;
|
||||
import com.ctre.phoenix.motorcontrol.can.WPI_TalonFX;
|
||||
import com.ctre.phoenix.sensors.PigeonIMU;
|
||||
import com.ctre.phoenix.sensors.WPI_Pigeon2;
|
||||
|
||||
import edu.wpi.first.wpilibj.motorcontrol.Spark;
|
||||
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
|
||||
@@ -22,6 +23,8 @@ import frc4388.utility.RobotGyro;
|
||||
* testing and modularization.
|
||||
*/
|
||||
public class RobotMap {
|
||||
private WPI_Pigeon2 m_pigeon2 = new WPI_Pigeon2(14);
|
||||
public RobotGyro gyro = new RobotGyro(m_pigeon2);
|
||||
|
||||
public RobotMap() {
|
||||
configureLEDMotorControllers();
|
||||
|
||||
@@ -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 frc4388.robot.commands;
|
||||
|
||||
import edu.wpi.first.math.controller.PIDController;
|
||||
import edu.wpi.first.wpilibj2.command.PIDCommand;
|
||||
|
||||
// NOTE: Consider using this command inline, rather than writing a subclass. For more
|
||||
// information, see:
|
||||
// https://docs.wpilib.org/en/stable/docs/software/commandbased/convenience-features.html
|
||||
public class AutoBalanceTF2 extends PIDCommand {
|
||||
/** Creates a new AutoBalanceTF2. */
|
||||
public AutoBalanceTF2() {
|
||||
super(
|
||||
// The controller that the command will use
|
||||
new PIDController(0, 0, 0),
|
||||
// This should return the measurement
|
||||
() -> 0,
|
||||
// This should return the setpoint (can also be a constant)
|
||||
() -> 0,
|
||||
// This uses the output
|
||||
output -> {
|
||||
// Use the output here
|
||||
});
|
||||
// Use addRequirements() here to declare subsystem dependencies.
|
||||
// Configure additional PID options by calling `getController` here.
|
||||
}
|
||||
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user