mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-25 01:41:43 +00:00
[docs] Add missing JavaDocs (#6146)
This commit is contained in:
@@ -25,8 +25,10 @@ import java.util.function.BooleanSupplier;
|
||||
* <p>This class is provided by the NewCommands VendorDep
|
||||
*/
|
||||
public abstract class Command implements Sendable {
|
||||
/** Requirements set. */
|
||||
protected Set<Subsystem> m_requirements = new HashSet<>();
|
||||
|
||||
/** Default constructor. */
|
||||
@SuppressWarnings("this-escape")
|
||||
protected Command() {
|
||||
String name = getClass().getName();
|
||||
|
||||
@@ -16,4 +16,9 @@ import edu.wpi.first.util.sendable.Sendable;
|
||||
*/
|
||||
@Deprecated(since = "2024", forRemoval = true)
|
||||
@SuppressWarnings("PMD.AbstractClassWithoutAnyMethod")
|
||||
public abstract class CommandBase extends Command {}
|
||||
public abstract class CommandBase extends Command {
|
||||
/** Default constructor. */
|
||||
public CommandBase() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,9 +19,16 @@ import java.util.function.DoubleSupplier;
|
||||
* <p>This class is provided by the NewCommands VendorDep
|
||||
*/
|
||||
public class PIDCommand extends Command {
|
||||
/** PID controller. */
|
||||
protected final PIDController m_controller;
|
||||
|
||||
/** Measurement getter. */
|
||||
protected DoubleSupplier m_measurement;
|
||||
|
||||
/** Setpoint getter. */
|
||||
protected DoubleSupplier m_setpoint;
|
||||
|
||||
/** PID controller output consumer. */
|
||||
protected DoubleConsumer m_useOutput;
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,7 +15,10 @@ import edu.wpi.first.math.controller.PIDController;
|
||||
* <p>This class is provided by the NewCommands VendorDep
|
||||
*/
|
||||
public abstract class PIDSubsystem extends SubsystemBase {
|
||||
/** PID controller. */
|
||||
protected final PIDController m_controller;
|
||||
|
||||
/** Whether PID controller output is enabled. */
|
||||
protected boolean m_enabled;
|
||||
|
||||
/**
|
||||
@@ -47,6 +50,11 @@ public abstract class PIDSubsystem extends SubsystemBase {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the PIDController.
|
||||
*
|
||||
* @return The controller.
|
||||
*/
|
||||
public PIDController getController() {
|
||||
return m_controller;
|
||||
}
|
||||
|
||||
@@ -21,9 +21,16 @@ import java.util.function.Supplier;
|
||||
* <p>This class is provided by the NewCommands VendorDep
|
||||
*/
|
||||
public class ProfiledPIDCommand extends Command {
|
||||
/** Profiled PID controller. */
|
||||
protected final ProfiledPIDController m_controller;
|
||||
|
||||
/** Measurement getter. */
|
||||
protected DoubleSupplier m_measurement;
|
||||
|
||||
/** Goal getter. */
|
||||
protected Supplier<State> m_goal;
|
||||
|
||||
/** Profiled PID controller output consumer. */
|
||||
protected BiConsumer<Double, State> m_useOutput;
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,7 +17,10 @@ import edu.wpi.first.math.trajectory.TrapezoidProfile;
|
||||
* <p>This class is provided by the NewCommands VendorDep
|
||||
*/
|
||||
public abstract class ProfiledPIDSubsystem extends SubsystemBase {
|
||||
/** Profiled PID controller. */
|
||||
protected final ProfiledPIDController m_controller;
|
||||
|
||||
/** Whether the profiled PID controller output is enabled. */
|
||||
protected boolean m_enabled;
|
||||
|
||||
/**
|
||||
@@ -47,6 +50,11 @@ public abstract class ProfiledPIDSubsystem extends SubsystemBase {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ProfiledPIDController.
|
||||
*
|
||||
* @return The controller.
|
||||
*/
|
||||
public ProfiledPIDController getController() {
|
||||
return m_controller;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,9 @@ import edu.wpi.first.wpilibj.Timer;
|
||||
* <p>This class is provided by the NewCommands VendorDep
|
||||
*/
|
||||
public class WaitCommand extends Command {
|
||||
/** The timer used for waiting. */
|
||||
protected Timer m_timer = new Timer();
|
||||
|
||||
private final double m_duration;
|
||||
|
||||
/**
|
||||
|
||||
@@ -42,10 +42,20 @@ public class InternalButton extends Trigger {
|
||||
this.m_inverted = inverted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether to invert button state.
|
||||
*
|
||||
* @param inverted Whether button state should be inverted.
|
||||
*/
|
||||
public void setInverted(boolean inverted) {
|
||||
m_inverted.set(inverted);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether button is pressed.
|
||||
*
|
||||
* @param pressed Whether button is pressed.
|
||||
*/
|
||||
public void setPressed(boolean pressed) {
|
||||
m_pressed.set(pressed);
|
||||
}
|
||||
|
||||
@@ -426,6 +426,7 @@ class Command : public wpi::Sendable, public wpi::SendableHelper<Command> {
|
||||
protected:
|
||||
Command();
|
||||
|
||||
/// Requirements set.
|
||||
wpi::SmallSet<Subsystem*, 4> m_requirements;
|
||||
|
||||
/**
|
||||
|
||||
@@ -74,9 +74,16 @@ class PIDCommand : public CommandHelper<Command, PIDCommand> {
|
||||
frc::PIDController& GetController();
|
||||
|
||||
protected:
|
||||
/// PID controller.
|
||||
frc::PIDController m_controller;
|
||||
|
||||
/// Measurement getter.
|
||||
std::function<double()> m_measurement;
|
||||
|
||||
/// Setpoint getter.
|
||||
std::function<double()> m_setpoint;
|
||||
|
||||
/// PID controller output consumer.
|
||||
std::function<void(double)> m_useOutput;
|
||||
};
|
||||
} // namespace frc2
|
||||
|
||||
@@ -69,7 +69,10 @@ class PIDSubsystem : public SubsystemBase {
|
||||
frc::PIDController& GetController();
|
||||
|
||||
protected:
|
||||
/// PID controller.
|
||||
frc::PIDController m_controller;
|
||||
|
||||
/// Whether PID controller output is enabled.
|
||||
bool m_enabled{false};
|
||||
|
||||
/**
|
||||
|
||||
@@ -139,9 +139,16 @@ class ProfiledPIDCommand
|
||||
frc::ProfiledPIDController<Distance>& GetController() { return m_controller; }
|
||||
|
||||
protected:
|
||||
/// Profiled PID controller.
|
||||
frc::ProfiledPIDController<Distance> m_controller;
|
||||
|
||||
/// Measurement getter.
|
||||
std::function<Distance_t()> m_measurement;
|
||||
|
||||
/// Goal getter.
|
||||
std::function<State()> m_goal;
|
||||
|
||||
/// Profiled PID controller output consumer.
|
||||
std::function<void(double, State)> m_useOutput;
|
||||
};
|
||||
} // namespace frc2
|
||||
|
||||
@@ -91,7 +91,10 @@ class ProfiledPIDSubsystem : public SubsystemBase {
|
||||
frc::ProfiledPIDController<Distance>& GetController() { return m_controller; }
|
||||
|
||||
protected:
|
||||
/// Profiled PID controller.
|
||||
frc::ProfiledPIDController<Distance> m_controller;
|
||||
|
||||
/// Whether the profiled PID controller output is enabled.
|
||||
bool m_enabled{false};
|
||||
|
||||
/**
|
||||
|
||||
@@ -41,6 +41,7 @@ class WaitCommand : public CommandHelper<Command, WaitCommand> {
|
||||
void InitSendable(wpi::SendableBuilder& builder) override;
|
||||
|
||||
protected:
|
||||
/// The timer used for waiting.
|
||||
frc::Timer m_timer;
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user