@@ -346,8 +346,7 @@ previous sections:
346
346
347
347
gen = crappy.blocks.Generator([
348
348
{' type' : ' constant' , ' value' : 1000 , ' condition' : ' delay=3' },
349
- {' type' : ' ramp' , ' speed' : 100 , ' condition' : ' delay=5' ,
350
- ' cmd' : 0 },
349
+ {' type' : ' ramp' , ' speed' : 100 , ' condition' : ' delay=5' },
351
350
{' type' : ' constant' , ' value' : 1800 , ' condition' : ' delay=3' },
352
351
{' type' : ' constant' , ' value' : 500 , ' condition' : ' delay=3' },
353
352
{' type' : ' sine' , ' amplitude' : 2000 , ' offset' : 1000 , ' freq' : .3 ,
@@ -370,7 +369,7 @@ previous sections:
370
369
kd = 0.05 ,
371
370
out_max = 10 ,
372
371
out_min = - 10 ,
373
- i_limit = 0.5 ,
372
+ i_limit = ( - 5 , 5 ) ,
374
373
target_label = ' command_speed' ,
375
374
labels = [' t(s)' , ' voltage' ],
376
375
input_label = ' actual_speed' )
@@ -389,16 +388,15 @@ outputted by the PID block. Finally the grapher needs to know the current speed
389
388
and the command speed, just like the PID. So let's add the appropriate links :
390
389
391
390
.. code-block :: python
392
- :emphasize- lines: 37 - 45
391
+ :emphasize- lines: 36 - 44
393
392
394
393
import crappy
395
394
396
395
if __name__ == ' __main__' :
397
396
398
397
gen = crappy.blocks.Generator([
399
398
{' type' : ' constant' , ' value' : 1000 , ' condition' : ' delay=3' },
400
- {' type' : ' ramp' , ' speed' : 100 , ' condition' : ' delay=5' ,
401
- ' cmd' : 0 },
399
+ {' type' : ' ramp' , ' speed' : 100 , ' condition' : ' delay=5' },
402
400
{' type' : ' constant' , ' value' : 1800 , ' condition' : ' delay=3' },
403
401
{' type' : ' constant' , ' value' : 500 , ' condition' : ' delay=3' },
404
402
{' type' : ' sine' , ' amplitude' : 2000 , ' offset' : 1000 , ' freq' : .3 ,
@@ -422,7 +420,7 @@ and the command speed, just like the PID. So let's add the appropriate links :
422
420
kd = 0.05 ,
423
421
out_max = 10 ,
424
422
out_min = - 10 ,
425
- i_limit = 0.5 ,
423
+ i_limit = ( - 5 , 5 ) ,
426
424
target_label = ' command_speed' ,
427
425
labels = [' t(s)' , ' voltage' ],
428
426
input_label = ' actual_speed' )
0 commit comments