Go to Post It isn't what you're given that makes it awesome. It's what you do with it. - JosephC [more]
Home
Go Back   Chief Delphi > Technical > Control System
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rating: Thread Rating: 8 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 31-01-2014, 14:33
gpetilli gpetilli is offline
Registered User
FRC #1559
 
Join Date: Jan 2009
Location: Victor, NY
Posts: 285
gpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to all
Re: Thread scheduler for PID period control ?

Quote:
Originally Posted by Joe Ross View Post
In addition, what method did you use to get the time?



What computer did you run the DS on?
It was a windows 7 lenovo - not sure the exact model but not more than two years old and definitely not a netbook. We did this tethered, not on WiFi.

Last edited by gpetilli : 31-01-2014 at 14:38.
Reply With Quote
  #2   Spotlight this post!  
Unread 31-01-2014, 21:58
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,576
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Thread scheduler for PID period control ?

I just ran the following code:

Code:
    double prevTime = 0;
    public void teleopPeriodic() {
        double time = Timer.getFPGATimestamp();
        System.out.println(time-prevTime);
        prevTime=time;
    }
And got the following output:

Code:
[cRIO] 0.014032000000000266
[cRIO] 0.020156000000000063
[cRIO] 0.02008299999999963
[cRIO] 0.019773999999998182
[cRIO] 0.019995999999999015
[cRIO] 0.020203999999999667
[cRIO] 0.01987100000000197
[cRIO] 0.020114999999996996
[cRIO] 0.02004800000000273
[cRIO] 0.02036799999999772
[cRIO] 0.019611000000004708
[cRIO] 0.019765999999997064
[cRIO] 0.019995999999999015
[cRIO] 0.019989000000002477
[cRIO] 0.02004999999999768
[cRIO] 0.019984999999998365
[cRIO] 0.0200450000000032
[cRIO] 0.019925000000000637
[cRIO] 0.019964999999999122
[cRIO] 0.020108999999997934
[cRIO] 0.020091000000000747
[cRIO] 0.019836000000005072
[cRIO] 0.019992999999999483
[cRIO] 0.02026199999999534
[cRIO] 0.019725000000001103
[cRIO] 0.019995999999999015
[cRIO] 0.020110000000002515
[cRIO] 0.019950999999998942
[cRIO] 0.019914999999997463
[cRIO] 0.020150000000001
[cRIO] 0.019964999999999122
[cRIO] 0.019953000000000998
[cRIO] 0.02007000000000403
[cRIO] 0.023333000000000936
[cRIO] 0.016567999999999472
[cRIO] 0.019990999999997427
[cRIO] 0.019987999999997896
[cRIO] 0.02036199999999866
[cRIO] 0.019624000000000308
[cRIO] 0.020121000000003164
[cRIO] 0.02003100000000302
[cRIO] 0.01989399999999364
[cRIO] 0.020100000000006446
[cRIO] 0.019787999999998362
[cRIO] 0.02019099999999696
[cRIO] 0.019915000000004568
[cRIO] 0.019970999999998185
[cRIO] 0.020511999999996533
[cRIO] 0.019507000000004382
[cRIO] 0.020938999999998487
[cRIO] 0.01930399999999821
[cRIO] 0.020080999999997573
[cRIO] 0.019986000000002946
[cRIO] 0.0199089999999984
[cRIO] 0.020019000000004894
[cRIO] 0.019859999999994216
[cRIO] 0.020032000000000494
[cRIO] 0.020005000000004713
[cRIO] 0.01986199999999627
[cRIO] 0.020163000000003706
[cRIO] 0.020060000000000855
[cRIO] 0.019814999999994143
[cRIO] 0.02012300000000522
[cRIO] 0.019915999999994938
[cRIO] 0.019857999999999265
[cRIO] 0.020221000000006484
[cRIO] 0.01981199999999461
[cRIO] 0.02013300000000129
[cRIO] 0.020065000000002442
[cRIO] 0.01982299999999526
[cRIO] 0.020184000000000424
[cRIO] 0.019892000000005794
[cRIO] 0.02009899999999476
[cRIO] 0.01988500000000215
[cRIO] 0.02012200000000064
[cRIO] 0.019989999999999952
[cRIO] 0.019863999999998327
[cRIO] 0.02014700000000147
[cRIO] 0.019995999999999015
[cRIO] 0.020175999999999306
[cRIO] 0.019838000000000022
[cRIO] 0.019888999999999157
[cRIO] 0.020115000000004102
[cRIO] 0.020016999999995733
[cRIO] 0.01998400000000089
[cRIO] 0.020042000000003668
[cRIO] 0.01999999999999602
[cRIO] 0.01975800000000305
[cRIO] 0.0200139999999962
[cRIO] 0.020180000000003417
[cRIO] 0.019850999999995622
[cRIO] 0.02010900000000504
[cRIO] 0.020080000000000098
[cRIO] 0.020117999999996528
[cRIO] 0.019851000000002728
[cRIO] 0.020186999999999955
[cRIO] 0.020111999999997465
[cRIO] 0.020330999999998767
[cRIO] 0.019290000000005136
[cRIO] 0.02057199999999426
[cRIO] 0.019626000000002364
[cRIO] 0.01993500000000381
[cRIO] 0.020097999999997285
[cRIO] 0.021600999999996873
[cRIO] 0.01841500000000451
[cRIO] 0.019878999999995983
[cRIO] 0.020146000000003994
[cRIO] 0.020054000000001793
[cRIO] 0.020954999999993618
[cRIO] 0.018789000000005274
[cRIO] 0.022835000000000605
[cRIO] 0.017481999999994002
[cRIO] 0.019851000000002728
[cRIO] 0.019829999999998904
[cRIO] 0.02016400000000118
[cRIO] 0.020018000000000313
[cRIO] 0.019930000000002224
[cRIO] 0.020049000000000206
[cRIO] 0.020051999999999737
[cRIO] 0.02079599999999715
[cRIO] 0.019050999999997487
[cRIO] 0.022271000000003482
[cRIO] 0.01766800000000046
[cRIO] 0.02002000000000237
[cRIO] 0.020178999999998837
[cRIO] 0.02001899999999779
[cRIO] 0.019908000000000925
[cRIO] 0.020046000000000674
[cRIO] 0.020044999999996094
[cRIO] 0.019980000000003884
[cRIO] 0.01983699999999544
[cRIO] 0.02458000000000027
[cRIO] 0.0157040000000066
[cRIO] 0.01980599999999555
[cRIO] 0.020093000000002803
[cRIO] 0.0201279999999997
[cRIO] 0.019898999999995226
[cRIO] 0.020168000000005293
[cRIO] 0.019810999999997136
[cRIO] 0.020003000000002658
[cRIO] 0.019991999999994903
[cRIO] 0.022979000000006522
[cRIO] 0.01685799999999915
[cRIO] 0.020008999999994614
[cRIO] 0.019876000000003557
[cRIO] 0.02014599999999689
[cRIO] 0.020217000000002372
[cRIO] 0.020510000000001583
[cRIO] 0.019436999999996374
[cRIO] 0.020022000000004425
[cRIO] 0.01999699999999649
[cRIO] 0.019826999999999373
[cRIO] 0.019909000000005506
[cRIO] 0.02016599999999613
[cRIO] 0.01995600000000053
[cRIO] 0.02026299999999992
[cRIO] 0.019973999999997716
[cRIO] 0.019733999999999696
[cRIO] 0.020008000000004245
[cRIO] 0.020130000000001758
[cRIO] 0.0199439999999953
[cRIO] 0.01991699999999952
[cRIO] 0.020014000000003307
[cRIO] 0.02026499999999487
[cRIO] 0.020091000000000747
[cRIO] 0.019711000000000922
[cRIO] 0.02048200000000122
[cRIO] 0.019823999999999842
[cRIO] 0.020276000000002625
[cRIO] 0.019548000000000343
[cRIO] 0.020054999999999268
[cRIO] 0.021468999999996186
[cRIO] 0.01859900000000181
[cRIO] 0.019700000000000273
[cRIO] 0.019939000000000817
[cRIO] 0.021791000000000338
[cRIO] 0.018093999999997834
[cRIO] 0.020206999999999198
[cRIO] 0.019817000000003304
[cRIO] 0.02050700000000205
[cRIO] 0.020139999999997826
[cRIO] 0.022245999999995547
[cRIO] 0.017315000000003522
[cRIO] 0.01983200000000096
[cRIO] 0.02001200000000125
[cRIO] 0.02009699999999981
[cRIO] 0.019945999999997355
[cRIO] 0.020163000000003706
[cRIO] 0.019883000000000095
[cRIO] 0.01994699999999483
[cRIO] 0.020003000000002658
[cRIO] 0.020181000000000893
[cRIO] 0.01998400000000089
[cRIO] 0.019994999999994434
[cRIO] 0.01981800000000078
[cRIO] 0.020724999999998772
[cRIO] 0.01940400000000153
[cRIO] 0.020572000000001367
[cRIO] 0.019492999999997096
[cRIO] 0.020011000000003776
[cRIO] 0.02001200000000125
[cRIO] 0.019867999999995334
[cRIO] 0.01991699999999952
[cRIO] 0.020219000000004428
[cRIO] 0.019978999999999303
[cRIO] 0.02002199999999732
[cRIO] 0.019750999999999408
[cRIO] 0.02012500000000017
[cRIO] 0.020092000000005328
[cRIO] 0.020537999999994838
[cRIO] 0.019495000000006257
[cRIO] 0.020107999999993353
[cRIO] 0.019899999999999807
[cRIO] 0.020124000000002695
[cRIO] 0.020169000000002768
[cRIO] 0.019700000000000273
[cRIO] 0.020637000000000683
[cRIO] 0.01944199999999796
[cRIO] 0.01986800000000244
[cRIO] 0.020131999999996708
[cRIO] 0.020014000000003307
[cRIO] 0.01990499999999429
[cRIO] 0.02029100000000028
[cRIO] 0.019598999999999478
[cRIO] 0.020002000000005182
[cRIO] 0.02232999999999663
[cRIO] 0.017898000000002412
[cRIO] 0.020381000000000427
[cRIO] 0.01945299999999861
[cRIO] 0.019967000000001178
[cRIO] 0.02024799999999516
[cRIO] 0.019709000000005972
[cRIO] 0.01999399999999696
[cRIO] 0.020249999999997215
[cRIO] 0.019863000000000852
[cRIO] 0.020217000000002372
[cRIO] 0.019892999999996164
[cRIO] 0.020042000000003668
[cRIO] 0.019748999999997352
[cRIO] 0.020043000000001143
[cRIO] 0.0200010000000006
[cRIO] 0.020333000000000823
[cRIO] 0.019875999999996452
[cRIO] 0.019884000000004676
[cRIO] 0.020113000000002046
[cRIO] 0.019994999999994434
[cRIO] 0.02008400000000421
[cRIO] 0.02040299999999462
[cRIO] 0.019336000000002684
[cRIO] 0.020540000000004
[cRIO] 0.01947499999999991
[cRIO] 0.020902999999997007
[cRIO] 0.01910999999999774
[cRIO] 0.019978000000001828
[cRIO] 0.020012999999998726
[cRIO] 0.020107000000002984
[cRIO] 0.01981500000000125
[cRIO] 0.020117999999996528
[cRIO] 0.01991199999999793
[cRIO] 0.020054999999999268
[cRIO] 0.020019000000004894
[cRIO] 0.02013799999999577
[cRIO] 0.019870000000004495
[cRIO] 0.02012099999999606
[cRIO] 0.020061000000005436
[cRIO] 0.019942999999997824
[cRIO] 0.019940999999995768
[cRIO] 0.02003100000000302
[cRIO] 0.019827999999996848
[cRIO] 0.019962000000006697
[cRIO] 0.02714199999999778
[cRIO] 0.01292699999999769
[cRIO] 0.019863999999998327
[cRIO] 0.020138000000002876
[cRIO] 0.02063100000000162
[cRIO] 0.019636999999995908
[cRIO] 0.01994300000000493
[cRIO] 0.02027299999999599
[cRIO] 0.019710000000003447
[cRIO] 0.020027999999996382
[cRIO] 0.020064000000004967
[cRIO] 0.019843999999999085
[cRIO] 0.01997199999999566
[cRIO] 0.02011099999999999
[cRIO] 0.019913999999999987
[cRIO] 0.020194000000003598
[cRIO] 0.019945999999997355
[cRIO] 0.01988099999999804
[cRIO] 0.02000600000000219
[cRIO] 0.020093000000002803
[cRIO] 0.020111999999997465
[cRIO] 0.026910000000000878
[cRIO] 0.012717999999999563
[cRIO] 0.020026999999998907
[cRIO] 0.020040000000001612
[cRIO] 0.020037999999999556
[cRIO] 0.02022699999999844
[cRIO] 0.02054300000000353
[cRIO] 0.01946699999999879
[cRIO] 0.01999699999999649
[cRIO] 0.019892000000005794
[cRIO] 0.01996899999999613
[cRIO] 0.02007199999999898
[cRIO] 0.021723999999998966
[cRIO] 0.01812500000000483
[cRIO] 0.020227999999995916
[cRIO] 0.019947000000001935
[cRIO] 0.0199089999999984
[cRIO] 0.02003400000000255
[cRIO] 0.020015000000000782
[cRIO] 0.02004399999999862
[cRIO] 0.020769999999998845
[cRIO] 0.01921300000000059
[cRIO] 0.019786000000003412
[cRIO] 0.019997999999993965
[cRIO] 0.020124000000002695
[cRIO] 0.019961000000002116
[cRIO] 0.020072999999996455
[cRIO] 0.020029000000000963
[cRIO] 0.020017000000002838
[cRIO] 0.01980999999999966
[cRIO] 0.022269999999998902
[cRIO] 0.017738000000001364
[cRIO] 0.019945999999997355
[cRIO] 0.02023799999999909
[cRIO] 0.019825000000004422
[cRIO] 0.01999999999999602
[cRIO] 0.02022500000000349
[cRIO] 0.019962999999997066
[cRIO] 0.019761000000002582
[cRIO] 0.020324999999999704
[cRIO] 0.01984199999999703
[cRIO] 0.020082000000002154
[cRIO] 0.019743999999995765
[cRIO] 0.020238000000006195
[cRIO] 0.020014999999993677
[cRIO] 0.0198040000000006
[cRIO] 0.02026599999999945
[cRIO] 0.01972000000000662
[cRIO] 0.019998999999998546
[cRIO] 0.01994699999999483
[cRIO] 0.02109500000000253
[cRIO] 0.019206000000004053
[cRIO] 0.019966999999994073
[cRIO] 0.020003000000002658
[cRIO] 0.020752000000001658
[cRIO] 0.01915199999999828
[cRIO] 0.020476999999999634
[cRIO] 0.019496000000003733
[cRIO] 0.019954999999995948
[cRIO] 0.02003700000000208
[cRIO] 0.020058999999996274
[cRIO] 0.02009500000000486
[cRIO] 0.020039999999994507
[cRIO] 0.020006999999999664
[cRIO] 0.019711000000000922
[cRIO] 0.019989000000002477
[cRIO] 0.0201849999999979
[cRIO] 0.019786000000003412
[cRIO] 0.02016100000000165
[cRIO] 0.019966999999994073
[cRIO] 0.019948000000006516
[cRIO] 0.020086999999996635
[cRIO] 0.020040999999999087
[cRIO] 0.020315000000003636
[cRIO] 0.020910999999998126
[cRIO] 0.018869000000002245
[cRIO] 0.01991099999999335
[cRIO] 0.0198960000000028
[cRIO] 0.020060000000000855
[cRIO] 0.020119999999998583
[cRIO] 0.01984600000000114
[cRIO] 0.01997599999999977
[cRIO] 0.020156000000000063
[cRIO] 0.019992000000002008
[cRIO] 0.019875999999996452
[cRIO] 0.019952000000003522
[cRIO] 0.02003899999999703
[cRIO] 0.019950999999998942
[cRIO] 0.02415600000000495
[cRIO] 0.017558999999998548
[cRIO] 0.01820099999999769
[cRIO] 0.020138000000002876
[cRIO] 0.02014899999999642
[cRIO] 0.01997400000000482
[cRIO] 0.02056699999999978
[cRIO] 0.019649999999998613
[cRIO] 0.01983699999999544
[cRIO] 0.019916000000002043
[cRIO] 0.019925999999998112
[cRIO] 0.020104000000003452
[cRIO] 0.01996899999999613
[cRIO] 0.020089000000005797
[cRIO] 0.01988399999999757
[cRIO] 0.02015999999999707
[cRIO] 0.020121000000003164
[cRIO] 0.01988399999999757
[cRIO] 0.02070300000000458
[cRIO] 0.019280999999999437
[cRIO] 0.020150000000001
[cRIO] 0.0196550000000002
[cRIO] 0.020775000000000432
[cRIO] 0.019251999999994496
[cRIO] 0.02002600000000143
[cRIO] 0.019967000000001178
[cRIO] 0.020124000000002695
[cRIO] 0.019885999999999626
[cRIO] 0.02072099999999466
[cRIO] 0.01945100000000366
[cRIO] 0.01994499999999988
[cRIO] 0.02018600000000248
[cRIO] 0.019722999999999047
[cRIO] 0.02007499999999851
[cRIO] 0.02379799999999932
[cRIO] 0.016322999999999865
[cRIO] 0.019782999999996775
[cRIO] 0.02015100000000558
[cRIO] 0.020270999999993933
[cRIO] 0.019754000000006045
[cRIO] 0.019815999999998724
[cRIO] 0.020310999999999524
[cRIO] 0.01969700000000074
[cRIO] 0.020060000000000855
[cRIO] 0.01984799999999609
[cRIO] 0.02037299999999931
[cRIO] 0.019815999999998724
[cRIO] 0.01990700000000345
[cRIO] 0.020332000000003347
[cRIO] 0.01992499999999353
[cRIO] 0.02002400000000648
[cRIO] 0.020189999999999486
[cRIO] 0.019765999999997064
[cRIO] 0.0204039999999992
[cRIO] 0.019517999999997926
[cRIO] 0.019838000000000022
[cRIO] 0.020096000000002334
[cRIO] 0.01993500000000381
[cRIO] 0.01998299999999631
[cRIO] 0.020029000000000963
[cRIO] 0.019978000000001828
[cRIO] 0.020064999999995337
[cRIO] 0.019913999999999987
[cRIO] 0.020009999999999195
[cRIO] 0.0201720000000023
[cRIO] 0.019997000000003595
[cRIO] 0.022979999999996892
[cRIO] 0.016818000000000666
[cRIO] 0.020387999999996964
[cRIO] 0.01974100000000334
[cRIO] 0.02002199999999732
[cRIO] 0.020033000000005075
[cRIO] 0.01996399999999454
[cRIO] 0.020049000000000206
[cRIO] 0.019928000000000168
[cRIO] 0.02005900000000338
[cRIO] 0.0199439999999953
[cRIO] 0.019925000000000637
[cRIO] 0.02031700000000569
[cRIO] 0.0196899999999971
[cRIO] 0.020135000000003345
[cRIO] 0.020114999999996996
[cRIO] 0.019871999999999446
[cRIO] 0.020012999999998726
[cRIO] 0.019944000000002404
[cRIO] 0.02004699999999815
[cRIO] 0.020015999999998257
[cRIO] 0.019809000000002186
[cRIO] 0.020138000000002876
[cRIO] 0.021020999999997514
[cRIO] 0.019089000000001022
[cRIO] 0.020018000000000313
[cRIO] 0.020696000000000936
[cRIO] 0.019242999999995902
[cRIO] 0.01981500000000125
[cRIO] 0.020102000000001397
[cRIO] 0.01995600000000053
[cRIO] 0.020029000000000963
[cRIO] 0.020207999999996673
[cRIO] 0.019660000000001787
[cRIO] 0.020089999999996166
[cRIO] 0.020042000000003668
[cRIO] 0.019973999999997716
[cRIO] 0.020473000000002628
[cRIO] 0.019314000000001386
[cRIO] 0.020022999999994795
[cRIO] 0.022302000000003375
[cRIO] 0.017952000000001078
[cRIO] 0.0197819999999993
[cRIO] 0.020102000000001397
[cRIO] 0.019888999999999157
[cRIO] 0.020230999999995447
[cRIO] 0.019927000000002693
[cRIO] 0.019983000000003415
[cRIO] 0.020053999999994687
[cRIO] 0.019967000000001178
[cRIO] 0.020789000000000613
[cRIO] 0.019309999999997274
[cRIO] 0.020400000000002194
[cRIO] 0.01931199999999933
[cRIO] 0.020124000000002695
[cRIO] 0.020106999999995878
[cRIO] 0.01998100000000136
[cRIO] 0.019860999999998796
[cRIO] 0.020028000000003487
[cRIO] 0.020136999999998295
[cRIO] 0.020029999999998438
[cRIO] 0.01998200000000594
[cRIO] 0.01994999999999436
[cRIO] 0.02002600000000143
[cRIO] 0.020383000000002482
[cRIO] 0.022705000000001974
[cRIO] 0.017861999999993827
[cRIO] 0.0212670000000017
[cRIO] 0.017876000000001113
[cRIO] 0.0199089999999984
[cRIO] 0.018914999999999793
[cRIO] 0.020319000000000642
[cRIO] 0.02000900000000172
[cRIO] 0.019713000000002978
[cRIO] 0.020324999999999704
[cRIO] 0.019955999999993423
[cRIO] 0.021434000000006392
[cRIO] 0.018278999999999712
[cRIO] 0.019920999999996525
[cRIO] 0.020091000000000747
[cRIO] 0.020014000000003307
[cRIO] 0.02043099999999498
[cRIO] 0.020060000000000855
[cRIO] 0.020884000000002345
[cRIO] 0.01870699999999914
[cRIO] 0.020175999999999306
[cRIO] 0.021906000000001313
[cRIO] 0.018057999999996355
[cRIO] 0.01976499999999959
[cRIO] 0.02005900000000338
[cRIO] 0.02006399999999786
[cRIO] 0.019984999999998365
[cRIO] 0.020016000000005363
[cRIO] 0.019852000000000203
[cRIO] 0.01999699999999649
[cRIO] 0.020014000000003307
[cRIO] 0.02085999999999899
[cRIO] 0.019115999999996802
[cRIO] 0.01998100000000136
[cRIO] 0.02034799999999848
[cRIO] 0.019743000000005395
[cRIO] 0.019969999999993604
[cRIO] 0.020834000000000685
[cRIO] 0.019154000000000337
[cRIO] 0.020351000000005115
[cRIO] 0.019782999999996775
[cRIO] 0.019863999999998327
[cRIO] 0.01995900000000006
[cRIO] 0.020419000000003962
[cRIO] 0.01973499999999717
[cRIO] 0.020254999999998802
[cRIO] 0.020149000000003525
[cRIO] 0.01984799999999609
[cRIO] 0.019854999999999734
[cRIO] 0.019978000000001828
[cRIO] 0.020330999999998767
[cRIO] 0.019764000000002113
[cRIO] 0.019944000000002404
[cRIO] 0.020730999999997834
[cRIO] 0.019033999999997775
[cRIO] 0.020793000000004724
[cRIO] 0.019093999999995503
[cRIO] 0.020068000000001973
[cRIO] 0.01989300000000327
[cRIO] 0.020155999999992957
[cRIO] 0.01997400000000482
[cRIO] 0.020041999999996563
[cRIO] 0.020545000000005587
[cRIO] 0.02011299999999494
[cRIO] 0.019421000000001243
[cRIO] 0.019908000000000925
[cRIO] 0.02002199999999732
[cRIO] 0.01991999999999905
[cRIO] 0.020029000000000963
[cRIO] 0.019992999999999483
[cRIO] 0.020448000000001798
[cRIO] 0.01956700000000211
[cRIO] 0.020226000000000965
[cRIO] 0.020052999999997212
[cRIO] 0.019679000000003555
[cRIO] 0.020129999999994652
[cRIO] 0.020181000000000893
[cRIO] 0.01988099999999804
[cRIO] 0.019881000000005145
[cRIO] 0.020089999999996166
[cRIO] 0.020166000000003237
[cRIO] 0.019773999999998182
[cRIO] 0.020504999999999995
[cRIO] 0.019983000000003415
[cRIO] 0.02005699999999422
[cRIO] 0.019624000000000308
[cRIO] 0.020502000000000464
[cRIO] 0.020051999999999737
[cRIO] 0.019203000000004522
[cRIO] 0.02033000000000129
[cRIO] 0.01980599999999555
[cRIO] 0.022809999999999775
[cRIO] 0.017161000000001536
[cRIO] 0.019911000000000456
[cRIO] 0.020144999999999413
[cRIO] 0.02002199999999732
[cRIO] 0.01988200000000262
[cRIO] 0.020184000000000424
[cRIO] 0.019803000000003124
[cRIO] 0.020103999999996347
[cRIO] 0.019919000000001574
[cRIO] 0.020341999999999416
[cRIO] 0.019807999999997605
[cRIO] 0.01982100000000031
[cRIO] 0.02013900000000035
[cRIO] 0.02006200000000291
[cRIO] 0.020164999999998656
[cRIO] 0.019975000000002296
[cRIO] 0.019897000000000276
[cRIO] 0.020015999999998257
[cRIO] 0.020395000000000607
[cRIO] 0.019925999999998112
[cRIO] 0.019846999999998616
[cRIO] 0.019803000000003124
[cRIO] 0.019911000000000456
[cRIO] 0.020461999999994873
[cRIO] 0.019856000000004315
[cRIO] 0.01998899999999537
[cRIO] 0.019852000000000203
[cRIO] 0.019776000000000238
[cRIO] 0.020119000000001108
[cRIO] 0.02020300000000219
[cRIO] 0.019680999999998505
How does your test differ?
Reply With Quote
  #3   Spotlight this post!  
Unread 31-01-2014, 22:26
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,098
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Thread scheduler for PID period control ?

Quote:
Originally Posted by Joe Ross View Post
I just ran the following code:

Code:
    double prevTime = 0;
    public void teleopPeriodic() {
        double time = Timer.getFPGATimestamp();
        System.out.println(time-prevTime);
        prevTime=time;
    }
And got the following output...
I took the liberty of plotting it. Attached.


Attached Thumbnails
Click image for larger version

Name:	TeleOp jitter.png
Views:	39
Size:	16.9 KB
ID:	16040  Click image for larger version

Name:	TeleOp jitter2.png
Views:	33
Size:	14.4 KB
ID:	16041  

Last edited by Ether : 31-01-2014 at 22:36. Reason: added 2nd graph
Reply With Quote
  #4   Spotlight this post!  
Unread 01-02-2014, 08:33
gpetilli gpetilli is offline
Registered User
FRC #1559
 
Join Date: Jan 2009
Location: Victor, NY
Posts: 285
gpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to all
Re: Thread scheduler for PID period control ?

That is what I expected, which is why I was confused. I should get the 4 slot cRIO today and will retry. I know the older 8 slot was slower, but it seems strange that they would change the driver station behavior to update less often.
Reply With Quote
  #5   Spotlight this post!  
Unread 01-02-2014, 10:35
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,576
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Thread scheduler for PID period control ?

Quote:
Originally Posted by gpetilli View Post
That is what I expected, which is why I was confused. I should get the 4 slot cRIO today and will retry. I know the older 8 slot was slower, but it seems strange that they would change the driver station behavior to update less often.
My test was run on an 8-slot. The 8-slot has less ram, but the same processor. In this test, it is not slower.
Reply With Quote
  #6   Spotlight this post!  
Unread 01-02-2014, 20:00
gpetilli gpetilli is offline
Registered User
FRC #1559
 
Join Date: Jan 2009
Location: Victor, NY
Posts: 285
gpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to all
Re: Thread scheduler for PID period control ?

Quote:
Originally Posted by Joe Ross View Post
My test was run on an 8-slot. The 8-slot has less ram, but the same processor. In this test, it is not slower.
Thanks for the feedback, i will have them re-run the test. BTW: what period do you use for your PID loops?
Reply With Quote
  #7   Spotlight this post!  
Unread 01-02-2014, 20:05
gpetilli gpetilli is offline
Registered User
FRC #1559
 
Join Date: Jan 2009
Location: Victor, NY
Posts: 285
gpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to all
Re: Thread scheduler for PID period control ?

Quote:
Originally Posted by Joe Ross View Post
I just ran the following code:

Code:
    double prevTime = 0;
    public void teleopPeriodic() {
        double time = Timer.getFPGATimestamp();
        System.out.println(time-prevTime);
        prevTime=time;
    }

How does your test differ?
The major difference is we are reading an I2C 9DOF IMU model GY85. Works great, but maybe the I2C is slowing things down. I did a quick estimate and thought the time would be about 1 to 2ms, but maybe there is more overhead than I guessed.

I guess we just need to try the measurements again.
Reply With Quote
  #8   Spotlight this post!  
Unread 02-02-2014, 10:42
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Thread scheduler for PID period control ?

Just to reiterate. The 8-slot has less RAM and is a model variation of the same FreeScale processor, meaning it has a less cache. For most situations, it is the same speed.

Greg McKaskle
Reply With Quote
  #9   Spotlight this post!  
Unread 02-02-2014, 16:48
wireties's Avatar
wireties wireties is offline
Principal Engineer
AKA: Keith Buchanan
FRC #1296 (Full Metal Jackets)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2004
Location: Rockwall, TX
Posts: 1,170
wireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond repute
Send a message via AIM to wireties
Re: Thread scheduler for PID period control ?

When you create a task and put it in a loop with a delay, the delay is subject to the resolution of the system clock (which is 10ms). So a request to delay for 20ms would have considerable variation. The system is waiting for two clock ticks which could happen in a little over 10ms or a little under 30ms.

The PID class does not use delays, instead it uses the timer OS libraries (last I looked). These fire in the context of the tick timer interrupt routine and are more periodic. The first PID timer callback may run at a variable time after enabling but it will run very periodically afterwards. Does that make sense?

The operating system does have a higher resolution timer (the auxiliary timer) for custom purposes. It is not used by the base OS. And perhaps NI built a service on top of the the auxiliary timer. Plus there is normally a third timer only used for timestamps. But the base timers work as described above.

The periodicity of the messages from the DS is dependent on many things. Ethernet is not strictly deterministic. The teleop loops start after a semaphore is given once the code on the cRIO processes an incoming message and the data is available.

HTH
__________________
Fast, cheap or working - pick any two!

Last edited by wireties : 02-02-2014 at 16:53.
Reply With Quote
  #10   Spotlight this post!  
Unread 02-02-2014, 16:54
Joe Johnson's Avatar Unsung FIRST Hero
Joe Johnson Joe Johnson is offline
Engineer at Medrobotics
AKA: Dr. Joe
FRC #0088 (TJ2)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1996
Location: Raynham, MA
Posts: 2,648
Joe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond repute
Re: Thread scheduler for PID period control ?

I am not sure why but the autogenerated code from RobotBuilder does not include the feed forward gain, Kf, and the loop period, so they default to 0 and 50ms.

Here is a code snippet:
public Launch() {
super("Launch", Kp, Ki, Kd, Kf, 0.01);

Note that we had 0.005 as the period at first and it was acting squirrely. I think we were having the PID loop take too much of the CPU time. When we backed off to 10ms, life was good.

YMMV.

Joe J.
__________________
Joseph M. Johnson, Ph.D., P.E.
Mentor
Team #88, TJ2
Reply With Quote
  #11   Spotlight this post!  
Unread 08-02-2014, 10:34
tinybob20 tinybob20 is offline
Registered User
AKA: Jeremy
FRC #1559 (DevilTech)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Victor
Posts: 18
tinybob20 is an unknown quantity at this point
Re: Thread scheduler for PID period control ?

Hi,

we tried using the getFPGATimestamp() instead of the basic .get(), and we were able to get values around 11 - 16 ms for our timed PID loop with the scheduler set to 10ms.

in teleopPeriodic we got values around 21 - 23 ms.
Reply With Quote
  #12   Spotlight this post!  
Unread 10-02-2014, 08:29
gpetilli gpetilli is offline
Registered User
FRC #1559
 
Join Date: Jan 2009
Location: Victor, NY
Posts: 285
gpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to all
Re: Thread scheduler for PID period control ?

Quote:
Originally Posted by Joe Ross View Post
I just ran the following code:

Code:
    double prevTime = 0;
    public void teleopPeriodic() {
        double time = Timer.getFPGATimestamp();
        System.out.println(time-prevTime);
        prevTime=time;
    }

How does your test differ?
Joe,

Post #16 above is from the student we had redo the test. The differences between our original test and this one are switching from an OS timer to the FPGA timer like your code and the new test has the full PID drive code. The ~50ms DS measurement that originally had me questioning what was going on is now ~20ms as expected.
The timed loop measurement is also faster (11->16ms instead of >20ms) , but not the 10ms that we asked for. At this point we intend to set the timed PID loop to 15ms instead of 10ms to hopefully stay within the computation limit of the cRIO. Thanks for your help and example code for more accurate measurements.
Reply With Quote
  #13   Spotlight this post!  
Unread 14-02-2014, 09:31
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Thread scheduler for PID period control ?

The timer doesn't control the rate of the loop. It merely measures the time from one execution to the next. If you have code within teleop that takes more than 20ms to run, you will skip DS updates. I see this quite often on team DS logs, even teams from Einstein. It would be odd that the periodic is not a multiple of 20ms. And unless the network and/or DS are stressed out, I'd expect jitter numbers like Joe showed above.

I'm not sure how Java PID does its scheduling, and when teams spawn another thread and set its rate, I'm not sure what they are using to schedule.

Team 358's article is about timing using LabVIEW. LabVIEW has two different schedulers. One has ms level resolution and is used for general VI execution. It uses a pool of threads at various priorities, and the LV wait and wait ms functions and a plain while loop will operate in this scheduler. The TimedLoop uses its own scheduler that runs at an elevated priority and has advanced scheduling options -- quite advanced. It can schedule at sub millisecond periods and implements a variety of policies. Only Timed structure code runs in this scheduler.

The timed loop is also instrumented so that it is easy to determine start and stop times, missed deadlines, adjust priorities and other things. I'd highly recommend that you instrument your PID not only to measure its actual period, but also its execution time. You could also do this with a profiler if you have one. This will let you know the cost of the operation you are scheduling.

Greg McKaskle
Reply With Quote
  #14   Spotlight this post!  
Unread 14-02-2014, 11:02
gpetilli gpetilli is offline
Registered User
FRC #1559
 
Join Date: Jan 2009
Location: Victor, NY
Posts: 285
gpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to all
Re: Thread scheduler for PID period control ?

Quote:
Originally Posted by Greg McKaskle View Post
The timer doesn't control the rate of the loop. It merely measures the time from one execution to the next. If you have code within teleop that takes more than 20ms to run, you will skip DS updates. I see this quite often on team DS logs, even teams from Einstein. It would be odd that the periodic is not a multiple of 20ms. And unless the network and/or DS are stressed out, I'd expect jitter numbers like Joe showed above.

I'm not sure how Java PID does its scheduling, and when teams spawn another thread and set its rate, I'm not sure what they are using to schedule.

Team 358's article is about timing using LabVIEW. LabVIEW has two different schedulers. One has ms level resolution and is used for general VI execution. It uses a pool of threads at various priorities, and the LV wait and wait ms functions and a plain while loop will operate in this scheduler. The TimedLoop uses its own scheduler that runs at an elevated priority and has advanced scheduling options -- quite advanced. It can schedule at sub millisecond periods and implements a variety of policies. Only Timed structure code runs in this scheduler.

The timed loop is also instrumented so that it is easy to determine start and stop times, missed deadlines, adjust priorities and other things. I'd highly recommend that you instrument your PID not only to measure its actual period, but also its execution time. You could also do this with a profiler if you have one. This will let you know the cost of the operation you are scheduling.

Greg McKaskle
Yes, we understand that the timer is a free-running stop watch that we are using to instrument our loops. This is why in the OP we were concerned that the teleopPeriodic was reporting 50ms on a program that did nothing but report the time while running tethered. Switching to the FPGA timer now correctly reports a 20ms teleopPeriodic rate.

What we are trying to do is create another thread outside of teleopPeriodic for doing the PID calculations at a faster, more consistent rate. We believe we have accomplished this in JAVA. We were hoping to achieve a 10ms period but appear to be processor limited to 15ms. This seems like a long time given other teams are talking about 5ms loops (not sure if they measured actual loop times). We do have some calculations in our loop, but I would not have expected it to limit the period by so much. We are looking into the bottleneck but time on the robot is limited with bag & tag in a few days. Worst case, the performance with 15ms seems fine for competition.
Reply With Quote
  #15   Spotlight this post!  
Unread 14-02-2014, 11:40
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,098
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Thread scheduler for PID period control ?

Quote:
Originally Posted by gpetilli View Post
What we are trying to do is create another thread outside of teleopPeriodic for doing the PID calculations at a faster, more consistent rate.
Just a heads-up in case you have not yet seen this post:

http://www.chiefdelphi.com/forums/sh....php?p=1342439

Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 05:28.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi