mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Adds command examples to built examples (#1062)
This commit is contained in:
committed by
Peter Johnson
parent
7cd15aa049
commit
938d5379e6
@@ -0,0 +1,36 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "ReplaceMePIDSubsystem.h"
|
||||
|
||||
#include <LiveWindow/LiveWindow.h>
|
||||
#include <SmartDashboard/SmartDashboard.h>
|
||||
|
||||
ReplaceMePIDSubsystem::ReplaceMePIDSubsystem()
|
||||
: PIDSubsystem("ReplaceMePIDSubsystem", 1.0, 0.0, 0.0) {
|
||||
// Use these to get going:
|
||||
// SetSetpoint() - Sets where the PID controller should move the system
|
||||
// to
|
||||
// Enable() - Enables the PID controller.
|
||||
}
|
||||
|
||||
double ReplaceMePIDSubsystem::ReturnPIDInput() {
|
||||
// Return your input value for the PID loop
|
||||
// e.g. a sensor, like a potentiometer:
|
||||
// yourPot->SetAverageVoltage() / kYourMaxVoltage;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ReplaceMePIDSubsystem::UsePIDOutput(double output) {
|
||||
// Use output to drive your system, like a motor
|
||||
// e.g. yourMotor->Set(output);
|
||||
}
|
||||
|
||||
void ReplaceMePIDSubsystem::InitDefaultCommand() {
|
||||
// Set the default command for a subsystem here.
|
||||
// SetDefaultCommand(new MySpecialCommand());
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Commands/PIDSubsystem.h>
|
||||
|
||||
class ReplaceMePIDSubsystem : public frc::PIDSubsystem {
|
||||
public:
|
||||
ReplaceMePIDSubsystem();
|
||||
double ReturnPIDInput() override;
|
||||
void UsePIDOutput(double output) override;
|
||||
void InitDefaultCommand() override;
|
||||
};
|
||||
Reference in New Issue
Block a user