|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||||
|
|||||
|
Re: Robot Scan Time
What language are you using? In LabVIEW you can set custom loop times, and in Java/C++ the loop interval for the scheduler is defaulted to 20ms (noted here: https://wpilib.screenstepslive.com/s...d-programming).
|
|
#2
|
|||
|
|||
|
Re: Robot Scan Time
Note that he is referring to code written in Periodic Tasks, code written in Teleop will be executed only when a packet from the driver station is received.
|
|
#3
|
|||
|
|||
|
Re: Robot Scan Time
We are using java to program our robot and we would like to know the scan time if the scan time were ever to fluctuate.
|
|
#4
|
|||||
|
|||||
|
Re: Robot Scan Time
It shouldn't fluctuate unless you start dropping packets and experience sporadic ping timings. What are you going to use this information for?
|
|
#5
|
|||
|
|||
|
Re: Robot Scan Time
We want to have acceleration for our drive train.
My idea was to increase the speed of a motor at a constant rate multiplied by the scan time of the robot. Code:
if(maxSpeed > currentSpeed)
{
currentSpeed += ACCELERATION * SCANTIME;
}
|
|
#6
|
||||
|
||||
|
Re: Robot Scan Time
The time elapsed is going to be approximately 20ms, but it will fluctuate depending on network latencies.
Just perform the calculation each time through the loop. Code:
currentTime = Timer.getFPGATimestamp(); //time in seconds elapsedTime = currentTime - lastTime; //do your math lastTime = currentTime; Last edited by otherguy : 19-01-2016 at 19:31. |
|
#7
|
|||
|
|||
|
Re: Robot Scan Time
Thank you all for your help!
-3098 |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|