Go to Post "A robot can always be fixed but a match can never be replayed." - Brian C [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

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 02-17-2016, 09:30 PM
abilash123 abilash123 is offline
Registered User
FRC #2198
 
Join Date: Jan 2016
Location: Canada
Posts: 6
abilash123 is an unknown quantity at this point
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?
Reply With Quote
  #2   Spotlight this post!  
Unread 02-17-2016, 10:42 PM
em202020 em202020 is offline
Driver. Vroom.
FRC #0294
Team Role: Driver
 
Join Date: Feb 2016
Rookie Year: 2016
Location: Los Angeles
Posts: 3
em202020 is just really niceem202020 is just really niceem202020 is just really niceem202020 is just really niceem202020 is just really nice
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?
Reply With Quote
  #3   Spotlight this post!  
Unread 02-17-2016, 10:52 PM
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,697
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
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.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
Reply With Quote
  #4   Spotlight this post!  
Unread 02-17-2016, 11:44 PM
cgmv123's Avatar
cgmv123 cgmv123 is offline
FRC RI/FLL Field Manager
AKA: Max Vrany
FRC #1306 (BadgerBOTS)
Team Role: College Student
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Madison, WI
Posts: 2,069
cgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond repute
Re: Autonomous Time Delay

Time.delay(3) should be Timer.delay(3.0)
__________________
BadgerBOTS Robotics|@team1306|Facebook: BadgerBOTS
2016 FIRST Championship Tesla Division | 2016 Wisconsin Regional Engineering Inspiration Award

2015 FIRST Championship Carson Division | 2015 Wisconsin Regional Chairman's Award

2013 FIRST Championship Curie Division | 2013 Wisconsin Regional Chairman's Award

2012 FIRST Championship Archimedes Division | 2012 Wisconsin Regional Engineering Inspiration Award, Woodie Flowers Finalist Award (Lead Mentor Ben Senson)

Reply With Quote
  #5   Spotlight this post!  
Unread 02-18-2016, 11:44 AM
Yaseen Yaseen is offline
Registered User
FRC #0069 (HYPER)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2014
Location: New England
Posts: 3
Yaseen is an unknown quantity at this point
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:
addSequential(new AutoDrive(1.0,1.0), 3.0); 
Reply With Quote
  #6   Spotlight this post!  
Unread 02-18-2016, 03:52 PM
SuperBK's Avatar
SuperBK SuperBK is offline
Registered User
AKA: BrianK
FRC #1225 (Amperage Robotics)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2006
Location: Henersonville, NC
Posts: 357
SuperBK is just really niceSuperBK is just really niceSuperBK is just really niceSuperBK is just really nice
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);
__________________
Brian K
Team 1225 Robotics Mentor
Reply With Quote
  #7   Spotlight this post!  
Unread 02-18-2016, 09:47 PM
abilash123 abilash123 is offline
Registered User
FRC #2198
 
Join Date: Jan 2016
Location: Canada
Posts: 6
abilash123 is an unknown quantity at this point
Re: Autonomous Time Delay

Thanks disabling safety fixed it
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 08:04 AM.

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