Problem setting velocity to VictorSPX

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.

I mean that the set function does not appear listed when I type wheel.

http://www.ctr-electronics.com/downloads/api/java/html/classcom_1_1ctre_1_1phoenix_1_1motorcontrol_1_1can_1_1_w_p_i___victor_s_p_x.html

It exists, so ignore intellisense. And it has a set with only one double, I was wrong in the previous reply.

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