Create MotorGroup and retain access to individual motors

I programmed all of my drive code so far to use references to individual motors. However, we are beginning to program autonomous, and in the interest of completing that faster, I want to create some motor groups. But, I don’t want to go back and change all of the code to work with motor groups, as I have some driver assists that may be difficult to port over. I went to create a motor group, and there is no way to do so without removing the constructor call for the original motor object, using the graphical robot config. Is there a way to do this, preferably with the graphical robot config? Thanks in advance.

Not with the graphical config, no. But if you leave the individual motors set up in the configuration menu, you can create a motor group in text as follows:

vex::motor_group myMotorGroup(myMotor1, myMotor2) // etc. for as many motors as you want

Unless you are doing something more complicated with multiple-file projects, that line can just go at the top level of your main.cpp.

(and once you have the motor groups set up, you could also create a drivetrain or smartdrive object in much the same way.)


I’ll give it a shot, thank you :slight_smile: