WPILibC++  unspecified
KilloughDrive.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 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 <memory>
11 
12 #include <llvm/raw_ostream.h>
13 
14 #include "Drive/RobotDriveBase.h"
15 #include "Drive/Vector2d.h"
16 
17 namespace frc {
18 
19 class SpeedController;
20 
39 class KilloughDrive : public RobotDriveBase {
40  public:
41  KilloughDrive(SpeedController& leftMotor, SpeedController& rightMotor,
42  SpeedController& backMotor);
43  KilloughDrive(SpeedController& leftMotor, SpeedController& rightMotor,
44  SpeedController& backMotor, double leftMotorAngle,
45  double rightMotorAngle, double backMotorAngle);
46  virtual ~KilloughDrive() = default;
47 
48  KilloughDrive(const KilloughDrive&) = delete;
49  KilloughDrive& operator=(const KilloughDrive&) = delete;
50 
51  void DriveCartesian(double x, double y, double rotation,
52  double gyroAngle = 0.0);
53  void DrivePolar(double magnitude, double angle, double rotation);
54 
55  void StopMotor() override;
56  void GetDescription(llvm::raw_ostream& desc) const override;
57 
58  private:
59  SpeedController& m_leftMotor;
60  SpeedController& m_rightMotor;
61  SpeedController& m_backMotor;
62 
63  Vector2d m_leftVec;
64  Vector2d m_rightVec;
65  Vector2d m_backVec;
66 
67  bool reported = false;
68 };
69 
70 } // namespace frc
Interface for speed controlling devices.
Definition: SpeedController.h:17
Definition: Timer.cpp:18
void DrivePolar(double magnitude, double angle, double rotation)
Drive method for Killough platform.
Definition: KilloughDrive.cpp:123
void DriveCartesian(double x, double y, double rotation, double gyroAngle=0.0)
Drive method for Killough platform.
Definition: KilloughDrive.cpp:80
A class for driving Killough drive platforms.
Definition: KilloughDrive.h:39
KilloughDrive(SpeedController &leftMotor, SpeedController &rightMotor, SpeedController &backMotor)
Construct a Killough drive with the given motors and default motor angles.
Definition: KilloughDrive.cpp:34
This is a 2D vector struct that supports basic vector operations.
Definition: Vector2d.h:15
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