ART v1.0-alpha
A Robot Template that raises the floor for VRC teams
Loading...
Searching...
No Matches
SimpleMotorGroup.cpp
Go to the documentation of this file.
1
16
17namespace art
18{
19
20 SimpleMotorGroup::SimpleMotorGroup(vex::motor_group mot) : vex::motor_group(mot) {}
21
23 {
24 setSpeedMode(speedMode);
25 return *this;
26 }
27
28 void SimpleMotorGroup::setSpeedMode(bool speedMode)
29 {
30 m_speedMode = speedMode;
31 }
32
34 {
35 return m_speedMode;
36 }
37
38 void SimpleMotorGroup::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_group wrapper class.
A Simple Motor_Group Wrapper Class.
void set(double cmd)
Sets the motor to spin at the specified command.
SimpleMotorGroup(vex::motor_group mot)
Construct a new Simple Motor_Group object.
double m_cmd
The command the motor-group is set to, as a percentage of the max.
bool m_speedMode
Whether or not the motor-group should use speed, rather than voltage.
SimpleMotorGroup & withSpeedMode(bool speedMode)
Returns a SimpleMotorGroup refrence with the specified speedMode.
bool getSpeedMode()
Get the SpeedMode of the SimpleMotorGroup.
void setSpeedMode(bool speedMode)
Set the SpeedMode of the SimpleMotorGroup.
double get()
Returns the command the motor-group was last commanded to.
Definition PID.h:20