Go to Post Inspire others first, win second. - Alpha Beta [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 13-02-2014, 11:09
fovea1959's Avatar
fovea1959 fovea1959 is offline
Herder of programmers
AKA: Doug Wegscheid
FRC #3620 (The Average Joes)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2011
Location: St Joseph
Posts: 336
fovea1959 will become famous soon enough
More resolution than 20ms

We need to watch a sensor, then cut a motor off 100ms later.

Right now we are watching the sensor, waiting for it to trip, set t0, and then watching the elapsed time (System.currentTimeMillis() - t0), and returning true from isFinished() when the elapsed time > 100ms (not doing this all at once, it happens over successive calls to isFinish(), as it should be). All as advertised, dead-simple, and worked the first time...

Doing this in isFinished() *is* introducing wobble in the 100ms: because we only get the CPU every 20ms, we could be as little as 0.00000001ms or much as 19.9999999999ms late in seeing the sensor go, and would could be as little as 0.00000001ms or as much as 19.9999999999ms late in seeing the time elapse. We can adjust for consistent delay, but the +/- 19.9999999999ms overall is something I'd like to tighten up.

I know the PID code starts it's own thread, so we can use that as a model if we want to have a separate (tighter) thread handle this.

Has anyone else done this simpler-than-PID case already? I'm willing to work from scratch using the PID code as a base, but am resistant to reinventing wheels...

Also, do we have access to any interrupt and timer capability on the FPGA from Java that would be helpful here?

Last edited by fovea1959 : 13-02-2014 at 11:28.
Reply With Quote
 


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 18:11.

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