Too Many Initializer Values

With the swerve program that my team is working on we decided too following in another teams footsteps and use a class to initialize and run all of our swerve drive enclosures. I have debugged all of the code(took a while) and I just can’t seem to figure out why when I actually try initialize the final RobotSwerveDrive swerveDrive class it wont let me. Obviously this is an argument error, however I can’t seem to figure out what else to pass in. If needed I can post any part of the code. Thanks!

You are trying to initialize a pointer (RobotDriveSwerve* swerveDrive) as if it was a non-pointer object. You either need to make it a non-pointer, or use new.

There are some other issues with your code; in particular the RobotDriveSwerve constructor takes pointers, so you will need to pass references to swerveEnclosure1-4. Is your intent to construct this object every teleop loop? It seems unlikely given the snippet shown of RobotDriveSwerve. You should move all of these variables into class scope so they persist between calls to TeleopPeriodic().

Oh ok that makes sense. Do you think putting the RobotDriveSwerve Into TelOp InIt would be better as that only runs one, allowing for the constructor to exist, yet not getting reinitialized?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.