Class PreferenceEmulationParams
- java.lang.Object
-
- frc.robot.util.hyperdrive.emulation.PreferenceEmulationParams
-
- All Implemented Interfaces:
IEmulateParams
public class PreferenceEmulationParams extends java.lang.Object implements IEmulateParams
A class that uses the Preferences table on the dashboard to determine a path's emulation parameters. Use this class to tune any paths that may need to be tuned, and then replace with aConstantEmulationParamsthat contains the tuned values from the Preferences table.
-
-
Constructor Summary
Constructors Constructor Description PreferenceEmulationParams(Units.LENGTH units)Creates a new PreferenceEmulationParams.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doublegetCoefficientOfStaticFriction()Returns the approximate coefficient of static friction between the robot's wheels, and the surface that it is driving on.intgetImmediatePathSize()Gets the number of points ahead of the robot (after the skipped points) that will be looked at to determine the robot's upcoming turns.doublegetMaximumSpeed()The maximum speed, in units PER SECOND that the robot can be going at any given time during the path emulation, and the speed that the robot will try to achieve during any straightaways.doublegetMinimumSpeed()The minimum speed, in units PER SECOND that the robot can be going at any given time during the path emulation.doublegetOverturn()Can also be called a turn inhibitor.PIDFAConfiggetPIDFAConfig()Gets the robots PIDFA configuration, which contains the user-configurable kP, kI, kD, kF and acceleration values necessary to figure out what percent output to drive the motors at.intgetPointSkipCount()Returns the number of points that are directly ahead of the robot that will be skipped by the path emulation algorithm.doublegetPositionalCorrectionDistance()Returns the minimum distance from the path that the robot must have in order to start correcting its position.doublegetPositionalCorrectionInhibitor()Returns the inhibitor for the robot's positional correction.
-
-
-
Constructor Detail
-
PreferenceEmulationParams
public PreferenceEmulationParams(Units.LENGTH units)
Creates a new PreferenceEmulationParams.- Parameters:
units- The units of length to use. This should be the same value that you defined Hyperdrive with.
-
-
Method Detail
-
getOverturn
public double getOverturn()
Description copied from interface:IEmulateParamsCan also be called a turn inhibitor. The turn amount that the robot calculates will be multiplied by this value to get the final turn amount. If one finds that the robot consistently does not turn enough, this value should be increased.- Specified by:
getOverturnin interfaceIEmulateParams- Returns:
- The Path's "overturn" value. This value defaults to 1.2
-
getMinimumSpeed
public double getMinimumSpeed()
Description copied from interface:IEmulateParamsThe minimum speed, in units PER SECOND that the robot can be going at any given time during the path emulation. No matter the tightness, the robot will always take any turn with at least this speed. This value is measured in units per second.- Specified by:
getMinimumSpeedin interfaceIEmulateParams- Returns:
- Minimum speed of the robot during emulation.
-
getMaximumSpeed
public double getMaximumSpeed()
Description copied from interface:IEmulateParamsThe maximum speed, in units PER SECOND that the robot can be going at any given time during the path emulation, and the speed that the robot will try to achieve during any straightaways. This value must be greater than the minimum speed, and should be less than the robot's actual maximum speed.- Specified by:
getMaximumSpeedin interfaceIEmulateParams- Returns:
- Maximum speed of the robot during emulation.
-
getPositionalCorrectionInhibitor
public double getPositionalCorrectionInhibitor()
Description copied from interface:IEmulateParamsReturns the inhibitor for the robot's positional correction. The greater this value, the more the robot will try to remain exactly on the path that it is driving. Setting this value too high might result in the robot driving in a "wavy" pattern (turning left, then right, then left again, then right again, and so on). Setting this value too low might cause the robot to not correct itself enough when it veers off course. This value defaults to 0.025.- Specified by:
getPositionalCorrectionInhibitorin interfaceIEmulateParams- Returns:
- Positional correction inhbitor.
-
getPositionalCorrectionDistance
public double getPositionalCorrectionDistance()
Description copied from interface:IEmulateParamsReturns the minimum distance from the path that the robot must have in order to start correcting its position. This value is measured in the unit given to theHyperdriveconstructor.- Specified by:
getPositionalCorrectionDistancein interfaceIEmulateParams- Returns:
- Minimum distance in units for positional correction to activate.
-
getCoefficientOfStaticFriction
public double getCoefficientOfStaticFriction()
Description copied from interface:IEmulateParamsReturns the approximate coefficient of static friction between the robot's wheels, and the surface that it is driving on. This value can also be used to tune the speed that the robot takes its turns. The lower this value is, the slower it takes turns. The higher this value is, the faster it takes turns. This value defaults to 0.6.- Specified by:
getCoefficientOfStaticFrictionin interfaceIEmulateParams- Returns:
- Coefficient of static friction between the robot's wheels and the floor's surface.
-
getPointSkipCount
public int getPointSkipCount()
Description copied from interface:IEmulateParamsReturns the number of points that are directly ahead of the robot that will be skipped by the path emulation algorithm. Some points ahead of the skipped points will then be used to determine how much the robot should turn. This ensures that the angle between the robot's trajectory and the point(s) ahead is true and not being made larger by a small distance from the robot to the point. This value defaults to 2, and likely will not need to be tuned.- Specified by:
getPointSkipCountin interfaceIEmulateParams- Returns:
- The number of points to skip emulating.
-
getImmediatePathSize
public int getImmediatePathSize()
Description copied from interface:IEmulateParamsGets the number of points ahead of the robot (after the skipped points) that will be looked at to determine the robot's upcoming turns. A larger value will mean that the robot's path will be smoother than that of a path with a small value. A larger value will also cause the robot to start turning sooner than a path with a smaller value.- Specified by:
getImmediatePathSizein interfaceIEmulateParams- Returns:
- Number of points ahead of the robot to use to determine future turns.
-
getPIDFAConfig
public PIDFAConfig getPIDFAConfig()
Description copied from interface:IEmulateParamsGets the robots PIDFA configuration, which contains the user-configurable kP, kI, kD, kF and acceleration values necessary to figure out what percent output to drive the motors at. If this method is being called from aPreferenceEmulationParams, all of these values will be pulled from the Preferences table on the dashboard. If this method is being called from aConstantEmulationParams, these values will be whatever they were initialized as.- Specified by:
getPIDFAConfigin interfaceIEmulateParams- Returns:
- PIDFA config.
-
-