mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
SCRIPT namespace replacements
This commit is contained in:
committed by
Peter Johnson
parent
ae6c043632
commit
9aca8e0fd6
@@ -22,7 +22,7 @@
|
||||
*/
|
||||
|
||||
namespace DriveConstants {
|
||||
inline constexpr units::second_t kDt{0.02};
|
||||
inline constexpr wpi::units::second_t kDt{0.02};
|
||||
inline constexpr int kLeftMotor1Port = 0;
|
||||
inline constexpr int kLeftMotor2Port = 1;
|
||||
inline constexpr int kRightMotor1Port = 2;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "RobotContainer.hpp"
|
||||
|
||||
class Robot : public frc::TimedRobot {
|
||||
class Robot : public wpi::TimedRobot {
|
||||
public:
|
||||
Robot();
|
||||
void RobotPeriodic() override;
|
||||
@@ -26,7 +26,7 @@ class Robot : public frc::TimedRobot {
|
||||
private:
|
||||
// Have it null by default so that if testing teleop it
|
||||
// doesn't have undefined behavior and potentially crash.
|
||||
std::optional<frc2::CommandPtr> m_autonomousCommand;
|
||||
std::optional<wpi::cmd::CommandPtr> m_autonomousCommand;
|
||||
|
||||
RobotContainer m_container;
|
||||
};
|
||||
|
||||
@@ -23,11 +23,11 @@ class RobotContainer {
|
||||
public:
|
||||
RobotContainer();
|
||||
|
||||
frc2::CommandPtr GetAutonomousCommand();
|
||||
wpi::cmd::CommandPtr GetAutonomousCommand();
|
||||
|
||||
private:
|
||||
// The driver's controller
|
||||
frc2::CommandXboxController m_driverController{
|
||||
wpi::cmd::CommandXboxController m_driverController{
|
||||
OIConstants::kDriverControllerPort};
|
||||
|
||||
// The robot's subsystems and commands are defined here...
|
||||
@@ -36,10 +36,10 @@ class RobotContainer {
|
||||
DriveSubsystem m_drive;
|
||||
|
||||
// RobotContainer-owned commands
|
||||
frc2::CommandPtr m_driveHalfSpeed =
|
||||
frc2::cmd::RunOnce([this] { m_drive.SetMaxOutput(0.5); }, {});
|
||||
frc2::CommandPtr m_driveFullSpeed =
|
||||
frc2::cmd::RunOnce([this] { m_drive.SetMaxOutput(1); }, {});
|
||||
wpi::cmd::CommandPtr m_driveHalfSpeed =
|
||||
wpi::cmd::cmd::RunOnce([this] { m_drive.SetMaxOutput(0.5); }, {});
|
||||
wpi::cmd::CommandPtr m_driveFullSpeed =
|
||||
wpi::cmd::cmd::RunOnce([this] { m_drive.SetMaxOutput(1); }, {});
|
||||
|
||||
void ConfigureButtonBindings();
|
||||
};
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include "Constants.hpp"
|
||||
#include "ExampleSmartMotorController.hpp"
|
||||
|
||||
class DriveSubsystem : public frc2::SubsystemBase {
|
||||
class DriveSubsystem : public wpi::cmd::SubsystemBase {
|
||||
public:
|
||||
DriveSubsystem();
|
||||
|
||||
@@ -35,10 +35,10 @@ class DriveSubsystem : public frc2::SubsystemBase {
|
||||
* @param nextLeft The next left wheel state.
|
||||
* @param nextRight The next right wheel state.
|
||||
*/
|
||||
void SetDriveStates(frc::TrapezoidProfile<units::meters>::State currentLeft,
|
||||
frc::TrapezoidProfile<units::meters>::State currentRight,
|
||||
frc::TrapezoidProfile<units::meters>::State nextLeft,
|
||||
frc::TrapezoidProfile<units::meters>::State nextRight);
|
||||
void SetDriveStates(wpi::math::TrapezoidProfile<wpi::units::meters>::State currentLeft,
|
||||
wpi::math::TrapezoidProfile<wpi::units::meters>::State currentRight,
|
||||
wpi::math::TrapezoidProfile<wpi::units::meters>::State nextLeft,
|
||||
wpi::math::TrapezoidProfile<wpi::units::meters>::State nextRight);
|
||||
|
||||
/**
|
||||
* Drives the robot using arcade controls.
|
||||
@@ -58,14 +58,14 @@ class DriveSubsystem : public frc2::SubsystemBase {
|
||||
*
|
||||
* @return the average of the TWO encoder readings
|
||||
*/
|
||||
units::meter_t GetLeftEncoderDistance();
|
||||
wpi::units::meter_t GetLeftEncoderDistance();
|
||||
|
||||
/**
|
||||
* Gets the distance of the right encoder.
|
||||
*
|
||||
* @return the average of the TWO encoder readings
|
||||
*/
|
||||
units::meter_t GetRightEncoderDistance();
|
||||
wpi::units::meter_t GetRightEncoderDistance();
|
||||
|
||||
/**
|
||||
* Sets the max output of the drive. Useful for scaling the drive to drive
|
||||
@@ -82,7 +82,7 @@ class DriveSubsystem : public frc2::SubsystemBase {
|
||||
* @param distance The distance to drive forward.
|
||||
* @return A command.
|
||||
*/
|
||||
frc2::CommandPtr ProfiledDriveDistance(units::meter_t distance);
|
||||
wpi::cmd::CommandPtr ProfiledDriveDistance(wpi::units::meter_t distance);
|
||||
|
||||
/**
|
||||
* Creates a command to drive forward a specified distance using a motion
|
||||
@@ -91,14 +91,14 @@ class DriveSubsystem : public frc2::SubsystemBase {
|
||||
* @param distance The distance to drive forward.
|
||||
* @return A command.
|
||||
*/
|
||||
frc2::CommandPtr DynamicProfiledDriveDistance(units::meter_t distance);
|
||||
wpi::cmd::CommandPtr DynamicProfiledDriveDistance(wpi::units::meter_t distance);
|
||||
|
||||
private:
|
||||
frc::TrapezoidProfile<units::meters> m_profile{
|
||||
wpi::math::TrapezoidProfile<wpi::units::meters> m_profile{
|
||||
{DriveConstants::kMaxSpeed, DriveConstants::kMaxAcceleration}};
|
||||
frc::Timer m_timer;
|
||||
units::meter_t m_initialLeftDistance;
|
||||
units::meter_t m_initialRightDistance;
|
||||
wpi::Timer m_timer;
|
||||
wpi::units::meter_t m_initialLeftDistance;
|
||||
wpi::units::meter_t m_initialRightDistance;
|
||||
// Components (e.g. motor controllers and sensors) should generally be
|
||||
// declared private and exposed only through public methods.
|
||||
|
||||
@@ -109,10 +109,10 @@ class DriveSubsystem : public frc2::SubsystemBase {
|
||||
ExampleSmartMotorController m_rightFollower;
|
||||
|
||||
// A feedforward component for the drive
|
||||
frc::SimpleMotorFeedforward<units::meters> m_feedforward;
|
||||
wpi::math::SimpleMotorFeedforward<wpi::units::meters> m_feedforward;
|
||||
|
||||
// The robot's drive
|
||||
frc::DifferentialDrive m_drive{
|
||||
wpi::DifferentialDrive m_drive{
|
||||
[&](double output) { m_leftLeader.Set(output); },
|
||||
[&](double output) { m_rightLeader.Set(output); }};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user