Our team uses two control mode in our swerve drive . One is open loop control , the other is closed loop control. In the open loop control mode , we use set percnetoutput to control our robot. In the velocity closed loop , we use the set velocity to control our robot(maybe feedforward will be added soon). In closed loop , we choose the velocity closed loop. We achieve this through setting the specific values to our drive motor. And the code is below:
public static double kDriveMotorkP = 0.025; // 5e-2 0.05 0.025
public static double kDriveMotorkI = 0.0016; //5e-4 0.005 0.0016
public static double kDriveMotorkD = 2.5; // 5e-0 5 1.5 2.5
public static double kDriveMotorkF = 0.06;// 0.045 0.06
public static double kDriveMotorIZone = 240;// 90 240
So , l want to know that when we enable the open loop , which sets percentoutput, but are we actually in the open loop mode? Since the drive motor still has an internal kP,kI,kD,kF,and IntegralZone . Does it affect the open loop control? l am puzzling about it.
Any reply is appreciated!
Nope if you use the percent output control mode, it ignores the closed loop velocity mode. One does not affect the other.
How about setVoltage , does it ignore closed loop velocity mode?
l have run into another problem when using open loop control. l use
double percentout = optimalState.speedMetersPerSecond / Constants.kMaxSpeed; to get the percentoutput . However , l found that l can’t control the robot’s real speed through changing the kMaxSpeed. l think using this way to get the percentoutput is incorrect and the
Constants.kMaxSpeed should be replaced with the maxspeed of my swerve. But , how can l get the max speed? (Maybe if l can get the speed of Falcon 500 , which is my drive motor, l will get the maxSpeed of my swerve)
The easiest way to do this is to go into something like Phoenix tuner assuming your drive motor is a ctre flavor, and max out the output and look at the charts and graph to see how fast your wheel is going That’s your free wheel speed that you can use here
Thanks that , l have found the the max RPM of Falcon 500 and calculate the max velocity of Falcon . However , when l use the percentoutput , the real speed of the swerve is lower when l use velocity to output. l am very puzzled.
6380 is the max falcon RPM so your max speed is
6380 / 60.0 * gearReduction * WheelDiameter * pi
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.