Go to Post It is often less about what you say, and more about how you say it. - IKE [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 24-01-2015, 16:02
Shaffer Shaffer is offline
Registered User
FRC #4610
 
Join Date: Jan 2015
Location: Bastrop, TX
Posts: 3
Shaffer is an unknown quantity at this point
Robot won't drive. Help with "command based" programming

Here's our code, including our subsystem (cassie), our command (dothedrive), and our Robot file. It just won't drive no matter what we do. We have one joystick and mecanum drive.

public class cassie extends Subsystem
{

public SpeedController leftfront = RobotMap.cassieleftfront;
public SpeedController rightfront = RobotMap.cassierightfront;
public SpeedController leftrear = RobotMap.cassieleftrear;
public SpeedController rightrear = RobotMap.cassierightrear;
public RobotDrive wholecassie = RobotMap.cassiewholecassie;


public void initDefaultCommand()
{

}

public void takeJoyStickInput(Joystick joy1)
{
wholecassie.mecanumDrive_Cartesian(joy1.getRawAxis (1), joy1.getRawAxis(2), joy1.getRawAxis(0),0);

}

public void stop()
{
wholecassie.mecanumDrive_Cartesian(0, 0, 0,0);
}

}


public class dothedrive extends Command
{

public dothedrive()
{

requires(Robot.cassie);
}


protected void initialize()
{
}

protected void execute()
{
Robot.cassie.takeJoyStickInput(Robot.oi.getSidewin der());
}


protected boolean isFinished()
{
return false;
}

protected void end()
{
Robot.cassie.stop();

}


protected void interrupted()
{
}
}



public class Robot extends IterativeRobot
{

Command autonomousCommand;

public static OI oi;

public static cassie cassie;
public static lift lift;
public static grip grip;
public static vision vision;

public void robotInit()
{
RobotMap.init();

cassie = new cassie();
lift = new lift();
grip = new grip();
vision = new vision();


oi = new OI();
autonomousCommand = new AutonomousCommand();
}

public void disabledInit()
{
}

public void disabledPeriodic()
{
Scheduler.getInstance().run();
}

public void autonomousInit()
{
if (autonomousCommand != null) autonomousCommand.start();
}

public void autonomousPeriodic()
{
Scheduler.getInstance().run();
}

public void teleopInit() {

if (autonomousCommand != null) autonomousCommand.cancel();

}

public void teleopPeriodic()
{
Scheduler.getInstance().run();
wholecassie.dothedrive(); //this is the line that I'm confused on

}

public void testPeriodic()
{
LiveWindow.run();
}
Reply With Quote
 


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 10:17.

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