749fe8c6d5
* Update pid.ts * description Description warning. I noticed a bug that when you use a controller instance with a certain number before and reuse it again the next time and do a reset before setting the values \u200b\u200band or the regulation limits, then the controller for some reason leads the control action to one side. For example, I put the ev3 robot on a line, two color sensors. Judging by the values from the sensors, it should go straight (the control action should be near zero), but the controller shows that it wants to take the robot to the side. The problem is not always, but often. Example... automation.pid1.reset(); automation.pid1.setGains(KP_LINE_FOLLOW, 0, KD_LINE_FOLLOW); automation.pid1.setControlSaturation(-100, 100); If the reset is done after, then the problem does not occur at all. automation.pid1.setGains(KP_LINE_FOLLOW, 0, KD_LINE_FOLLOW); automation.pid1.setControlSaturation(-100, 100); automation.pid1.reset(); |
||
---|---|---|
.vscode | ||
.gitignore | ||
.travis.yml | ||
LICENSE | ||
Makefile | ||
README.md | ||
SECURITY.md | ||
behaviors.ts | ||
movingaveragefilter.ts | ||
ns.ts | ||
pid.ts | ||
pxt.json | ||
test.ts | ||
tsconfig.json |
README.md
Automation
Various algorithm for Systems & Control operations for Microsoft MakeCode editors.
How to use this library?
In your MakeCode editor, click on the gearwheel menu and click "Extensions", search for "automation" and select this project.
PID controller
A Proportional-Integral-Derivative control is a classic control structure in automation.
The user needs to define 3 gains (Kp
, Ki
, Kd
) to tune the controller.
See Reference: Feedback System, Karl Johan Astrom & Rickard M. Murry
let v = 0;
automation.pid1.setGains(1, 0.01, 0.001);
for (let i = 0; i < 10; ++i) {
v = automation.pid1.compute(0.1, 5);
}
Behaviors
An example of Behavior-based robotics control system.
Moving Average Filter
let r = 0;
for (let i = 0; i < 10; ++i) {
r = automation.movingAverageFilter1.filter(Math.random());
}
Supported targets
- for PXT/maker
- for PXT/adafruit
- for PXT/codal
- for PXT/ev3
License
MIT
Code of Conduct
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.