mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Also deprecate SpeedController in favor of motorcontrol.MotorController and SpeedControllerGroup in favor of motorcontrol.MotorControllerGroup. The MotorController interface is derived from the SpeedController interface so that code such as SpeedController x = new VictorSP(1) continues to compile (just with a warning). SpeedControllerGroup and MotorControllerGroup are independent classes; both implement the MotorController interface.
35 lines
1.1 KiB
C++
35 lines
1.1 KiB
C++
// 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.
|
|
|
|
#include <frc/GenericHID.h>
|
|
#include <frc/TimedRobot.h>
|
|
#include <frc/XboxController.h>
|
|
#include <frc/drive/DifferentialDrive.h>
|
|
#include <frc/motorcontrol/PWMSparkMax.h>
|
|
|
|
/**
|
|
* This is a demo program showing the use of the DifferentialDrive class.
|
|
* Runs the motors with tank steering and an Xbox controller.
|
|
*/
|
|
class Robot : public frc::TimedRobot {
|
|
frc::PWMSparkMax m_leftMotor{0};
|
|
frc::PWMSparkMax m_rightMotor{1};
|
|
frc::DifferentialDrive m_robotDrive{m_leftMotor, m_rightMotor};
|
|
frc::XboxController m_driverController{0};
|
|
|
|
public:
|
|
void TeleopPeriodic() override {
|
|
// Drive with tank style
|
|
m_robotDrive.TankDrive(
|
|
m_driverController.GetY(frc::GenericHID::JoystickHand::kLeftHand),
|
|
m_driverController.GetY(frc::GenericHID::JoystickHand::kRightHand));
|
|
}
|
|
};
|
|
|
|
#ifndef RUNNING_FRC_TESTS
|
|
int main() {
|
|
return frc::StartRobot<Robot>();
|
|
}
|
|
#endif
|