jerrym | 1815d88 | 2013-02-14 04:21:29 +0000 | [diff] [blame] | 1 | // RobotBuilder Version: 0.0.2
|
| 2 | //
|
| 3 | // This file was generated by RobotBuilder. It contains sections of
|
| 4 | // code that are automatically generated and assigned by robotbuilder.
|
| 5 | // These sections will be updated in the future when you export to
|
| 6 | // C++ from RobotBuilder. Do not put any code or make any change in
|
| 7 | // the blocks indicating autogenerated code or it will be lost on an
|
| 8 | // update. Deleting the comments indicating the section will prevent
|
| 9 | // it from being updated in th future.
|
| 10 | #include "ShooterWheelPIDController.h"
|
| 11 | #include "../Robotmap.h"
|
| 12 | #include "SmartDashboard/SmartDashboard.h"
|
| 13 | #include "LiveWindow/LiveWindow.h"
|
| 14 | // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=PID
|
| 15 | ShooterWheelPIDController::ShooterWheelPIDController() : PIDSubsystem("ShooterWheelPIDController", 1.0, 0.0, 0.0) {
|
| 16 | SetAbsoluteTolerance(0.2);
|
| 17 | GetPIDController()->SetContinuous(false);
|
| 18 | LiveWindow::GetInstance()->AddActuator("Shooter Wheel PID Controller", "PIDSubsystem Controller", GetPIDController());
|
| 19 | // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=PID
|
| 20 | // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS
|
| 21 | shooterMotor = RobotMap::shooterWheelPIDControllerShooterMotor;
|
| 22 | shooterSpeedEncoder = RobotMap::shooterWheelPIDControllerShooterSpeedEncoder;
|
| 23 | // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS
|
| 24 | // Use these to get going:
|
| 25 | // SetSetpoint() - Sets where the PID controller should move the system
|
| 26 | // to
|
| 27 | // Enable() - Enables the PID controller.
|
| 28 | }
|
| 29 | double ShooterWheelPIDController::ReturnPIDInput() {
|
| 30 | // Return your input value for the PID loop
|
| 31 | // e.g. a sensor, like a potentiometer:
|
| 32 | // yourPot->SetAverageVoltage() / kYourMaxVoltage;
|
| 33 | // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=SOURCE
|
| 34 | return shooterSpeedEncoder->PIDGet();
|
| 35 | // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=SOURCE
|
| 36 | }
|
| 37 | void ShooterWheelPIDController::UsePIDOutput(double output) {
|
| 38 | // Use output to drive your system, like a motor
|
| 39 | // e.g. yourMotor->Set(output);
|
| 40 | // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=OUTPUT
|
| 41 | shooterMotor->PIDWrite(output);
|
| 42 | // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=OUTPUT
|
| 43 | }
|
| 44 | void ShooterWheelPIDController::InitDefaultCommand() {
|
| 45 | // Set the default command for a subsystem here.
|
| 46 | //setDefaultCommand(new MySpecialCommand());
|
| 47 | // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DEFAULT_COMMAND
|
| 48 | // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DEFAULT_COMMAND
|
| 49 | }
|