No VictorSP support for SpeedControllerGroup?

For the past few days, I’ve been getting problems trying to create VictorSP’s in a command-based project. The first error is in trying to create a speed controller group, using (this isn’t our actual code, I’m doing this from memory)


leftGroup = new frc::SpeedControllerGroup(frontLeft, rearLeft);

Same thing for the right side.
The error given was something along the lines of “no matching call for function SpeedControllerGroup(VictorSP, VictorSP)” although there were some “* &” symbols somewhere in there.

I’m guessing you are trying to pass pointers into the SpeedControllerGroup constructor. SpeedControllerGroup actually takes references. I recommend initializing them how the PacGoat example does. It combines declaration and initialization to avoid repeating itself and maintains value semantics (i.e., no pointers anywhere): https://github.com/wpilibsuite/allwpilib/blob/master/wpilibcExamples/src/main/cpp/examples/PacGoat/src/Subsystems/DriveTrain.h#L64


private:
  // Subsystem devices
  frc::Spark m_frontLeftCIM{1};
  frc::Spark m_rearLeftCIM{2};
  frc::SpeedControllerGroup m_leftCIMs{m_frontLeftCIM, m_rearLeftCIM};

  frc::Spark m_frontRightCIM{3};
  frc::Spark m_rearRightCIM{4};
  frc::SpeedControllerGroup m_rightCIMs{m_frontRightCIM, m_rearRightCIM};

  frc::DifferentialDrive m_robotDrive{m_leftCIMs, m_rightCIMs};