Go to Post There is no MILSPEC standard for pool noodles. - Rick TYler [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 19-09-2013, 11:14
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,561
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: First Year Java Autonomous Help

When you set up a project in Java, you choose what base class to use, Simple Robot or Iterative Robot (or command, which is based on iterative). There are descriptions of each here: http://wpilib.screenstepslive.com/s/...g-a-base-class

In LabVIEW, autonomous is called at the start of autonomous and stopped at the end of autonomous. You can put delays in autonomous in LabVIEW. Teleop, on the other hand, is called every 20ms. You can't put any delays in teleop or you will shut down communication.

In Java (and C++), Simple Robot behaves like LabVIEW's autonomous, for both teleop and autonomous. Iterative Robot behaves like LabVIEW's teleop, for both teleop and autonomous.

If you are using iterative robot, you can't use the long delay or cgmv123's while loop. Instead use an if statement that checks the time and either turns on or off the motor and doesn't do anything that takes a long time.

If you are using the command templates, it's very easy to make a command that sets a timeout in init, runs the motor and checks the time in execute, and stops the motor in finish.



Another possible problem is the motor safety. By default, robotDrive needs to be called every 0.1 seconds or else it will shut off the motor. This is important because if your code crashes, it makes sure the robot stops, rather then keep running the last speed. In your code, robotDrive wouldn't get called for the length of your delay. cgmv123's code works around this by calling very often in the while loop.
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 09:08.

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