VEXcode IQ C++ Unofficial documentation for version 3.0.4.1
Loading...
Searching...
No Matches
vex::motor_group Class Reference

Public Member Functions

template<typename... Args>
 motor_group (vex::motor &m1, Args &... m2)
 
template<typename... Args>
void operator() (vex::motor &m1, Args &... m2)
 
int32_t count (void)
 return the number of motors in the motor group
 
void setVelocity (double velocity, velocityUnits units)
 Sets the velocity of the motor group based on the parameters set in the command. This command will not run the motor. Any subsequent call that does not contain a specified motor velocity will use this value.
 
void setVelocity (double velocity, percentUnits units)
 
void setStopping (brakeType mode)
 Sets the stopping mode of the motor group by passing a brake mode as a parameter.
 
void resetPosition (void)
 Resets the motor's encoder to the value of zero.
 
void setPosition (double value, rotationUnits units)
 Sets the value of all motor encoders to the value specified in the parameter.
 
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 to the completion of the timeout, the motors will stop.
 
void spin (directionType dir)
 Turns the motors on, and spins them in the specified direction.
 
void spin (directionType dir, double velocity, velocityUnits units)
 Turn on the motors and spins them in the specified direction and a specified velocity.
 
void spin (directionType dir, double velocity, percentUnits units)
 
void spin (directionType dir, double voltage, voltageUnits units)
 Turn on the motors and spins them in the specified direction and a specified voltage.
 
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.
 
bool spinToPosition (double rotation, rotationUnits units, double velocity, velocityUnits units_v, bool waitForCompletion=true)
 
bool spinTo (double rotation, rotationUnits units, bool waitForCompletion=true)
 Turn on the motors and spin them to an absolute target rotation value.
 
bool spinToPosition (double rotation, rotationUnits units, bool waitForCompletion=true)
 
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.
 
bool spinFor (directionType dir, double rotation, rotationUnits units, double velocity, velocityUnits units_v, bool waitForCompletion=true)
 
bool spinFor (double rotation, rotationUnits units, bool waitForCompletion=true)
 Turn on the motors and spin them to a relative target rotation value.
 
bool spinFor (directionType dir, double rotation, rotationUnits units, bool waitForCompletion=true)
 
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 spinFor (directionType dir, double time, timeUnits units, double velocity, velocityUnits units_v)
 
void spinFor (double time, timeUnits units)
 Turn on the motors and spin them to a relative target time value.
 
void spinFor (directionType dir, double time, timeUnits units)
 
bool isSpinning (void)
 Checks to see if any of the motors are rotating to a specific target.
 
bool isDone (void)
 Checks to see if all the motor are done rotating to a specific target.
 
bool isSpinningMode (void)
 
void stop (void)
 Stops all motors using the default brake mode.
 
void stop (brakeType mode)
 Stops all motors using a specified brake mode.
 
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 setMaxTorque (double value, currentUnits units)
 Sets the max torque of the motors.
 
directionType direction (void)
 Gets which direction the first motor in the group is spinning.
 
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 velocity (percentUnits units)
 
double current (currentUnits units=currentUnits::amp)
 Gets the sum electrical current for all motors in the group.
 
double current (percentUnits units)
 Gets the electrical current of the motors in percentage of maximum.
 
double voltage (voltageUnits units=voltageUnits::volt)
 Gets the voltage of the first motor in the group.
 
double power (powerUnits units=powerUnits::watt)
 Gets the power of the first motor in the group.
 
double torque (torqueUnits units=torqueUnits::Nm)
 Gets the torque of the first motor in the group.
 
double efficiency (percentUnits units=percentUnits::pct)
 Gets the efficiency of the first motor in the group.
 
double temperature (percentUnits units=percentUnits::pct)
 Gets the temperature of the first motor in the group.
 
double temperature (temperatureUnits units)
 Gets the temperature of the motor.
 

Detailed Description

Definition at line 24 of file vex_motorgroup.h.

Constructor & Destructor Documentation

◆ motor_group()

template<typename... Args>
vex::motor_group::motor_group ( vex::motor & m1,
Args &... m2 )
inline

Definition at line 58 of file vex_motorgroup.h.

Member Function Documentation

◆ count()

int32_t vex::motor_group::count ( void )

return the number of motors in the motor group

Returns
number of motors

◆ current() [1/2]

double vex::motor_group::current ( currentUnits units = currentUnits::amp)

Gets the sum electrical current for all motors in the group.

Returns
Returns a double that represents the electrical current of the motors in the units defined in the parameter.
Parameters
unitsThe measurement unit for the current.

◆ current() [2/2]

double vex::motor_group::current ( percentUnits units)

Gets the electrical current of the motors in percentage of maximum.

Returns
Returns a double that represents the electrical current of the motors as percentage of max current.
Parameters
unitsThe measurement unit for the current.

◆ direction()

directionType vex::motor_group::direction ( void )

Gets which direction the first motor in the group is spinning.

Returns
Returns the direction that the motor is spinning.

◆ efficiency()

double vex::motor_group::efficiency ( percentUnits units = percentUnits::pct)

Gets the efficiency of the first motor in the group.

Returns
Returns the efficiency of the motor in the units defined in the parameter.
Parameters
units(Optional) The measurement unit for the efficiency. By default, this parameter is a percentage.

◆ isDone()

bool vex::motor_group::isDone ( void )

Checks to see if all the motor are done rotating to a specific target.

Returns
Returns a false Boolean if the motor is on and is rotating to a target. Returns a true Boolean if the motor is done rotating to a target.

◆ isSpinning()

bool vex::motor_group::isSpinning ( void )

Checks to see if any of the motors are rotating to a specific target.

Returns
Returns a true Boolean if the motor is on and is rotating to a target. Returns a false Boolean if the motor is done rotating to a target.

◆ operator()()

template<typename... Args>
void vex::motor_group::operator() ( vex::motor & m1,
Args &... m2 )
inline

Definition at line 64 of file vex_motorgroup.h.

◆ position()

double vex::motor_group::position ( rotationUnits units)

Gets the current position of the first motor in the group's encoder.

Returns
Returns a double that represents the current position of the motor in the units defined in the parameter.
Parameters
unitsThe measurement unit for the position.

◆ power()

double vex::motor_group::power ( powerUnits units = powerUnits::watt)

Gets the power of the first motor in the group.

Returns
Returns a double that represents the power of the motor in the units defined in the parameter.
Parameters
unitsThe measurement unit for the power.

◆ setMaxTorque() [1/3]

void vex::motor_group::setMaxTorque ( double value,
currentUnits units )

Sets the max torque of the motors.

Parameters
valueSets the amount of torque.
unitsThe measurement unit for the torque value.

◆ setMaxTorque() [2/3]

void vex::motor_group::setMaxTorque ( double value,
percentUnits units )

Sets the max torque of the motors.

Parameters
valueSets the amount of torque.
unitsThe measurement unit for the torque value.

◆ setMaxTorque() [3/3]

void vex::motor_group::setMaxTorque ( double value,
torqueUnits units )

Sets the max torque of the motors.

Parameters
valueSets the amount of torque.
unitsThe measurement unit for the torque value.

◆ setPosition()

void vex::motor_group::setPosition ( double value,
rotationUnits units )

Sets the value of all motor encoders to the value specified in the parameter.

Parameters
valueSets the current position of the motor.
unitsThe measurement unit for the position value.

◆ setStopping()

void vex::motor_group::setStopping ( brakeType mode)

Sets the stopping mode of the motor group by passing a brake mode as a parameter.

Parameters
modeThe stopping mode can be set to coast, brake, or hold.

◆ setTimeout()

void vex::motor_group::setTimeout ( int32_t time,
timeUnits units )

Sets the timeout for the motor group. If the motor group does not reach its' commanded position prior to the completion of the timeout, the motors will stop.

Parameters
timeSets the amount of time.
unitsThe measurement unit for the time value.

◆ setVelocity() [1/2]

void vex::motor_group::setVelocity ( double velocity,
percentUnits units )
inline

Definition at line 82 of file vex_motorgroup.h.

◆ setVelocity() [2/2]

void vex::motor_group::setVelocity ( double velocity,
velocityUnits units )

Sets the velocity of the motor group based on the parameters set in the command. This command will not run the motor. Any subsequent call that does not contain a specified motor velocity will use this value.

Parameters
velocitySets the amount of velocity.
unitsThe measurement unit for the velocity value.

◆ spin() [1/4]

void vex::motor_group::spin ( directionType dir)

Turns the motors on, and spins them in the specified direction.

Parameters
dirThe direction to spin the motors.

◆ spin() [2/4]

void vex::motor_group::spin ( directionType dir,
double velocity,
percentUnits units )
inline

Definition at line 125 of file vex_motorgroup.h.

◆ spin() [3/4]

void vex::motor_group::spin ( directionType dir,
double velocity,
velocityUnits units )

Turn on the motors and spins them in the specified direction and a specified velocity.

Parameters
dirThe direction to spin the motors.
velocitySets the amount of velocity.
unitsThe measurement unit for the velocity value.

◆ spin() [4/4]

void vex::motor_group::spin ( directionType dir,
double voltage,
voltageUnits units )

Turn on the motors and spins them in the specified direction and a specified voltage.

Parameters
dirThe direction to spin the motors.
voltageSets the amount of volts.
unitsThe measurement unit for the voltage value.

◆ spinFor() [1/4]

bool vex::motor_group::spinFor ( double rotation,
rotationUnits units,
bool waitForCompletion = true )

Turn on the motors and spin them to a relative target rotation value.

Returns
Returns a Boolean that signifies when the motor has reached the target rotation value.
Parameters
rotationSets the amount of rotation.
unitsThe measurement unit for the rotation value.
waitForCompletion(Optional) If true, your program will wait until the motor reaches the target rotational value. If false, the program will continue after calling this function. By default, this parameter is true.

◆ spinFor() [2/4]

bool vex::motor_group::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.

Returns
Returns a Boolean that signifies when the motor has reached the target rotation value.
Parameters
rotationSets the amount of rotation.
unitsThe measurement unit for the rotation value.
velocitySets the amount of velocity.
units_vThe measurement unit for the velocity value.
waitForCompletion(Optional) If true, your program will wait until the motor reaches the target rotational value. If false, the program will continue after calling this function. By default, this parameter is true.

◆ spinFor() [3/4]

void vex::motor_group::spinFor ( double time,
timeUnits units )

Turn on the motors and spin them to a relative target time value.

Parameters
timeSets the amount of time.
unitsThe measurement unit for the time value.

◆ spinFor() [4/4]

void vex::motor_group::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.

Parameters
timeSets the amount of time.
unitsThe measurement unit for the time value.
velocitySets the amount of velocity.
units_vThe measurement unit for the velocity value.

◆ spinTo() [1/2]

bool vex::motor_group::spinTo ( double rotation,
rotationUnits units,
bool waitForCompletion = true )

Turn on the motors and spin them to an absolute target rotation value.

Returns
Returns a Boolean that signifies when the motor has reached the target rotation value.
Parameters
rotationSets the amount of rotation.
unitsThe measurement unit for the rotation value.
waitForCompletion(Optional) If true, your program will wait until the motor reaches the target rotational value. If false, the program will continue after calling this function. By default, this parameter is true.

◆ spinTo() [2/2]

bool vex::motor_group::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.

Returns
Returns a Boolean that signifies when the motors have reached the target rotation value.
Parameters
rotationSets the amount of rotation.
unitsThe measurement unit for the rotation value.
velocitySets the amount of velocity.
units_vThe measurement unit for the velocity value.
waitForCompletion(Optional) If true, your program will wait until the motor reaches the target rotational value. If false, the program will continue after calling this function. By default, this parameter is true.

◆ stop()

void vex::motor_group::stop ( brakeType mode)

Stops all motors using a specified brake mode.

Parameters
modeThe brake mode can be set to coast, brake, or hold.

◆ temperature() [1/2]

double vex::motor_group::temperature ( percentUnits units = percentUnits::pct)

Gets the temperature of the first motor in the group.

Returns
Returns the temperature of the motor in the units defined in the parameter.
Parameters
unitsThe measurement unit for the temperature.

◆ temperature() [2/2]

double vex::motor_group::temperature ( temperatureUnits units)

Gets the temperature of the motor.

Returns
Returns the temperature of the motor in the units defined in the parameter.
Parameters
unitsThe measurement unit for the temperature.

◆ torque()

double vex::motor_group::torque ( torqueUnits units = torqueUnits::Nm)

Gets the torque of the first motor in the group.

Returns
Returns a double that represents the torque of the motor in the units defined in the parameter.
Parameters
unitsThe measurement unit for the torque.

◆ velocity() [1/2]

double vex::motor_group::velocity ( percentUnits units)
inline

Definition at line 270 of file vex_motorgroup.h.

◆ velocity() [2/2]

double vex::motor_group::velocity ( velocityUnits units)

Gets the current velocity of the first motor in the group.

Returns
Returns a double that represents the current velocity of the motor in the units defined in the parameter.
Parameters
unitsThe measurement unit for the velocity.

◆ voltage()

double vex::motor_group::voltage ( voltageUnits units = voltageUnits::volt)

Gets the voltage of the first motor in the group.

Returns
Returns a double that represents the voltage of the motor in the units defined in the parameter.
Parameters
unitsThe measurement unit for the voltage.

The documentation for this class was generated from the following file: