Class CTREOutput

    • Constructor Summary

      Constructors 
      Constructor Description
      CTREOutput​(@NotNull com.ctre.phoenix.motorcontrol.IMotorController left, @NotNull com.ctre.phoenix.motorcontrol.IMotorController right)
      Creates a new CTREOutput.
      CTREOutput​(@NotNull com.ctre.phoenix.motorcontrol.IMotorController left, @NotNull com.ctre.phoenix.motorcontrol.IMotorController right, boolean closedLoop)
      Creates a new CTREOutput.
    • Constructor Detail

      • CTREOutput

        public CTREOutput​(@NotNull
                          @NotNull com.ctre.phoenix.motorcontrol.IMotorController left,
                          @NotNull
                          @NotNull com.ctre.phoenix.motorcontrol.IMotorController right)
        Creates a new CTREOutput. This is equivalent to calling CTREOutput(IMotorController, IMotorController, boolean) with closedLoop equal to true.
        Parameters:
        left - The left-side motor controller.
        right - The right-side motor controller.
      • CTREOutput

        public CTREOutput​(@NotNull
                          @NotNull com.ctre.phoenix.motorcontrol.IMotorController left,
                          @NotNull
                          @NotNull com.ctre.phoenix.motorcontrol.IMotorController right,
                          boolean closedLoop)
        Creates a new CTREOutput.
        Parameters:
        left - The left-side motor controller.
        right - The right-side motor controller.
        closedLoop - Whether to command the controllers in closed-loop mode if possible. (See isClosedLoop()/setClosedLoop()).
    • Method Detail

      • accept

        @Contract(pure=true)
        public void accept​(@NotNull
                           @NotNull TankDriveData tankDriveData)
        Command previously set motors according to the provided TankDriveData.

        If closed-loop is enabled (isClosedLoop() returns true), when the provided TankDriveData has non-empty position or velocity fields, that setpoint will be sent to the motor controllers as a closed-loop setpoint, with any additional feed-forward sent via throttle bump. (Position has priority over velocity when deciding which setpoint to send.) If it is false, or if the provided TankDriveData has empty position and velocity fields, DriveData.additionalFeedForward (or 0 if it is not present) will be passed in as the motor throttle from -1 to 1 inclusive.

        Specified by:
        accept in interface Consumer<TankDriveData>
        Parameters:
        tankDriveData - The data to accept.
      • isClosedLoop

        @Contract(pure=true)
        public boolean isClosedLoop()
        Returns whether this CTREOutput commands its controllers in closed-loop mode if possible. If true, when accept() is called and the provided TankDriveData has non-empty position or velocity fields, that setpoint will be sent to the motor controllers as a closed-loop setpoint, with any additional feed-forward sent via throttle bump (position has priority over velocity when deciding which setpoint to send.) If false, or if the provided TankDriveData has empty position and velocity fields, DriveData.additionalFeedForward (or 0 if it is not present) will be passed in as the motor throttle from -1 to 1 inclusive.
        Returns:
        true if closed-loop control will be used, false otherwise.
      • setClosedLoop

        public void setClosedLoop​(boolean closedLoop)
        Sets whether this CTREOutput commands its controllers in closed-loop mode if possible. If closedLoop is true, when accept() is called and the provided TankDriveData has non-empty position or velocity fields, that setpoint will be sent to the motor controllers as a closed-loop setpoint, with any additional feed-forward sent via throttle bump. (Position has priority over velocity when deciding which setpoint to send.) If it is false, or if the provided TankDriveData has empty position and velocity fields, DriveData.additionalFeedForward (or 0 if it is not present) will be passed in as the motor throttle from -1 to 1 inclusive.
        Parameters:
        closedLoop - Whether to use closed-loop, if possible.