I am trying to set the velocity to a VictorSPX, I already imported the library from CTRE.
package frc.robot.subsystems;
import com.ctre.phoenix.motorcontrol.can.WPI_VictorSPX;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
public class ExampleSubsystem extends SubsystemBase {
/**
* Creates a new ExampleSubsystem.
*/
public WPI_VictorSPX wheel = new WPI_VictorSPX(50);
public ExampleSubsystem() {
wheel.configFactoryDefault();
}
@Override
public void periodic() {
}
}
When I try to call the function “set” stored in my variable, it doesn´t exist. What could the problem be?
If i understand correctly, this is happening because java is looking for a set() method with the parameter type/s you gave it, I’m assuming it was a double.
Edit: you don’t have to give a control mode if you use the WPI version of the VictorSPX because it gets a set(double) method from SpeedController
You need to specify the ControlMode for it.
Probably ControlMode.PercentOutput.
Would look like this:
wheel.set(ControlMode.PercentOutput, somedouble);
The second argument (the double) is -1 to 1.