WPILibC++  unspecified
DifferentialDrive.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2008-2017 FIRST. All Rights Reserved. */
3 /* Open Source Software - may be modified and shared by FRC teams. The code */
4 /* must be accompanied by the FIRST BSD license file in the root directory of */
5 /* the project. */
6 /*----------------------------------------------------------------------------*/
7 
8 #pragma once
9 
10 #include <llvm/raw_ostream.h>
11 
12 #include "Drive/RobotDriveBase.h"
13 
14 namespace frc {
15 
16 class SpeedController;
17 
78  public:
79  DifferentialDrive(SpeedController& leftMotor, SpeedController& rightMotor);
80  virtual ~DifferentialDrive() = default;
81 
82  DifferentialDrive(const DifferentialDrive&) = delete;
83  DifferentialDrive& operator=(const DifferentialDrive&) = delete;
84 
85  void ArcadeDrive(double y, double rotation, bool squaredInputs = true);
86  void CurvatureDrive(double y, double rotation, bool isQuickTurn);
87  void TankDrive(double left, double right, bool squaredInputs = true);
88 
89  void StopMotor() override;
90  void GetDescription(llvm::raw_ostream& desc) const override;
91 
92  private:
93  SpeedController& m_leftMotor;
94  SpeedController& m_rightMotor;
95 
96  double m_quickStopAccumulator = 0.0;
97 };
98 
99 } // namespace frc
Interface for speed controlling devices.
Definition: SpeedController.h:17
Definition: Timer.cpp:18
A class for driving differential drive/skid-steer drive platforms such as the Kit of Parts drive base...
Definition: DifferentialDrive.h:77
void TankDrive(double left, double right, bool squaredInputs=true)
Tank drive method for differential drive platform.
Definition: DifferentialDrive.cpp:177
DifferentialDrive(SpeedController &leftMotor, SpeedController &rightMotor)
Construct a DifferentialDrive.
Definition: DifferentialDrive.cpp:24
void ArcadeDrive(double y, double rotation, bool squaredInputs=true)
Arcade drive method for differential drive platform.
Definition: DifferentialDrive.cpp:39
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:33
Common base class for drive platforms.
Definition: RobotDriveBase.h:26
void CurvatureDrive(double y, double rotation, bool isQuickTurn)
Curvature drive method for differential drive platform.
Definition: DifferentialDrive.cpp:105