Class RobotDriveBase

    • Field Detail

      • m_deadband

        protected double m_deadband
      • m_maxOutput

        protected double m_maxOutput
    • Constructor Detail

      • RobotDriveBase

        public RobotDriveBase()
    • Method Detail

      • setDeadband

        public void setDeadband​(double deadband)
        Sets the deadband applied to the drive inputs (e.g., joystick values).

        The default value is 0.02. Inputs smaller than the deadband are set to 0.0 while inputs larger than the deadband are scaled from 0.0 to 1.0. See applyDeadband(double, double).

        Parameters:
        deadband - The deadband to set.
      • setMaxOutput

        public void setMaxOutput​(double maxOutput)
        Configure the scaling factor for using drive methods with motor controllers in a mode other than PercentVbus or to limit the maximum output.

        The default value is 1.0.

        Parameters:
        maxOutput - Multiplied with the output percentage computed by the drive functions.
      • feedWatchdog

        public void feedWatchdog()
        Feed the motor safety object. Resets the timer that will stop the motors if it completes.
        See Also:
        MotorSafetyHelper.feed()
      • limit

        protected double limit​(double value)
        Limit motor values to the -1.0 to +1.0 range.
      • applyDeadband

        protected double applyDeadband​(double value,
                                       double deadband)
        Returns 0.0 if the given value is within the specified range around zero. The remaining range between the deadband and 1.0 is scaled from 0.0 to 1.0.
        Parameters:
        value - value to clip
        deadband - range around zero
      • normalize

        protected void normalize​(double[] wheelSpeeds)
        Normalize all wheel speeds if the magnitude of any wheel is greater than 1.0.