Adds command examples to built examples (#1062)

This commit is contained in:
Thad House
2018-05-15 23:56:03 -07:00
committed by Peter Johnson
parent 7cd15aa049
commit 938d5379e6
26 changed files with 771 additions and 1 deletions

View File

@@ -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());
}

View File

@@ -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;
};