14#ifndef VEX_MOTOR_GROUP_CLASS_H
15#define VEX_MOTOR_GROUP_CLASS_H
26 class motor_group_impl;
27 class motor_group_motors {
30 #define STATIC_MEMORY 8
31 uintptr_t _memory[STATIC_MEMORY];
32 motor_group_impl *pimpl;
35 motor_group_motors(
const motor_group_motors&);
36 ~motor_group_motors();
40 motor_group_motors _motors;
45 template <
typename... Args>
46 void _addMotor(
vex::motor &m1, Args &... m2 ) {
51 bool waitForCompletionAll();
57 template <
typename... Args>
63 template <
typename... Args>
64 void operator()(
vex::motor &m1, Args &... m2 ) {
115 void spin( directionType dir );
125 void spin( directionType dir,
double velocity, percentUnits units ){
126 spin( dir,
velocity,
static_cast<velocityUnits
>(units) );
135 void spin( directionType dir,
double voltage, voltageUnits units );
146 bool spinTo(
double rotation, rotationUnits units,
double velocity, velocityUnits units_v,
bool waitForCompletion=
true );
147 bool spinToPosition(
double rotation, rotationUnits units,
double velocity, velocityUnits units_v,
bool waitForCompletion=
true );
156 bool spinTo(
double rotation, rotationUnits units,
bool waitForCompletion=
true );
157 bool spinToPosition(
double rotation, rotationUnits units,
bool waitForCompletion=
true );
169 bool spinFor(
double rotation, rotationUnits units,
double velocity, velocityUnits units_v,
bool waitForCompletion=
true );
171 bool spinFor( directionType dir,
double rotation, rotationUnits units,
double velocity, velocityUnits units_v,
bool waitForCompletion=
true );
180 bool spinFor(
double rotation, rotationUnits units,
bool waitForCompletion=
true );
182 bool spinFor( directionType dir,
double rotation, rotationUnits units,
bool waitForCompletion=
true );
193 void spinFor( directionType dir,
double time, timeUnits units,
double velocity, velocityUnits units_v );
202 void spinFor( directionType dir,
double time, timeUnits units );
216 bool isSpinningMode(
void );
270 double velocity( percentUnits units ) {
271 return velocity(
static_cast<velocityUnits
>(units) );
279 double current( currentUnits units = currentUnits::amp );
296 double voltage( voltageUnits units = voltageUnits::volt );
303 double power( powerUnits units = powerUnits::watt );
310 double torque( torqueUnits units = torqueUnits::Nm );
double position(rotationUnits units)
Gets the current position of the first motor in the group's encoder.
double velocity(velocityUnits units)
Gets the current velocity of the first motor in the group.
double efficiency(percentUnits units=percentUnits::pct)
Gets the efficiency of the first motor in the group.
void spinFor(double time, timeUnits units, double velocity, velocityUnits units_v)
Turn on the motors and spin them to a relative target time value at a specified velocity.
void setMaxTorque(double value, currentUnits units)
Sets the max torque of the motors.
void stop(void)
Stops all motors using the default brake mode.
double current(percentUnits units)
Gets the electrical current of the motors in percentage of maximum.
void spinFor(double time, timeUnits units)
Turn on the motors and spin them to a relative target time value.
double power(powerUnits units=powerUnits::watt)
Gets the power of the first motor in the group.
bool spinFor(double rotation, rotationUnits units, double velocity, velocityUnits units_v, bool waitForCompletion=true)
Turn on the motors and spin them to a relative target rotation value at a specified velocity.
void setMaxTorque(double value, percentUnits units)
Sets the max torque of the motors.
void setMaxTorque(double value, torqueUnits units)
Sets the max torque of the motors.
void setStopping(brakeType mode)
Sets the stopping mode of the motor group by passing a brake mode as a parameter.
double current(currentUnits units=currentUnits::amp)
Gets the sum electrical current for all motors in the group.
void setTimeout(int32_t time, timeUnits units)
Sets the timeout for the motor group. If the motor group does not reach its' commanded position prior...
double temperature(temperatureUnits units)
Gets the temperature of the motor.
void resetPosition(void)
Resets the motor's encoder to the value of zero.
void setVelocity(double velocity, velocityUnits units)
Sets the velocity of the motor group based on the parameters set in the command. This command will no...
bool isSpinning(void)
Checks to see if any of the motors are rotating to a specific target.
directionType direction(void)
Gets which direction the first motor in the group is spinning.
int32_t count(void)
return the number of motors in the motor group
bool isDone(void)
Checks to see if all the motor are done rotating to a specific target.
double voltage(voltageUnits units=voltageUnits::volt)
Gets the voltage of the first motor in the group.
void spin(directionType dir)
Turns the motors on, and spins them in the specified direction.
bool spinFor(double rotation, rotationUnits units, bool waitForCompletion=true)
Turn on the motors and spin them to a relative target rotation value.
void spin(directionType dir, double voltage, voltageUnits units)
Turn on the motors and spins them in the specified direction and a specified voltage.
void spin(directionType dir, double velocity, velocityUnits units)
Turn on the motors and spins them in the specified direction and a specified velocity.
void stop(brakeType mode)
Stops all motors using a specified brake mode.
void setPosition(double value, rotationUnits units)
Sets the value of all motor encoders to the value specified in the parameter.
double torque(torqueUnits units=torqueUnits::Nm)
Gets the torque of the first motor in the group.
double temperature(percentUnits units=percentUnits::pct)
Gets the temperature of the first motor in the group.
bool spinTo(double rotation, rotationUnits units, bool waitForCompletion=true)
Turn on the motors and spin them to an absolute target rotation value.
bool spinTo(double rotation, rotationUnits units, double velocity, velocityUnits units_v, bool waitForCompletion=true)
Turns on the motors and spin them to an absolute target rotation value at a specified velocity.
Use the motor class to control motor devices.
Bumper switch device class