2019-08-25 23:55:59 -04:00
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
/* 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. */
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2019-09-02 23:39:51 -07:00
|
|
|
#include <units/units.h>
|
|
|
|
|
|
2019-08-25 23:55:59 -04:00
|
|
|
/**
|
|
|
|
|
* The Constants header provides a convenient place for teams to hold robot-wide
|
|
|
|
|
* numerical or bool constants. This should not be used for any other purpose.
|
|
|
|
|
*
|
|
|
|
|
* It is generally a good idea to place constants into subsystem- or
|
|
|
|
|
* command-specific namespaces within this header, which can then be used where
|
|
|
|
|
* they are needed.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
namespace DriveConstants {
|
2019-10-27 19:32:56 -07:00
|
|
|
constexpr int kLeftMotor1Port = 0;
|
|
|
|
|
constexpr int kLeftMotor2Port = 1;
|
|
|
|
|
constexpr int kRightMotor1Port = 2;
|
|
|
|
|
constexpr int kRightMotor2Port = 3;
|
2019-08-25 23:55:59 -04:00
|
|
|
|
2019-10-27 19:32:56 -07:00
|
|
|
constexpr int kLeftEncoderPorts[]{0, 1};
|
|
|
|
|
constexpr int kRightEncoderPorts[]{2, 3};
|
|
|
|
|
constexpr bool kLeftEncoderReversed = false;
|
|
|
|
|
constexpr bool kRightEncoderReversed = true;
|
2019-08-25 23:55:59 -04:00
|
|
|
|
2019-10-27 19:32:56 -07:00
|
|
|
constexpr int kEncoderCPR = 1024;
|
|
|
|
|
constexpr double kWheelDiameterInches = 6;
|
|
|
|
|
constexpr double kEncoderDistancePerPulse =
|
2019-08-25 23:55:59 -04:00
|
|
|
// Assumes the encoders are directly mounted on the wheel shafts
|
|
|
|
|
(kWheelDiameterInches * 3.142) / static_cast<double>(kEncoderCPR);
|
|
|
|
|
} // namespace DriveConstants
|
|
|
|
|
|
|
|
|
|
namespace ShooterConstants {
|
2019-10-27 19:32:56 -07:00
|
|
|
constexpr int kEncoderPorts[]{4, 5};
|
|
|
|
|
constexpr bool kEncoderReversed = false;
|
|
|
|
|
constexpr int kEncoderCPR = 1024;
|
|
|
|
|
constexpr double kEncoderDistancePerPulse =
|
2019-08-25 23:55:59 -04:00
|
|
|
// Distance units will be rotations
|
|
|
|
|
1. / static_cast<double>(kEncoderCPR);
|
|
|
|
|
|
2019-10-27 19:32:56 -07:00
|
|
|
constexpr int kShooterMotorPort = 4;
|
|
|
|
|
constexpr int kFeederMotorPort = 5;
|
2019-08-25 23:55:59 -04:00
|
|
|
|
2019-10-27 19:32:56 -07:00
|
|
|
constexpr double kShooterFreeRPS = 5300;
|
|
|
|
|
constexpr double kShooterTargetRPS = 4000;
|
|
|
|
|
constexpr double kShooterToleranceRPS = 50;
|
2019-08-25 23:55:59 -04:00
|
|
|
|
2019-10-27 19:32:56 -07:00
|
|
|
constexpr double kP = 1;
|
|
|
|
|
constexpr double kI = 0;
|
|
|
|
|
constexpr double kD = 0;
|
2019-08-25 23:55:59 -04:00
|
|
|
|
|
|
|
|
// On a real robot the feedforward constants should be empirically determined;
|
|
|
|
|
// these are reasonable guesses.
|
2019-10-27 19:32:56 -07:00
|
|
|
constexpr double kSFractional = .05;
|
|
|
|
|
constexpr double kVFractional =
|
2019-08-25 23:55:59 -04:00
|
|
|
// Should have value 1 at free speed...
|
|
|
|
|
1. / kShooterFreeRPS;
|
|
|
|
|
|
2019-10-27 19:32:56 -07:00
|
|
|
constexpr double kFeederSpeed = .5;
|
2019-08-25 23:55:59 -04:00
|
|
|
} // namespace ShooterConstants
|
|
|
|
|
|
|
|
|
|
namespace AutoConstants {
|
2019-09-02 23:39:51 -07:00
|
|
|
constexpr auto kAutoTimeoutSeconds = 12_s;
|
|
|
|
|
constexpr auto kAutoShootTimeSeconds = 7_s;
|
2019-08-25 23:55:59 -04:00
|
|
|
} // namespace AutoConstants
|
|
|
|
|
|
|
|
|
|
namespace OIConstants {
|
2019-10-27 19:32:56 -07:00
|
|
|
constexpr int kDriverControllerPort = 1;
|
2019-08-25 23:55:59 -04:00
|
|
|
} // namespace OIConstants
|