2022-11-28 10:41:25 -05:00
|
|
|
// 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.
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <numbers>
|
|
|
|
|
|
|
|
|
|
#include <units/angle.h>
|
|
|
|
|
#include <units/angular_velocity.h>
|
|
|
|
|
#include <units/length.h>
|
|
|
|
|
#include <units/time.h>
|
|
|
|
|
#include <units/voltage.h>
|
|
|
|
|
|
|
|
|
|
namespace DriveConstants {
|
2023-12-14 23:52:02 -05:00
|
|
|
inline constexpr int kLeftMotor1Port = 0;
|
|
|
|
|
inline constexpr int kLeftMotor2Port = 1;
|
|
|
|
|
inline constexpr int kRightMotor1Port = 2;
|
|
|
|
|
inline constexpr int kRightMotor2Port = 3;
|
|
|
|
|
|
|
|
|
|
inline constexpr int kLeftEncoderPorts[]{0, 1};
|
|
|
|
|
inline constexpr int kRightEncoderPorts[]{2, 3};
|
|
|
|
|
inline constexpr bool kLeftEncoderReversed = false;
|
|
|
|
|
inline constexpr bool kRightEncoderReversed = true;
|
|
|
|
|
|
|
|
|
|
inline constexpr double kEncoderCPR = 1024;
|
|
|
|
|
inline constexpr units::meter_t kWheelDiameter = 6.0_in;
|
|
|
|
|
inline constexpr double kEncoderDistancePerPulse =
|
2022-11-28 10:41:25 -05:00
|
|
|
// Assumes the encoders are directly mounted on the wheel shafts
|
|
|
|
|
((kWheelDiameter * std::numbers::pi) / kEncoderCPR).value();
|
|
|
|
|
|
|
|
|
|
} // namespace DriveConstants
|
|
|
|
|
|
|
|
|
|
namespace IntakeConstants {
|
2023-12-14 23:52:02 -05:00
|
|
|
inline constexpr int kMotorPort = 6;
|
|
|
|
|
inline constexpr int kSolenoidPorts[]{0, 1};
|
2022-11-28 10:41:25 -05:00
|
|
|
} // namespace IntakeConstants
|
|
|
|
|
|
|
|
|
|
namespace StorageConstants {
|
2023-12-14 23:52:02 -05:00
|
|
|
inline constexpr int kMotorPort = 7;
|
|
|
|
|
inline constexpr int kBallSensorPort = 6;
|
2022-11-28 10:41:25 -05:00
|
|
|
} // namespace StorageConstants
|
|
|
|
|
|
|
|
|
|
namespace ShooterConstants {
|
2023-12-14 23:52:02 -05:00
|
|
|
inline constexpr int kEncoderPorts[]{4, 5};
|
|
|
|
|
inline constexpr bool kEncoderReversed = false;
|
|
|
|
|
inline constexpr double kEncoderCPR = 1024;
|
|
|
|
|
inline constexpr double kEncoderDistancePerPulse =
|
2022-11-28 10:41:25 -05:00
|
|
|
// Distance units will be rotations
|
|
|
|
|
1.0 / kEncoderCPR;
|
|
|
|
|
|
2023-12-14 23:52:02 -05:00
|
|
|
inline constexpr int kShooterMotorPort = 4;
|
|
|
|
|
inline constexpr int kFeederMotorPort = 5;
|
2022-11-28 10:41:25 -05:00
|
|
|
|
2023-12-14 23:52:02 -05:00
|
|
|
inline constexpr auto kShooterFree = 5300_tps;
|
|
|
|
|
inline constexpr auto kShooterTarget = 4000_tps;
|
|
|
|
|
inline constexpr auto kShooterTolerance = 50_tps;
|
2022-11-28 10:41:25 -05:00
|
|
|
|
|
|
|
|
// These are not real PID gains, and will have to be tuned for your specific
|
|
|
|
|
// robot.
|
2023-12-14 23:52:02 -05:00
|
|
|
inline constexpr double kP = 1;
|
2022-11-28 10:41:25 -05:00
|
|
|
|
2023-12-14 23:52:02 -05:00
|
|
|
inline constexpr units::volt_t kS = 0.05_V;
|
|
|
|
|
inline constexpr auto kV =
|
2022-11-28 10:41:25 -05:00
|
|
|
// Should have value 12V at free speed...
|
|
|
|
|
12.0_V / kShooterFree;
|
|
|
|
|
|
2023-12-14 23:52:02 -05:00
|
|
|
inline constexpr double kFeederSpeed = 0.5;
|
2022-11-28 10:41:25 -05:00
|
|
|
} // namespace ShooterConstants
|
|
|
|
|
|
|
|
|
|
namespace OIConstants {
|
2023-12-14 23:52:02 -05:00
|
|
|
inline constexpr int kDriverControllerPort = 0;
|
2022-11-28 10:41:25 -05:00
|
|
|
} // namespace OIConstants
|
|
|
|
|
|
|
|
|
|
namespace AutoConstants {
|
|
|
|
|
constexpr units::second_t kTimeout = 3.0_s;
|
|
|
|
|
constexpr units::meter_t kDriveDistance = 2.0_m;
|
|
|
|
|
constexpr double kDriveSpeed = 0.5;
|
|
|
|
|
} // namespace AutoConstants
|