Go to Post Looks like a perfect device for scaring the cats :D - Dan Petrovic [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-16-2016, 12:06 PM
CyberTeam5713 CyberTeam5713 is offline
Registered User
FRC #5713
 
Join Date: Feb 2016
Location: Michigan
Posts: 25
CyberTeam5713 is an unknown quantity at this point
How do i make my robot drive without the robot drive class

So far this is what i got.

public class Robot extends IterativeRobot {

Joystick mXboxController;
Joystick controlStick;
Talon frontLeft,frontRight, rearLeft, rearRight;

public void robotInit() { // this code will be ran each time we power on the robot

mXboxController = new Joystick(0); // depends on the usb connected to computer
controlStick = new Joystick(1);
frontLeft = new Talon(3);
frontRight = new Talon(2);
rearLeft = new Talon(0);
rearRight = new Talon(1);
}


public void autonomousInit() { // triggers when we enter autonomous

frontLeft.enableDeadbandElimination(false);
frontLeft.set(-1.0);// dont forget to change speed to an int value -1.0 is full reverse and +1.0 is full forward also for foward on the y value -1 this may vary REMEBER!!!
rearLeft.enableDeadbandElimination(false);
rearLeft.set(+1.0);
frontRight.enableDeadbandElimination(false);
frontRight.set(-1.0);
rearRight.enableDeadbandElimination(false);
rearRight.set(+1.0);

}


public void autonomousPeriodic() { // this code runs periodically in autonomous
while (isAutonomous() && isEnabled()) {

}
}




public void teleopInit(){ // This triggers every time we enter telop mode.

mXboxController = new Joystick(0); // the number within the parathesis depends on the controllers usb order always check
controlStick = new Joystick(1);
frontLeft = new Talon(3);
frontRight = new Talon(2);
rearLeft = new Talon(0);
rearRight = new Talon(1);
}




public void teleopPeriodic() {
while (isOperatorControl() && isEnabled()) {

if(mXboxController.getRawButton(8)){
frontRight.set(-1.0);


} else if(mXboxController.getRawButton(7)){
frontLeft.set(-1.0);
}

if(mXboxController.getRawButton(5)){
rearLeft.set(0.1);
} else if(mXboxController.getRawButton(6)){
rearRight.set(0.1);
}

Timer.delay(0.01); } }
Reply With Quote
  #2   Spotlight this post!  
Unread 02-16-2016, 01:01 PM
Beeker's Avatar
Beeker Beeker is offline
Registered User
AKA: Joe
FRC #4377 (BC. Blaze)
Team Role: Mentor
 
Join Date: Jan 2015
Rookie Year: 2015
Location: Michigan
Posts: 7
Beeker is an unknown quantity at this point
Re: How do i make my robot drive without the robot drive class

public void teleopPeriodic() {
while (isOperatorControl() && isEnabled()) {

// tank drive xbox controller no robotdrive class
frontRight.set(mXboxController.getRawAxis(5);
rearRight.set(mXboxController.getRawAxis(5);
frontLeft.set(mXboxController.getRawAxis(2);
rearLeft.set(mXboxController.getRawAxis(2);

Timer.delay(0.01);
}
}
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:05 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