ART v1.0-alpha
A Robot Template that raises the floor for VRC teams
Loading...
Searching...
No Matches
SimpleMotor.cpp
Go to the documentation of this file.
1
15#include "ART/SimpleMotor.h"
16
17namespace art
18{
19
20 SimpleMotor::SimpleMotor(vex::motor mot) : vex::motor(mot) {}
21
23 {
24 setSpeedMode(speedMode);
25 return *this;
26 }
27
28 void SimpleMotor::setSpeedMode(bool speedMode)
29 {
30 m_speedMode = speedMode;
31 }
32
34 {
35 return m_speedMode;
36 }
37
38 void SimpleMotor::set(double cmd){
39 m_cmd = cmd;
40 if (m_speedMode)
41 {
42 spin(vex::fwd, m_cmd, vex::pct);
43 }
44 else
45 {
46 spin(vex::fwd, m_cmd * 12 / 100.f, vex::volt);
47 }
48 }
49
51 return m_cmd;
52 }
53} // namespace art
Header containing a simple motor wrapper class.
A Simple Motor Wrapper Class.
Definition SimpleMotor.h:37
SimpleMotor(vex::motor mot)
Construct a new Simple Motor object.
void set(double cmd)
Sets the motor to spin at the specified command.
void setSpeedMode(bool speedMode)
Set the SpeedMode of the SimpleMotor.
bool getSpeedMode()
Get the SpeedMode of the SimpleMotor.
bool m_speedMode
Whether or not the motor should use speed, rather than voltage.
double get()
Returns the command the motor was last commanded to.
double m_cmd
The command the motor is set to, as a percentage of the max.
SimpleMotor & withSpeedMode(bool speedMode)
Returns a SimpleMotor refrence with the specified speedMode.
Definition PID.h:20