Skip to content

Commit ab6fc00

Browse files
author
Dwatkins
committed
Merge branch 'master' of https://github.com/rosmod/lib-pid
2 parents b515fe5 + f876cd3 commit ab6fc00

1 file changed

Lines changed: 47 additions & 0 deletions

File tree

README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# lib-pid
2+
simple pid class ready to import as a source library in ROSMOD
3+
4+
# source library setup
5+
6+
1. In this github repo navigate to [releases](https://github.com/rosmod/lib-pid/releases), right click on `pid.zip` (not the source code zip!) and select `Copy link address'
7+
2. In a rosmod project, drag in a new source library to the software model
8+
3. Paste the link in the url attribute
9+
4. Name the source library `pid`
10+
11+
12+
# Usage
13+
14+
1. Drag the library into the `set editor` of any component that uses it
15+
2. In the forwards section of the component add `#include "pid/pid.h`
16+
17+
18+
# API
19+
20+
## Instantiaion
21+
22+
```c++
23+
PID pidObject();
24+
PID pidObject(Kp, Ki, Kd, 0, 0, i_max, i_min);
25+
```
26+
27+
## Set goal
28+
29+
```c++
30+
// double goal = XXX;
31+
pidObject.setPoint(goal);
32+
```
33+
34+
## get pid output
35+
36+
```c++
37+
// double currentValue = XXX;
38+
double output = pidObject.update(currentValue);
39+
```
40+
41+
## Clamp output
42+
43+
```c++
44+
// double outputMin = XXX;
45+
// double outputMax = XXX;
46+
pidObject.limitOutput(outputMin, outputMax);
47+
```

0 commit comments

Comments
 (0)