View Single Post
  #2   Spotlight this post!  
Unread 27-09-2012, 22:22
F22Rapture's Avatar
F22Rapture F22Rapture is offline
College Student, Mentor
AKA: Daniel A
FRC #3737 (4H Rotoraptors)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Goldsboro, NC
Posts: 476
F22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant future
Re: Autonomous timeout

Our (error-free) code looks like this --

Code:
public class TurnLeft extends CommandBase {
    
    private double m_timeout;
    private double m_speed;
    
    public TurnLeft(double speed, double timeout) {
        m_timeout = timeout;
        m_speed = speed;
        // Use requires() here to declare subsystem dependencies
        // eg. requires(chassis);
        requires(drivetrain);
    }
Do you have any other code? Because I'm assuming you want to do the same thing that our code does, that is, turn left for the period of time put inside the parentheses when you call the command. To do that you need to make "timeout" a parameter in the TurnLeft method by using putting "double timeout" inside the parentheses. You also want to make m_timeout a variable inside the class, so make sure to put "private double m_timeout;" somewhere.

If you want you can just copy/paste my code in (remove the "speed" stuff) and see if it works.
__________________
Research is what I’m doing when I don’t know what I’m doing.
- Wernher von Braun
Attending: Raleigh NC Regional

Last edited by F22Rapture : 27-09-2012 at 22:25.
Reply With Quote