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 aConstantEmulationParams
that 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 double
getCoefficientOfStaticFriction()
Returns the approximate coefficient of static friction between the robot's wheels, and the surface that it is driving on.int
getImmediatePathSize()
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.double
getMaximumSpeed()
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.double
getMinimumSpeed()
The minimum speed, in units PER SECOND that the robot can be going at any given time during the path emulation.double
getOverturn()
Can also be called a turn inhibitor.PIDFAConfig
getPIDFAConfig()
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.int
getPointSkipCount()
Returns the number of points that are directly ahead of the robot that will be skipped by the path emulation algorithm.double
getPositionalCorrectionDistance()
Returns the minimum distance from the path that the robot must have in order to start correcting its position.double
getPositionalCorrectionInhibitor()
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:IEmulateParams
Can 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:
getOverturn
in interfaceIEmulateParams
- Returns:
- The Path's "overturn" value. This value defaults to 1.2
-
getMinimumSpeed
public double getMinimumSpeed()
Description copied from interface:IEmulateParams
The 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:
getMinimumSpeed
in interfaceIEmulateParams
- Returns:
- Minimum speed of the robot during emulation.
-
getMaximumSpeed
public double getMaximumSpeed()
Description copied from interface:IEmulateParams
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. This value must be greater than the minimum speed, and should be less than the robot's actual maximum speed.- Specified by:
getMaximumSpeed
in interfaceIEmulateParams
- Returns:
- Maximum speed of the robot during emulation.
-
getPositionalCorrectionInhibitor
public double getPositionalCorrectionInhibitor()
Description copied from interface:IEmulateParams
Returns 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:
getPositionalCorrectionInhibitor
in interfaceIEmulateParams
- Returns:
- Positional correction inhbitor.
-
getPositionalCorrectionDistance
public double getPositionalCorrectionDistance()
Description copied from interface:IEmulateParams
Returns 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 theHyperdrive
constructor.- Specified by:
getPositionalCorrectionDistance
in interfaceIEmulateParams
- Returns:
- Minimum distance in units for positional correction to activate.
-
getCoefficientOfStaticFriction
public double getCoefficientOfStaticFriction()
Description copied from interface:IEmulateParams
Returns 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:
getCoefficientOfStaticFriction
in interfaceIEmulateParams
- Returns:
- Coefficient of static friction between the robot's wheels and the floor's surface.
-
getPointSkipCount
public int getPointSkipCount()
Description copied from interface:IEmulateParams
Returns 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:
getPointSkipCount
in interfaceIEmulateParams
- Returns:
- The number of points to skip emulating.
-
getImmediatePathSize
public int getImmediatePathSize()
Description copied from interface:IEmulateParams
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. 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:
getImmediatePathSize
in interfaceIEmulateParams
- Returns:
- Number of points ahead of the robot to use to determine future turns.
-
getPIDFAConfig
public PIDFAConfig getPIDFAConfig()
Description copied from interface:IEmulateParams
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. 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:
getPIDFAConfig
in interfaceIEmulateParams
- Returns:
- PIDFA config.
-
-