2019 and VS we were able to successfully use the TalonSRX and the SRX magnetic encoder.
We have since discovered that the class TalonSRX no longer exists and the following implementation throws errors:
frontLeft = new WPI_TalonSRX(3);
backLeft = new WPI_TalonSRX(1);
frontRight = new WPI_TalonSRX(2);
backRight = new WPI_TalonSRX(4);
leftDrive = new SpeedControllerGroup(frontLeft, backLeft);
rightDrive = new SpeedControllerGroup(frontRight, backRight);
allDrive = new SpeedControllerGroup(frontLeft, frontRight, backLeft, backRight);
diff_drive = new DifferentialDrive(leftDrive, rightDrive);
// There are two encoders, one set to the Talon controller for the motor
// on the rear left side and one for the Talon controller on the rear right
backLeft.setStatusFramePeriod(StatusFrameEnhanced.Status_2_Feedback0, 1, 30);
backLeft.configSelectedFeedbackSensor(FeedbackDevice.CTRE_MagEncoder_Relative, 0, 30);
backRight.setStatusFramePeriod(StatusFrameEnhanced.Status_2_Feedback0, 1, 30);
backRight.configSelectedFeedbackSensor(FeedbackDevice.CTRE_MagEncoder_Relative, 0, 30);
// We want to establish an initial encoder reading. This will enable reseting
// encoder position to zero when we start moving. We use absolute values to
// make the subsequent subtraction more easily interpreted.
initPosition1 = backLeft.getSelectedSensorPosition(1);
initPosition1 = Math.abs(initPosition1);
initPosition2 = frontRight.getSelectedSensorPosition(2);
initPosition2 = Math.abs(initPosition2);
// For reference we output encoder readings to the console
System.out.println("initPosition = " + initPosition1 + " initPosition2 = " + initPosition2);
Does someone have a simple implementation using the 2019 libraries?
Nope, it still exists.
API is nearly 100% backwards compatible, minor tweaks were mentioned here…
Yep, every example uses everything-2019…
LV teams can go to the Phoenix-Examples-LabVIEW repos.
And also this step is part of hardware bringup, first with a simple example…
… and then with WPI drivetrains classes if you want them…
Did you create a new project? Libraries are managed on a per project basis. You need to add them for each project.
I installed the WPILib 2019.2.1 and followed the instructions provided in the guides. It all seemed to go as expected. I get the “W” (FRC VS Code 2019) desktop icon and the others associated with FRC Shuffleboard, FRC SmartDashboard, Phoenix Tuner, Phoenix LifeBoat, and FRC Driver Station.
When I open VS code, there is no reference to a robot template anywhere that I can find. Is this the expected behavior? What am I missing?
Is there a “W” icon in the upper right corner? Click that and it will bring up a menu you can type into to select various command like “wpilib: create a new robot project.” Creating a new robot project has examples as one of the options (instead of an empty project from a template)
Thanks for the tip. I think I’m on the way. From the list; “open WPILib Command Palette” gets me into the WPILib Project Creator. Now a right click on build.gradle gives me “Manage Vendor Libraries”. I added the CTRE libraries and it built successfully.
The TalonSRX is recognized.
Thanks to all for the help.