N K
/
GaNtroller
a fork of priustroller
Fork of priustroller_current by
main.cpp@35:83cf9564bd0c, 2015-03-16 (annotated)
- Committer:
- bwang
- Date:
- Mon Mar 16 15:40:07 2015 +0000
- Revision:
- 35:83cf9564bd0c
- Parent:
- 34:bfe180de813a
- Child:
- 36:11766b5da6ed
Set for 3A Iq, 0A Id, Ki = 1e-3, Kp = Kd = 0, loop still oscillates but is passable
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bwang | 0:54cf32d35f4d | 1 | #include "includes.h" |
bwang | 11:dccbaa9274c5 | 2 | #include "transforms.h" |
bwang | 11:dccbaa9274c5 | 3 | #include "filters.h" |
bwang | 11:dccbaa9274c5 | 4 | #include "context.h" |
bwang | 1:1f58bdcf2956 | 5 | #include "core.h" |
bwang | 1:1f58bdcf2956 | 6 | #include "meta.h" |
bwang | 11:dccbaa9274c5 | 7 | #include "sensors.h" |
bwang | 11:dccbaa9274c5 | 8 | #include "callbacks.h" |
nki | 27:846c08fb3697 | 9 | |
bwang | 11:dccbaa9274c5 | 10 | int main() { |
bwang | 11:dccbaa9274c5 | 11 | Context *context = new Context(); |
bwang | 11:dccbaa9274c5 | 12 | context->ConfigureOutputs(D6, D13, D3, D8); |
nki | 33:e7b132029bae | 13 | context->ConfigureCurrentSensors(A1, A2, 0.01f, 0.7f); |
bwang | 35:83cf9564bd0c | 14 | context->ConfigureIdPidController(0.001f, 0.0f, 0.0f, 1.0f, -1.0f); |
nki | 34:bfe180de813a | 15 | context->ConfigureIqPidController(0.001f, 0.0f, 0.0f, 1.0f, -1.0f); |
bwang | 11:dccbaa9274c5 | 16 | context->ConfigureThrottle(A0, 0.8f, 3.0f); |
nki | 33:e7b132029bae | 17 | context->ConfigurePositionSensor(A4, A5, 0.249f, 0.497f, 0.231f, 0.499f, 205.0f); |
bwang | 35:83cf9564bd0c | 18 | context->ConfigureReference(3.0f); // max phase current |
bwang | 35:83cf9564bd0c | 19 | context->ConfigureDebugger(2, 2000); |
bwang | 11:dccbaa9274c5 | 20 | context->AttachCallBack(&fast, 5000); |
bwang | 11:dccbaa9274c5 | 21 | context->AttachCallBack(&slow, 10); |
bwang | 11:dccbaa9274c5 | 22 | context->AttachCallBack(&debug, 10); |
bwang | 24:f1ff9c7256b5 | 23 | context->AttachCallBack(&log, 500); |
bwang | 11:dccbaa9274c5 | 24 | context->Start(); |
bwang | 0:54cf32d35f4d | 25 | } |