wakaran
test.cpp@0:17acb05d7f3e, 2022-02-24 (annotated)
- Committer:
- yootee
- Date:
- Thu Feb 24 07:22:30 2022 +0000
- Revision:
- 0:17acb05d7f3e
ukuraina
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
yootee | 0:17acb05d7f3e | 1 | #include<mbed.h> |
yootee | 0:17acb05d7f3e | 2 | #include<IMC_motorDrive.hpp> |
yootee | 0:17acb05d7f3e | 3 | #include<F446RE_usefulConstruct.h> |
yootee | 0:17acb05d7f3e | 4 | #include<nap.hpp> |
yootee | 0:17acb05d7f3e | 5 | |
yootee | 0:17acb05d7f3e | 6 | const float dt = 0.02; |
yootee | 0:17acb05d7f3e | 7 | NAP nap(dt); |
yootee | 0:17acb05d7f3e | 8 | |
yootee | 0:17acb05d7f3e | 9 | Serial pc(USBTX,USBRX); |
yootee | 0:17acb05d7f3e | 10 | |
yootee | 0:17acb05d7f3e | 11 | IMC_motor motor(com[10],256,100*M_PI,com[3],20,10,dt); |
yootee | 0:17acb05d7f3e | 12 | int main(){ |
yootee | 0:17acb05d7f3e | 13 | pc.baud(115200); |
yootee | 0:17acb05d7f3e | 14 | nap.restart(); |
yootee | 0:17acb05d7f3e | 15 | while(1){ |
yootee | 0:17acb05d7f3e | 16 | motor.IMCdrive(300); |
yootee | 0:17acb05d7f3e | 17 | nap.take_a_nap(); |
yootee | 0:17acb05d7f3e | 18 | pc.printf("%lf[rpm] pwm=%lf pmv=%lf\n",motor.motor_enc.getSpeed(),motor.out_pwm,motor.process_model_val); |
yootee | 0:17acb05d7f3e | 19 | } |
yootee | 0:17acb05d7f3e | 20 | } |