Class MockCANMotorController

java.lang.Object
xbot.common.controls.actuators.XCANMotorController
xbot.common.controls.actuators.mock_adapters.MockCANMotorController
All Implemented Interfaces:
DataFrameRefreshable

public class MockCANMotorController extends XCANMotorController
Mock XCANMotorController for simulation. - Power and voltage is grouped. - The user is responsible for updating its position and velocity.
  • Field Details

    • p

      public double p
    • i

      public double i
    • d

      public double d
    • s

      public double s
    • f

      public double f
    • g

      public double g
    • maxPower

      public double maxPower
    • minPower

      public double minPower
  • Constructor Details

  • Method Details

    • setConfiguration

      public void setConfiguration(CANMotorControllerOutputConfig outputConfig)
      Specified by:
      setConfiguration in class XCANMotorController
    • setOpenLoopRampRates

      public void setOpenLoopRampRates(org.wpilib.units.measure.Time dutyCyclePeriod, org.wpilib.units.measure.Time voltagePeriod)
      Specified by:
      setOpenLoopRampRates in class XCANMotorController
    • setClosedLoopRampRates

      public void setClosedLoopRampRates(org.wpilib.units.measure.Time dutyCyclePeriod, org.wpilib.units.measure.Time voltagePeriod)
      Specified by:
      setClosedLoopRampRates in class XCANMotorController
    • setTrapezoidalProfileAcceleration

      public void setTrapezoidalProfileAcceleration(org.wpilib.units.measure.AngularAcceleration acceleration)
      Specified by:
      setTrapezoidalProfileAcceleration in class XCANMotorController
    • setTrapezoidalProfileJerk

      public void setTrapezoidalProfileJerk(org.wpilib.units.measure.Velocity<org.wpilib.units.AngularAccelerationUnit> jerk)
      Specified by:
      setTrapezoidalProfileJerk in class XCANMotorController
    • setTrapezoidalProfileMaxVelocity

      public void setTrapezoidalProfileMaxVelocity(org.wpilib.units.measure.AngularVelocity velocity)
      Specified by:
      setTrapezoidalProfileMaxVelocity in class XCANMotorController
    • setPidDirectly

      public void setPidDirectly(XCANMotorControllerPIDProperties pidProperties, int slot)
      Description copied from class: XCANMotorController
      Set the PID values for the motor controller directly, without using tunables.
      Specified by:
      setPidDirectly in class XCANMotorController
      Parameters:
      pidProperties - The PID properties to set.
      slot - The PID slot to set the values for.
    • getHealth

      public DeviceHealth getHealth()
      Specified by:
      getHealth in class XCANMotorController
    • setPower

      public void setPower(double power)
      Specified by:
      setPower in class XCANMotorController
    • setPowerInternal

      public void setPowerInternal(double power)
    • getPower

      public double getPower()
      Specified by:
      getPower in class XCANMotorController
    • setPowerRange

      public void setPowerRange(double minPower, double maxPower)
      Specified by:
      setPowerRange in class XCANMotorController
    • getRawPosition_internal

      public org.wpilib.units.measure.Angle getRawPosition_internal()
    • setRawPosition

      public void setRawPosition(org.wpilib.units.measure.Angle position)
      Description copied from class: XCANMotorController
      Override the position of the motor controller.

      Typically, this would be called to zero the reported position of the motor as part of a calibration routine.

      Specified by:
      setRawPosition in class XCANMotorController
      Parameters:
      position - The new position to set.
    • setRawPositionTarget

      public void setRawPositionTarget(org.wpilib.units.measure.Angle rawPosition, XCANMotorController.MotorPidMode mode, int slot)
      Description copied from class: XCANMotorController
      Set the target position for the motor controller.
      Specified by:
      setRawPositionTarget in class XCANMotorController
      Parameters:
      rawPosition - The target position to set.
      mode - The PID mode to use when setting the target position.
      slot - The PID slot to use when setting the target position.
    • getTargetPosition

      public org.wpilib.units.measure.Angle getTargetPosition()
    • getRawTargetPosition

      public org.wpilib.units.measure.Angle getRawTargetPosition()
    • getRawVelocity_internal

      public org.wpilib.units.measure.AngularVelocity getRawVelocity_internal()
    • setVelocity

      public void setVelocity(org.wpilib.units.measure.AngularVelocity velocity)
    • setRawVelocity

      public void setRawVelocity(org.wpilib.units.measure.AngularVelocity rawVelocity)
    • setRawVelocityTarget

      public void setRawVelocityTarget(org.wpilib.units.measure.AngularVelocity rawVelocity, XCANMotorController.MotorPidMode mode, int slot)
      Description copied from class: XCANMotorController
      Set the target velocity for the motor controller.
      Specified by:
      setRawVelocityTarget in class XCANMotorController
      Parameters:
      rawVelocity - The target velocity to set.
      mode - The PID mode to use when setting the target velocity.
      slot - The PID slot to use when setting the target velocity.
    • setRawVelocityTargetWithFeedForward

      public void setRawVelocityTargetWithFeedForward(org.wpilib.units.measure.AngularVelocity rawVelocity, XCANMotorController.MotorPidMode mode, double feedForward, int slot)
      Description copied from class: XCANMotorController
      Set the target velocity for the motor controller.
      Specified by:
      setRawVelocityTargetWithFeedForward in class XCANMotorController
      Parameters:
      rawVelocity - The target velocity to set.
      mode - The PID mode to use when setting the target velocity.
      feedForward - The additional feed forward to apply (in volts for voltage PID modes or -1..1 for duty-cycle PID modes).
      slot - The PID slot to use when setting the target velocity.
    • getRawTargetVelocity

      public org.wpilib.units.measure.AngularVelocity getRawTargetVelocity()
    • setVoltage

      public void setVoltage(org.wpilib.units.measure.Voltage voltage)
      Specified by:
      setVoltage in class XCANMotorController
    • setVoltageRange

      public void setVoltageRange(org.wpilib.units.measure.Voltage minVoltage, org.wpilib.units.measure.Voltage maxVoltage)
      Specified by:
      setVoltageRange in class XCANMotorController
    • isInverted

      public boolean isInverted()
      Specified by:
      isInverted in class XCANMotorController
    • getControlMode

      public MockCANMotorController.ControlMode getControlMode()
    • setPositionAndVelocityUpdateFrequency

      public void setPositionAndVelocityUpdateFrequency(org.wpilib.units.measure.Frequency frequency)
      Specified by:
      setPositionAndVelocityUpdateFrequency in class XCANMotorController
    • updateInputs

      protected void updateInputs(XCANMotorControllerInputs inputs)
      Specified by:
      updateInputs in class XCANMotorController