![]() |
Autonomous Time Delay
Ok so im trying to figure out how to get an autonomous for work. I tried to get the robot to drive forward with the code below:
drive.tankDrive(1.0,1.0); Time.delay(3); drive.tankDrive(0.0,0.0); When i run the autonomous the robot just jerks forwards quickly and sometimes it won't even give a response. I tried changing the number in the time delay but it made no difference. Any ideas? |
Re: Autonomous Time Delay
What code is in the Time.delay function? Through my quick 10 second look, there is no Time.delay() function is Java...
Could it be doing time in milliseconds? |
Re: Autonomous Time Delay
It might be due to a motor safety if you are using one and it hasn't been Disabled.
That will shutdown the motors during time delays longer than about .1 seconds. |
Re: Autonomous Time Delay
Time.delay(3) should be Timer.delay(3.0)
|
Re: Autonomous Time Delay
I'd recommend using a CommandGroup and using its timeout function.
Let's say you have a command for AutoDriving called AutoDrive that takes parameters for left and right speeds. In the CommandGroup, you'd write something like this: PHP Code:
|
Re: Autonomous Time Delay
You can also use Wait(). For example, Wait(2.0) to wait 2 seconds. Like Mark said, you need to disable safety, or the motors wont run.
myRobot.SetSafetyEnabled(false); |
Re: Autonomous Time Delay
Thanks disabling safety fixed it :D
|
| All times are GMT -5. The time now is 08:02 AM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi