View Single Post
  #1   Spotlight this post!  
Unread 04-02-2014, 21:19
LFRobotics's Avatar
LFRobotics LFRobotics is offline
Registered User
FRC #4623
 
Join Date: Jan 2014
Location: Little Falls, MN
Posts: 95
LFRobotics is on a distinguished road
How to Make the Robot Drive Forward in Autonomous

This may seem like a simple question but I can't get it to work. I am using commandbase java.

I have a chassis subsystem here:

Code:
package edu.wpi.first.LFRobot2014.subsystems;

import edu.wpi.first.LFRobot2014.RobotMap;
import edu.wpi.first.LFRobot2014.commands.DriveTele;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.command.Subsystem;

/**
 *
 * @author Developer
 */
public class Chassis extends Subsystem {
    // Put methods for controlling this subsystem
    // here. Call these from Commands.
    RobotDrive drive;

    public void initDefaultCommand() {
        // Set the default command for a subsystem here.
        setDefaultCommand(new DriveTele());
    }
    
    public Chassis(){
        drive = new RobotDrive(RobotMap.leftMotorPort, RobotMap.rightMotorPort);
        drive.setSafetyEnabled(false);
    }
    
    public void driveTele(Joystick leftStick, Joystick rightStick){
       drive.tankDrive(leftStick, rightStick);
    }
    
    public void setSpeed(double speed){
        drive.setMaxOutput(speed);
    }

    
}
Do I use this same subsystem(which is the one that I base my TankDrive off of) to write a command that will run the motors for a certain time or do I write up a new subsystem? And what do I have to do code-wise to make this work?

THANKS!
Reply With Quote