Rename Vector2d extension again

Remove incorrect licenses
This commit is contained in:
nathanrsxtn
2022-05-02 16:58:16 -06:00
parent 8847f2e2c3
commit 797b8630cd
37 changed files with 43 additions and 241 deletions
@@ -1,11 +1,5 @@
// 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; package frc4388.robot;
import java.security.PublicKey;
import com.ctre.phoenix.motorcontrol.StatorCurrentLimitConfiguration; import com.ctre.phoenix.motorcontrol.StatorCurrentLimitConfiguration;
import com.ctre.phoenix.motorcontrol.SupplyCurrentLimitConfiguration; import com.ctre.phoenix.motorcontrol.SupplyCurrentLimitConfiguration;
-10
View File
@@ -1,16 +1,6 @@
// 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; package frc4388.robot;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.diffplug.common.base.DurianPlugins;
import com.diffplug.common.base.Errors;
import edu.wpi.first.wpilibj.RobotBase; import edu.wpi.first.wpilibj.RobotBase;
import frc4388.utility.AnsiLogging; import frc4388.utility.AnsiLogging;
-4
View File
@@ -1,7 +1,3 @@
// 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; package frc4388.robot;
import java.util.logging.Level; import java.util.logging.Level;
@@ -1,7 +1,3 @@
// 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; package frc4388.robot;
import java.util.HashMap; import java.util.HashMap;
@@ -18,6 +14,7 @@ import edu.wpi.first.util.sendable.Sendable;
import edu.wpi.first.util.sendable.SendableBuilder; import edu.wpi.first.util.sendable.SendableBuilder;
import edu.wpi.first.util.sendable.SendableRegistry; import edu.wpi.first.util.sendable.SendableRegistry;
import edu.wpi.first.wpilibj.DriverStation; import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.GenericHID;
import edu.wpi.first.wpilibj.PowerDistribution; import edu.wpi.first.wpilibj.PowerDistribution;
import edu.wpi.first.wpilibj.XboxController; import edu.wpi.first.wpilibj.XboxController;
import edu.wpi.first.wpilibj.smartdashboard.SendableBuilderImpl; import edu.wpi.first.wpilibj.smartdashboard.SendableBuilderImpl;
@@ -1,7 +1,3 @@
// 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; package frc4388.robot;
import com.ctre.phoenix.motorcontrol.NeutralMode; import com.ctre.phoenix.motorcontrol.NeutralMode;
@@ -1,7 +1,3 @@
// 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.ButtonBoxCommands; package frc4388.robot.commands.ButtonBoxCommands;
import edu.wpi.first.wpilibj2.command.CommandBase; import edu.wpi.first.wpilibj2.command.CommandBase;
@@ -1,7 +1,3 @@
// 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.ButtonBoxCommands; package frc4388.robot.commands.ButtonBoxCommands;
import edu.wpi.first.wpilibj2.command.CommandBase; import edu.wpi.first.wpilibj2.command.CommandBase;
@@ -1,11 +1,6 @@
// 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.ClimberCommands; package frc4388.robot.commands.ClimberCommands;
import edu.wpi.first.wpilibj2.command.CommandBase; import edu.wpi.first.wpilibj2.command.CommandBase;
import frc4388.robot.Constants.ClawConstants;
import frc4388.robot.subsystems.Claws; import frc4388.robot.subsystems.Claws;
public class RunClaw extends CommandBase { public class RunClaw extends CommandBase {
@@ -1,17 +1,10 @@
// 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.ClimberCommands; package frc4388.robot.commands.ClimberCommands;
import org.opencv.core.Point; import org.opencv.core.Point;
import edu.wpi.first.wpilibj.drive.Vector2d;
import edu.wpi.first.wpilibj2.command.CommandBase; import edu.wpi.first.wpilibj2.command.CommandBase;
import frc4388.robot.Constants.ClimberConstants;
import frc4388.robot.subsystems.Claws; import frc4388.robot.subsystems.Claws;
import frc4388.robot.subsystems.Climber; import frc4388.robot.subsystems.Climber;
import frc4388.utility.Vector2dExt;
public class RunClimberPath extends CommandBase { public class RunClimberPath extends CommandBase {
Climber climber; Climber climber;
@@ -1,7 +1,3 @@
// 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.DriveCommands; package frc4388.robot.commands.DriveCommands;
import edu.wpi.first.wpilibj2.command.CommandBase; import edu.wpi.first.wpilibj2.command.CommandBase;
@@ -1,11 +1,5 @@
// 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.DriveCommands; package frc4388.robot.commands.DriveCommands;
import javax.swing.plaf.basic.BasicTreeUI.TreeCancelEditingAction;
import edu.wpi.first.wpilibj2.command.CommandBase; import edu.wpi.first.wpilibj2.command.CommandBase;
import frc4388.robot.subsystems.SwerveDrive; import frc4388.robot.subsystems.SwerveDrive;
import frc4388.robot.subsystems.VisionOdometry; import frc4388.robot.subsystems.VisionOdometry;
@@ -1,7 +1,3 @@
// 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; package frc4388.robot.commands;
import java.io.File; import java.io.File;
@@ -1,7 +1,3 @@
// 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; package frc4388.robot.commands;
import java.io.File; import java.io.File;
@@ -104,4 +100,4 @@ public class RecordDriveInput extends CommandBase {
public boolean isFinished() { public boolean isFinished() {
return false; return false;
} }
} }
@@ -1,7 +1,3 @@
// 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; package frc4388.robot.commands;
import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.Command;
@@ -1,15 +1,7 @@
// 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.StorageCommands; package frc4388.robot.commands.StorageCommands;
import edu.wpi.first.wpilibj.DriverStation.Alliance; import edu.wpi.first.wpilibj.DriverStation.Alliance;
import edu.wpi.first.wpilibj.util.Color;
import edu.wpi.first.wpilibj2.command.CommandBase; import edu.wpi.first.wpilibj2.command.CommandBase;
import edu.wpi.first.wpilibj2.command.CommandScheduler;
import edu.wpi.first.wpilibj2.command.ScheduleCommand;
import frc4388.robot.Robot;
import frc4388.robot.subsystems.BoomBoom; import frc4388.robot.subsystems.BoomBoom;
import frc4388.robot.subsystems.Storage; import frc4388.robot.subsystems.Storage;
import frc4388.robot.subsystems.Turret; import frc4388.robot.subsystems.Turret;
@@ -1,7 +1,3 @@
// 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.StorageCommands; package frc4388.robot.commands.StorageCommands;
import edu.wpi.first.wpilibj2.command.CommandBase; import edu.wpi.first.wpilibj2.command.CommandBase;
@@ -1,31 +1,19 @@
// 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.subsystems; package frc4388.robot.subsystems;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream;
import java.nio.file.Files; import java.nio.file.Files;
import java.util.Arrays; import java.util.Arrays;
import java.util.Comparator; import java.util.Comparator;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Function;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.IntStream;
import com.ctre.phoenix.motorcontrol.TalonFXControlMode; import com.ctre.phoenix.motorcontrol.TalonFXControlMode;
import com.ctre.phoenix.motorcontrol.can.WPI_TalonFX; import com.ctre.phoenix.motorcontrol.can.WPI_TalonFX;
import com.diffplug.common.base.Errors; import com.diffplug.common.base.Errors;
import com.diffplug.common.base.StringPrinter; import com.diffplug.common.base.StringPrinter;
import edu.wpi.first.math.system.plant.DCMotor;
import edu.wpi.first.util.sendable.Sendable;
import edu.wpi.first.wpilibj.Filesystem; import edu.wpi.first.wpilibj.Filesystem;
import edu.wpi.first.wpilibj.RobotBase; import edu.wpi.first.wpilibj.RobotBase;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
@@ -38,7 +26,8 @@ import frc4388.utility.NumericData;
public class BoomBoom extends SubsystemBase { public class BoomBoom extends SubsystemBase {
private static final Logger LOGGER = Logger.getLogger(BoomBoom.class.getSimpleName()); private static final Logger LOGGER = Logger.getLogger(BoomBoom.class.getSimpleName());
public WPI_TalonFX m_shooterFalconLeft; public WPI_TalonFX m_shooterFalconLeft;
public WPI_TalonFX m_shooterFalconRight; public static Gains m_drumShooterGains = ShooterConstants.DRUM_SHOOTER_GAINS; public WPI_TalonFX m_shooterFalconRight;
public static Gains m_drumShooterGains = ShooterConstants.DRUM_SHOOTER_GAINS;
public static BoomBoom m_boomBoom; public static BoomBoom m_boomBoom;
double speed2; double speed2;
@@ -1,15 +1,7 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2019 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package frc4388.robot.subsystems; package frc4388.robot.subsystems;
import edu.wpi.first.cscore.*;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.cameraserver.CameraServer; import edu.wpi.first.cameraserver.CameraServer;
import edu.wpi.first.cscore.UsbCamera;
import edu.wpi.first.wpilibj2.command.SubsystemBase; import edu.wpi.first.wpilibj2.command.SubsystemBase;
public class Camera extends SubsystemBase { public class Camera extends SubsystemBase {
@@ -1,17 +1,9 @@
package frc4388.robot.subsystems; package frc4388.robot.subsystems;
import java.nio.file.ClosedWatchServiceException;
import com.ctre.phoenix.motorcontrol.LimitSwitchNormal;
import com.revrobotics.CANSparkMax;
import com.revrobotics.SparkMaxLimitSwitch;
import edu.wpi.first.wpilibj.DigitalInput;
import edu.wpi.first.wpilibj.Servo; import edu.wpi.first.wpilibj.Servo;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.SubsystemBase; import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc4388.robot.Constants.ClawConstants; import frc4388.robot.Constants.ClawConstants;
import frc4388.robot.Constants.ClimberConstants;
public class Claws extends SubsystemBase { public class Claws extends SubsystemBase {
@@ -1,7 +1,3 @@
// 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.subsystems; package frc4388.robot.subsystems;
import com.ctre.phoenix.motorcontrol.can.WPI_TalonFX; import com.ctre.phoenix.motorcontrol.can.WPI_TalonFX;
@@ -1,12 +1,6 @@
// 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.subsystems; package frc4388.robot.subsystems;
import com.ctre.phoenix.led.ColorFlowAnimation.Direction;
import com.revrobotics.CANSparkMax; import com.revrobotics.CANSparkMax;
import com.revrobotics.SparkMaxLimitSwitch;
import com.revrobotics.CANSparkMax.SoftLimitDirection; import com.revrobotics.CANSparkMax.SoftLimitDirection;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
@@ -1,20 +1,13 @@
// 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.subsystems; package frc4388.robot.subsystems;
import com.revrobotics.CANSparkMax; import com.revrobotics.CANSparkMax;
import com.revrobotics.RelativeEncoder;
import com.revrobotics.SparkMaxPIDController;
import com.revrobotics.SparkMaxLimitSwitch;
import com.revrobotics.CANSparkMax.ControlType; import com.revrobotics.CANSparkMax.ControlType;
import com.revrobotics.CANSparkMax.SoftLimitDirection; import com.revrobotics.CANSparkMax.SoftLimitDirection;
import com.revrobotics.SparkMaxRelativeEncoder.Type; import com.revrobotics.RelativeEncoder;
import com.revrobotics.SparkMaxPIDController;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.SubsystemBase; import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc4388.robot.Constants.ShooterConstants; import frc4388.robot.Constants.ShooterConstants;
import frc4388.utility.Gains; import frc4388.utility.Gains;
@@ -1,7 +1,3 @@
// 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.subsystems; package frc4388.robot.subsystems;
import com.ctre.phoenix.motorcontrol.can.WPI_TalonFX; import com.ctre.phoenix.motorcontrol.can.WPI_TalonFX;
@@ -1,13 +1,7 @@
// 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.subsystems; package frc4388.robot.subsystems;
import java.util.logging.Logger; import java.util.logging.Logger;
import edu.wpi.first.wpilibj.PWM;
import edu.wpi.first.wpilibj.Servo;
import edu.wpi.first.wpilibj.motorcontrol.Spark; import edu.wpi.first.wpilibj.motorcontrol.Spark;
import edu.wpi.first.wpilibj2.command.SubsystemBase; import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc4388.robot.Constants.LEDConstants; import frc4388.robot.Constants.LEDConstants;
@@ -1,19 +1,11 @@
// 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.subsystems; package frc4388.robot.subsystems;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import com.revrobotics.CANSparkMax; import com.revrobotics.CANSparkMax;
import edu.wpi.first.networktables.NetworkTable;
import edu.wpi.first.wpilibj.DigitalInput;
import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.DriverStation.Alliance;
import com.revrobotics.ColorSensorV3; import com.revrobotics.ColorSensorV3;
import edu.wpi.first.wpilibj.DriverStation.Alliance;
import edu.wpi.first.wpilibj.util.Color; import edu.wpi.first.wpilibj.util.Color;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
public class Storage extends SubsystemBase { public class Storage extends SubsystemBase {
public CANSparkMax m_storageMotor; public CANSparkMax m_storageMotor;
@@ -1,7 +1,3 @@
// 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.subsystems; package frc4388.robot.subsystems;
import com.ctre.phoenix.sensors.WPI_Pigeon2; import com.ctre.phoenix.sensors.WPI_Pigeon2;
@@ -1,7 +1,3 @@
// 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.subsystems; package frc4388.robot.subsystems;
import com.ctre.phoenix.motorcontrol.FeedbackDevice; import com.ctre.phoenix.motorcontrol.FeedbackDevice;
@@ -1,24 +1,14 @@
// 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.subsystems; package frc4388.robot.subsystems;
import com.revrobotics.CANSparkMax.ControlType;
import com.revrobotics.CANSparkMax.IdleMode;
import com.revrobotics.CANSparkMax.SoftLimitDirection;
import com.revrobotics.CANSparkMax; import com.revrobotics.CANSparkMax;
import com.revrobotics.CANSparkMax.ControlType;
import com.revrobotics.CANSparkMax.SoftLimitDirection;
import com.revrobotics.RelativeEncoder; import com.revrobotics.RelativeEncoder;
import com.revrobotics.SparkMaxLimitSwitch; import com.revrobotics.SparkMaxLimitSwitch;
import com.revrobotics.SparkMaxPIDController; import com.revrobotics.SparkMaxPIDController;
import edu.wpi.first.wpilibj.interfaces.Gyro;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.SubsystemBase; import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc4388.robot.Constants.ShooterConstants; import frc4388.robot.Constants.ShooterConstants;
import frc4388.robot.subsystems.BoomBoom.ShooterTableEntry;
import frc4388.utility.Gains; import frc4388.utility.Gains;
public class Turret extends SubsystemBase { public class Turret extends SubsystemBase {
@@ -1,14 +1,9 @@
// 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.subsystems; package frc4388.robot.subsystems;
import edu.wpi.first.wpilibj2.command.SubsystemBase; import edu.wpi.first.networktables.NetworkTableEntry;
import edu.wpi.first.networktables.NetworkTableInstance; import edu.wpi.first.networktables.NetworkTableInstance;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.networktables.NetworkTableEntry; import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc4388.robot.Constants.VisionConstants; import frc4388.robot.Constants.VisionConstants;
public class Vision extends SubsystemBase { public class Vision extends SubsystemBase {
@@ -1,10 +1,3 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2019 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package frc4388.robot.subsystems; package frc4388.robot.subsystems;
import java.util.ArrayList; import java.util.ArrayList;
@@ -21,7 +14,6 @@ import org.photonvision.targeting.TargetCorner;
import edu.wpi.first.math.geometry.Pose2d; import edu.wpi.first.math.geometry.Pose2d;
import edu.wpi.first.math.geometry.Rotation2d; import edu.wpi.first.math.geometry.Rotation2d;
import edu.wpi.first.wpilibj.RobotBase; import edu.wpi.first.wpilibj.RobotBase;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.SubsystemBase; import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc4388.robot.Constants.VisionConstants; import frc4388.robot.Constants.VisionConstants;
@@ -1,7 +1,3 @@
// 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.utility; package frc4388.utility;
import java.util.ArrayList; import java.util.ArrayList;
@@ -1,7 +1,3 @@
// 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.utility; package frc4388.utility;
import java.security.InvalidParameterException; import java.security.InvalidParameterException;
@@ -14,19 +10,19 @@ import edu.wpi.first.wpilibj.drive.Vector2d;
/** Aarav's good vector class (better than WPILib) /** Aarav's good vector class (better than WPILib)
* @author Aarav Shah */ * @author Aarav Shah */
public class Vector2dExt extends Vector2d { public class FRC4388_Vector2d extends Vector2d {
public Vector2dExt() { public FRC4388_Vector2d() {
this(0, 0); this(0, 0);
} }
public Vector2dExt(double x, double y) { public FRC4388_Vector2d(double x, double y) {
super(x, y); super(x, y);
this.x = x; this.x = x;
this.y = y; this.y = y;
} }
public Vector2dExt(double[] vec) { public FRC4388_Vector2d(double[] vec) {
this(vec[0], vec[1]); this(vec[0], vec[1]);
if (vec.length != 2) { if (vec.length != 2) {
@@ -34,11 +30,11 @@ public class Vector2dExt extends Vector2d {
} }
} }
public Vector2dExt(Point p) { public FRC4388_Vector2d(Point p) {
this(p.x, p.y); this(p.x, p.y);
} }
public Vector2dExt(Translation2d t) { public FRC4388_Vector2d(Translation2d t) {
this(t.getX(), t.getY()); this(t.getX(), t.getY());
} }
@@ -48,15 +44,15 @@ public class Vector2dExt extends Vector2d {
* @param v2 Second vector in the addition. * @param v2 Second vector in the addition.
* @return New vector which is the sum. * @return New vector which is the sum.
*/ */
public static Vector2dExt add(Vector2dExt v1, Vector2dExt v2) { public static FRC4388_Vector2d add(FRC4388_Vector2d v1, FRC4388_Vector2d v2) {
return new Vector2dExt(v1.x + v2.x, v1.y + v2.y); return new FRC4388_Vector2d(v1.x + v2.x, v1.y + v2.y);
} }
/** /**
* Adds vector to current object * Adds vector to current object
* @param v Vector to add * @param v Vector to add
*/ */
public void add(Vector2dExt v) { public void add(FRC4388_Vector2d v) {
this.x += v.x; this.x += v.x;
this.y += v.x; this.y += v.x;
} }
@@ -67,15 +63,15 @@ public class Vector2dExt extends Vector2d {
* @param v2 Second vector in the subtraction. * @param v2 Second vector in the subtraction.
* @return New vector which is the difference. * @return New vector which is the difference.
*/ */
public static Vector2dExt subtract(Vector2dExt v1, Vector2dExt v2) { public static FRC4388_Vector2d subtract(FRC4388_Vector2d v1, FRC4388_Vector2d v2) {
return new Vector2dExt(v1.x - v2.x, v1.y - v2.y); return new FRC4388_Vector2d(v1.x - v2.x, v1.y - v2.y);
} }
/** /**
* Subtracts vector from current object * Subtracts vector from current object
* @param v Vector to subtract * @param v Vector to subtract
*/ */
public void subtract(Vector2dExt v) { public void subtract(FRC4388_Vector2d v) {
this.x -= v.x; this.x -= v.x;
this.y -= v.x; this.y -= v.x;
} }
@@ -86,8 +82,8 @@ public class Vector2dExt extends Vector2d {
* @param v2 Scalar to multiply. * @param v2 Scalar to multiply.
* @return New vector which is the product. * @return New vector which is the product.
*/ */
public static Vector2dExt multiply(Vector2dExt v1, double scalar) { public static FRC4388_Vector2d multiply(FRC4388_Vector2d v1, double scalar) {
return new Vector2dExt(scalar * v1.x, scalar * v1.y); return new FRC4388_Vector2d(scalar * v1.x, scalar * v1.y);
} }
/** /**
@@ -105,8 +101,8 @@ public class Vector2dExt extends Vector2d {
* @param v2 Scalar to divide. * @param v2 Scalar to divide.
* @return New vector which is the division. * @return New vector which is the division.
*/ */
public static Vector2dExt divide(Vector2dExt v1, double scalar) { public static FRC4388_Vector2d divide(FRC4388_Vector2d v1, double scalar) {
return new Vector2dExt(v1.x / scalar, v1.y / scalar); return new FRC4388_Vector2d(v1.x / scalar, v1.y / scalar);
} }
/** /**
@@ -122,8 +118,8 @@ public class Vector2dExt extends Vector2d {
* Find unit vector. * Find unit vector.
* @return The unit vector. * @return The unit vector.
*/ */
public Vector2dExt unit() { public FRC4388_Vector2d unit() {
return new Vector2dExt(this.x / this.magnitude(), this.y / this.magnitude()); return new FRC4388_Vector2d(this.x / this.magnitude(), this.y / this.magnitude());
} }
/** /**
@@ -132,10 +128,10 @@ public class Vector2dExt extends Vector2d {
* @param places Number of places to round to. * @param places Number of places to round to.
* @return New rounded vector. * @return New rounded vector.
*/ */
public static Vector2dExt round(Vector2dExt v, int places) { public static FRC4388_Vector2d round(FRC4388_Vector2d v, int places) {
int scale = (int) Math.pow(10, places); int scale = (int) Math.pow(10, places);
v = Vector2dExt.multiply(v, scale); v = FRC4388_Vector2d.multiply(v, scale);
v.x = Math.round(v.x); v.x = Math.round(v.x);
v.y = Math.round(v.y); v.y = Math.round(v.y);
-4
View File
@@ -1,7 +1,3 @@
// 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.utility; package frc4388.utility;
/** Add your docs here. */ /** Add your docs here. */
@@ -46,4 +46,4 @@ public enum LEDPatterns {
public float percentToPWM() { public float percentToPWM() {
return (1000 + (getValue() * 1000)); return (1000 + (getValue() * 1000));
} }
} }
@@ -1,7 +1,3 @@
// 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.utility; package frc4388.utility;
import edu.wpi.first.math.util.Units; import edu.wpi.first.math.util.Units;
@@ -1,7 +1,3 @@
// 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.utility; package frc4388.utility;
import frc4388.robot.subsystems.BoomBoom; import frc4388.robot.subsystems.BoomBoom;
@@ -14,29 +10,29 @@ public class VelocityCorrection {
BoomBoom boomBoom; BoomBoom boomBoom;
// vectors (in ft and ft/sec) // vectors (in ft and ft/sec)
public Vector2dExt position; public FRC4388_Vector2d position;
public Vector2dExt cartesianVelocity; public FRC4388_Vector2d cartesianVelocity;
// find // find
public Vector2dExt target; public FRC4388_Vector2d target;
public VelocityCorrection(SwerveDrive swerve, BoomBoom boomBoom) { public VelocityCorrection(SwerveDrive swerve, BoomBoom boomBoom) {
this.swerve = swerve; this.swerve = swerve;
this.boomBoom = boomBoom; this.boomBoom = boomBoom;
position = new Vector2dExt(5, 0);//new Vector2D(this.swerve.getOdometry().getX(), this.swerve.getOdometry().getY()); position = new FRC4388_Vector2d(5, 0);//new Vector2D(this.swerve.getOdometry().getX(), this.swerve.getOdometry().getY());
cartesianVelocity = new Vector2dExt(-2, 3);//new Vector2D(this.swerve.getChassisSpeeds().vxMetersPerSecond, this.swerve.getChassisSpeeds().vyMetersPerSecond); cartesianVelocity = new FRC4388_Vector2d(-2, 3);//new Vector2D(this.swerve.getChassisSpeeds().vxMetersPerSecond, this.swerve.getChassisSpeeds().vyMetersPerSecond);
target = getTargetPoint(); target = getTargetPoint();
} }
private Vector2dExt getTargetPoint() { private FRC4388_Vector2d getTargetPoint() {
double approxShotTime = 1; // TODO: get shot time from shooter tables double approxShotTime = 1; // TODO: get shot time from shooter tables
Vector2dExt targetPoint = Vector2dExt.multiply(this.cartesianVelocity, -1 * approxShotTime); FRC4388_Vector2d targetPoint = FRC4388_Vector2d.multiply(this.cartesianVelocity, -1 * approxShotTime);
return Vector2dExt.round(targetPoint, 5); return FRC4388_Vector2d.round(targetPoint, 5);
} }
} }
@@ -1,7 +1,3 @@
// 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.subsystems; package frc4388.robot.subsystems;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;