mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Default to requiring frc namespace for wpilibc. (#972)
Instead of defining NAMESPACED_WPILIB to remove the "using namespace frc" shim in Base.h, instead require NO_NAMESPACED_WPILIB be defined to add it. Fix up various examples to use correct namespacing.
This commit is contained in:
@@ -28,8 +28,8 @@ DriveTrain::DriveTrain() : frc::Subsystem("DriveTrain") {
|
||||
m_rightCIMs.SetInverted(true);
|
||||
|
||||
// Configure encoders
|
||||
m_rightEncoder.SetPIDSourceType(PIDSourceType::kDisplacement);
|
||||
m_leftEncoder.SetPIDSourceType(PIDSourceType::kDisplacement);
|
||||
m_rightEncoder.SetPIDSourceType(frc::PIDSourceType::kDisplacement);
|
||||
m_leftEncoder.SetPIDSourceType(frc::PIDSourceType::kDisplacement);
|
||||
|
||||
#ifndef SIMULATION
|
||||
// Converts to feet
|
||||
@@ -63,8 +63,8 @@ void DriveTrain::TankDrive(double leftAxis, double rightAxis) {
|
||||
|
||||
void DriveTrain::Stop() { m_robotDrive.TankDrive(0.0, 0.0); }
|
||||
|
||||
Encoder& DriveTrain::GetLeftEncoder() { return m_leftEncoder; }
|
||||
frc::Encoder& DriveTrain::GetLeftEncoder() { return m_leftEncoder; }
|
||||
|
||||
Encoder& DriveTrain::GetRightEncoder() { return m_rightEncoder; }
|
||||
frc::Encoder& DriveTrain::GetRightEncoder() { return m_rightEncoder; }
|
||||
|
||||
double DriveTrain::GetAngle() { return m_gyro.GetAngle(); }
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "Subsystems/Pneumatics.h"
|
||||
#include "Subsystems/Shooter.h"
|
||||
|
||||
class Robot : public IterativeRobot {
|
||||
class Robot : public frc::IterativeRobot {
|
||||
public:
|
||||
static DriveTrain drivetrain;
|
||||
static Pivot pivot;
|
||||
@@ -33,7 +33,7 @@ class Robot : public IterativeRobot {
|
||||
frc::Command* m_autonomousCommand = nullptr;
|
||||
DriveAndShootAutonomous m_driveAndShootAuto;
|
||||
DriveForward m_driveForwardAuto;
|
||||
SendableChooser<frc::Command*> m_autoChooser;
|
||||
frc::SendableChooser<frc::Command*> m_autoChooser;
|
||||
|
||||
void RobotInit() override;
|
||||
void AutonomousInit() override;
|
||||
|
||||
@@ -48,13 +48,13 @@ class DriveTrain : public frc::Subsystem {
|
||||
* @return The encoder getting the distance and speed of left side of
|
||||
* the drivetrain.
|
||||
*/
|
||||
Encoder& GetLeftEncoder();
|
||||
frc::Encoder& GetLeftEncoder();
|
||||
|
||||
/**
|
||||
* @return The encoder getting the distance and speed of right side of
|
||||
* the drivetrain.
|
||||
*/
|
||||
Encoder& GetRightEncoder();
|
||||
frc::Encoder& GetRightEncoder();
|
||||
|
||||
/**
|
||||
* @return The current angle of the drivetrain.
|
||||
@@ -73,7 +73,7 @@ class DriveTrain : public frc::Subsystem {
|
||||
|
||||
frc::DifferentialDrive m_robotDrive{m_leftCIMs, m_rightCIMs};
|
||||
|
||||
frc::Encoder m_rightEncoder{1, 2, true, Encoder::k4X};
|
||||
frc::Encoder m_leftEncoder{3, 4, false, Encoder::k4X};
|
||||
frc::Encoder m_rightEncoder{1, 2, true, frc::Encoder::k4X};
|
||||
frc::Encoder m_leftEncoder{3, 4, false, frc::Encoder::k4X};
|
||||
frc::AnalogGyro m_gyro{0};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user