Home
Roadside
Carputer
geoHist
software
FRC
Blog
Now you can download a copy of these docs so you can use them offline!
Download now
Main Page
Related Pages
Classes
Files
File List
Commands
PIDCommand.cpp
1
/*----------------------------------------------------------------------------*/
2
/* Copyright (c) FIRST 2011. All Rights Reserved. */
3
/* Open Source Software - may be modified and shared by FRC teams. The code */
4
/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
5
/*----------------------------------------------------------------------------*/
6
7
#include "Commands/PIDCommand.h"
8
9
#include "PIDController.h"
10
#include "float.h"
11
12
PIDCommand::PIDCommand(
const
char
*name,
double
p,
double
i,
double
d,
double
f,
double
period) :
13
Command
(name)
14
{
15
m_controller =
new
PIDController
(p, i, d,
this
,
this
, period);
16
}
17
18
PIDCommand::PIDCommand(
double
p,
double
i,
double
d,
double
f,
double
period)
19
{
20
m_controller =
new
PIDController
(p, i, d, f,
this
,
this
, period);
21
}
22
23
PIDCommand::PIDCommand(
const
char
*name,
double
p,
double
i,
double
d) :
24
Command
(name)
25
{
26
m_controller =
new
PIDController
(p, i, d,
this
,
this
);
27
}
28
29
PIDCommand::PIDCommand(
const
char
*name,
double
p,
double
i,
double
d,
double
period) :
30
Command
(name)
31
{
32
m_controller =
new
PIDController
(p, i, d,
this
,
this
, period);
33
}
34
35
PIDCommand::PIDCommand(
double
p,
double
i,
double
d)
36
{
37
m_controller =
new
PIDController
(p, i, d,
this
,
this
);
38
}
39
40
PIDCommand::PIDCommand(
double
p,
double
i,
double
d,
double
period)
41
{
42
m_controller =
new
PIDController
(p, i, d,
this
,
this
, period);
43
}
44
45
PIDCommand::~PIDCommand()
46
{
47
delete
m_controller;
48
}
49
50
void
PIDCommand::_Initialize()
51
{
52
m_controller->
Enable
();
53
}
54
55
void
PIDCommand::_End()
56
{
57
m_controller->
Disable
();
58
}
59
60
void
PIDCommand::_Interrupted()
61
{
62
_End();
63
}
64
65
void
PIDCommand::SetSetpointRelative(
double
deltaSetpoint)
66
{
67
SetSetpoint(GetSetpoint() + deltaSetpoint);
68
}
69
70
void
PIDCommand::PIDWrite(
float
output)
71
{
72
UsePIDOutput(output);
73
}
74
75
double
PIDCommand::PIDGet()
76
{
77
return
ReturnPIDInput();
78
}
79
80
PIDController
*PIDCommand::GetPIDController()
81
{
82
return
m_controller;
83
}
84
85
void
PIDCommand::SetSetpoint(
double
setpoint)
86
{
87
m_controller->
SetSetpoint
(setpoint);
88
}
89
90
double
PIDCommand::GetSetpoint()
91
{
92
return
m_controller->
GetSetpoint
();
93
}
94
95
double
PIDCommand::GetPosition()
96
{
97
return
ReturnPIDInput();
98
}
99
100
std::string
PIDCommand::GetSmartDashboardType
(){
101
return
"PIDCommand"
;
102
}
103
void
PIDCommand::InitTable
(
ITable
* table){
104
m_controller->
InitTable
(table);
105
Command::InitTable
(table);
106
}
PIDController::SetSetpoint
virtual void SetSetpoint(float setpoint)
Definition:
PIDController.cpp:373
ITable
Definition:
ITable.h:26
PIDCommand::InitTable
virtual void InitTable(ITable *table)
Definition:
PIDCommand.cpp:103
PIDCommand::GetSmartDashboardType
virtual std::string GetSmartDashboardType()
Definition:
PIDCommand.cpp:100
Command
Definition:
Command.h:43
PIDController::Enable
virtual void Enable()
Definition:
PIDController.cpp:504
PIDController
Definition:
PIDController.h:26
PIDController::InitTable
virtual void InitTable(ITable *table)
Definition:
PIDController.cpp:568
PIDController::GetSetpoint
virtual float GetSetpoint()
Definition:
PIDController.cpp:402
PIDController::Disable
virtual void Disable()
Definition:
PIDController.cpp:520
Command::InitTable
virtual void InitTable(ITable *table)
Definition:
Command.cpp:448
Generated on Sat Apr 26 2014 12:26:45 for WPILibC++ by
1.8.6
© 2006-2009 Dustin Spicuzza. All rights reserved.
Powered by Onnac
I do not condone or encourage graffiti. Please paint responsibly.