Programming Error

Have an error saying:

Error at frc.robot.Robot.(Robot.java:36): Unhandled exception instantiating robot frc.robot.Robot java.lang.ClassCastException: class com.ctre.phoenix.motorcontrol.can.TalonSRX cannot be cast to class edu.wpi.first.wpilibj.SpeedController (com.ctre.phoenix.motorcontrol.can.TalonSRX and edu.wpi.first.wpilibj.SpeedController are in unnamed module of loader ‘app’)
at frc.robot.Robot.(Robot.java:36)
at edu.wpi.first.wpilibj.RobotBase.runRobot(RobotBase.java:231)
at edu.wpi.first.wpilibj.RobotBase.lambda$startRobot$0(RobotBase.java:329)
at java.base/java.lang.Thread.run(Thread.java:834)

Warning at edu.wpi.first.wpilibj.RobotBase.runRobot(RobotBase.java:244): Robots should not quit, but yours did!
Error at edu.wpi.first.wpilibj.RobotBase.runRobot(RobotBase.java:245): Could not instantiate robot frc.robot.Robot!
[phoenix] Library could NOT shutdown cleanly

PS C:\Users\robotics\Desktop\FRC2022\FRC2022RobotProgram>

Here is my Program:

Please help!!!

There is a class for the talon srx that is written for wpilib. I believe it is wpi_talonsrx. Use that instead of talonsrx.

2 Likes

It worked. Thank you and good luck at competition!!!

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