|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
TeleopPeriodic doesn't seem to iterate fast enough to smoothly run motors
Once we finished wiring our robot, we decided to quickly throw together a program which would allow us to test all of our motors. It was simply an iterative robot which instantiated motors controllers like
Code:
Victor motor = new Victor(0); Code:
void teleopPeriodic() {
motor.set(.5);
}
Code:
void teleropPeriodic() {
while(true) {
motor.set(.5)
}
}
Last edited by Tominator368 : 17-02-2016 at 08:23. Reason: Spacing |
|
#2
|
|||
|
|||
|
Re: TeleopPeriodic doesn't seem to iterate fast enough to smoothly run motors
Quote:
Have you looked at the DS charts tab while this was happening or the DS log after? |
|
#3
|
||||
|
||||
|
Re: TeleopPeriodic doesn't seem to iterate fast enough to smoothly run motors
Your analysis of the cause of the problem is incorrect. Motors will continue to go at the rate that they were previously assigned. If you were to place that motor set out of the while true loop, the motor should behave (rather it be jittery or smooth)
Speaking remotely, there are a few probable causes for what you are experiencing. Since your code runs multiple motors in the first scenario, is it possible a typo caused you to set the same motor twice with two different values? Is there nothing else being done to the motors in that scenario? Are your communications totally perfect with 2-10ms ping and no packet loss? You could just be blocking the code that checks for proper router communication in the while true loop |
|
#4
|
|||
|
|||
|
Re: TeleopPeriodic doesn't seem to iterate fast enough to smoothly run motors
Quote:
Quote:
Quote:
|
|
#5
|
||||
|
||||
|
Re: TeleopPeriodic doesn't seem to iterate fast enough to smoothly run motors
It would be interesting if you calculated the average/min/max delay time between calls to teleopPeriodic.
Incidentally, the possible inconsistency of packet arrival times is why I tend to use SampleRobot instead of IterativeRobot. |
|
#6
|
|||||
|
|||||
|
Re: TeleopPeriodic doesn't seem to iterate fast enough to smoothly run motors
Quote:
The motor will however stop if there is a motor safety engaged. The motor safety times out if the motor isn't continuously set, because it assumes the code is locked up after ~.1 second or whatever time you set the motor exception to, and cuts off the PWM to prevent a runaway motor. If your code disabled the motor safety then the motor would suddenly burst back to life at whatever speed was set however long ago. The motor safety is optional, but is probably engaged by default. Last edited by Mark McLeod : 17-02-2016 at 12:22. |
|
#7
|
|||
|
|||
|
Re: TeleopPeriodic doesn't seem to iterate fast enough to smoothly run motors
Quote:
In all 3 languages, MotorSafety is on by default for RobotDrive and off by default for everything else. |
|
#8
|
|||||
|
|||||
|
Re: TeleopPeriodic doesn't seem to iterate fast enough to smoothly run motors
Yep, because the safety turning the motor off was the last setting the motor saw.
|
|
#9
|
|||
|
|||
|
Re: TeleopPeriodic doesn't seem to iterate fast enough to smoothly run motors
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|