77
88package org .carlmontrobotics .lib199 ;
99
10+ import org .carlmontrobotics .MotorConfig ;
11+ import org .carlmontrobotics .lib199 .sim .MockSparkMax ;
12+ import org .carlmontrobotics .lib199 .sim .MockTalonSRX ;
13+ import org .carlmontrobotics .lib199 .sim .MockVictorSPX ;
14+
1015import com .ctre .phoenix .motorcontrol .NeutralMode ;
1116import com .ctre .phoenix .motorcontrol .can .WPI_TalonSRX ;
1217import com .ctre .phoenix .motorcontrol .can .WPI_VictorSPX ;
13- import com .ctre .phoenix .sensors .CANCoder ;
1418import com .revrobotics .CANSparkMax ;
1519import com .revrobotics .CANSparkMax .ExternalFollower ;
1620import com .revrobotics .CANSparkMax .IdleMode ;
1721import com .revrobotics .CANSparkMaxLowLevel ;
1822import com .revrobotics .SparkMaxPIDController ;
1923
20- import org .carlmontrobotics .MotorConfig ;
21- import org .carlmontrobotics .lib199 .sim .MockSparkMax ;
22- import org .carlmontrobotics .lib199 .sim .MockTalonSRX ;
23- import org .carlmontrobotics .lib199 .sim .MockVictorSPX ;
24- import org .carlmontrobotics .lib199 .sim .MockedCANCoder ;
25-
26- import edu .wpi .first .cameraserver .CameraServer ;
27- import edu .wpi .first .cscore .UsbCamera ;
28- import edu .wpi .first .cscore .VideoSource .ConnectionStrategy ;
2924import edu .wpi .first .wpilibj .RobotBase ;
3025
3126/**
32- * Add your docs here .
27+ * A class containing methods to create and configure motor controllers .
3328 */
3429public class MotorControllerFactory {
3530 public static WPI_VictorSPX createVictor (int port ) {
@@ -150,37 +145,4 @@ public static CANSparkMax createSparkMax(int id, MotorConfig config) {
150145 return spark ;
151146 }
152147
153- public static CANCoder createCANCoder (int port ) {
154- CANCoder canCoder = new CANCoder (port );
155- if (RobotBase .isSimulation ()) new MockedCANCoder (canCoder );
156- return canCoder ;
157- }
158-
159- /**
160- * Configures a USB Camera.
161- * See {@link CameraServer#startAutomaticCapture} for more details.
162- * This MUST be called AFTER AHRS initialization or the code will be unable to connect to the gyro.
163- *
164- * @return The configured camera
165- */
166- public static UsbCamera configureCamera () {
167- UsbCamera camera = CameraServer .startAutomaticCapture ();
168- camera .setConnectionStrategy (ConnectionStrategy .kKeepOpen );
169- CameraServer .getServer ().setSource (camera );
170- return camera ;
171- }
172-
173- /**
174- * This method is equivalent to calling {@link #configureCamera()} {@code numCameras} times.
175- * The last camera will be set as the primary Camera feed.
176- * To change it, call {@code CameraServer.getServer().setSource()}.
177- *
178- * @param numCameras The number of cameras to configure
179- * @return The configured cameras.
180- */
181- public static UsbCamera [] configureCameras (int numCameras ) {
182- UsbCamera [] cameras = new UsbCamera [numCameras ];
183- for (int i = 0 ; i < numCameras ; i ++) cameras [i ] = configureCamera ();
184- return cameras ;
185- }
186148}
0 commit comments