Go to Post Building a drone during Ri3D is going to be a challenge... - Ginger Power [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 13-03-2015, 14:36
SirGibbs SirGibbs is offline
Registered User
FRC #5676 (Hornets)
Team Role: Programmer
 
Join Date: Feb 2015
Rookie Year: 2015
Location: USA
Posts: 11
SirGibbs is an unknown quantity at this point
arcade drive

Hey guys I am from team 5676 and we have a little or big problem with our arcade drive and the java program. We are using talon motor controllers with the kop andymark motors and pneumatic's. But we don't get it running. The robot is just turning around the y and at the x axes at option 1 but the pneumatic's are working. At option 2 is it not driving and the pneumatic's aren't working also but I thought that it would be he exact copy of the example but the code is getting permanently deployed at the roborio. Because an other problem is that at option 1 is the code stopping and getting periodically erased from the roborio at around 1;50 until I restart it. My first thought was that it's maybe running out of ram but that doesn't seem to be the problem.
Every help or input would be highly appreciated. I thank all of you in advance for your time and help.

option 1:
Code:
package org.usfirst.frc.team5676.robot;

import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.DoubleSolenoid;
import edu.wpi.first.wpilibj.RobotDrive; 



public class Robot extends IterativeRobot {
    RobotDrive myRobot;
    Joystick stick;
    DoubleSolenoid Piston;
    
    public void robotInit() {
    	myRobot = new RobotDrive (0, 1, 2, 3);
    	stick = new Joystick(0);
    			
    }
    
    
    public void autonomousPeriodic() {

    }

  public void teleopPeriodic() {
        	
	  myRobot.arcadeDrive(stick);
          
    	Piston = new DoubleSolenoid (0,1);
    	   		
    	   		if(stick.getRawButton(5)) {
    	   			
    	   			Piston.set(DoubleSolenoid.Value.kForward);	
    	   		
    	   			System.out.println("'A' button is pressed: Piston moves forward");
    	   		}
    	   	  else if(stick.getRawButton(6))
    	   		{
    	   			Piston.set(DoubleSolenoid.Value.kReverse); 
    	   	
    	   			System.out.println("'B' button is pressed: Piston moves backward");
    	   		}
    	   		else
    	   		{
    	   			Piston.set(DoubleSolenoid.Value.kOff);		
    	   		}
    	   	
    
    	
    Piston = new DoubleSolenoid(2,3 );
		
		if(stick.getRawButton(3)) {
			
			Piston.set(DoubleSolenoid.Value.kForward);	
		
			System.out.println("'A' button is pressed: Piston moves forward");
		}
	  else if(stick.getRawButton(4))
		{
			Piston.set(DoubleSolenoid.Value.kReverse); 
	
			System.out.println("'B' button is pressed: Piston moves backward");
		}
		else
		{
			Piston.set(DoubleSolenoid.Value.kOff);		
		}
 
    	
 
Piston = new DoubleSolenoid(4,5 );
	
	if(stick.getRawButton(1)) {
		
		Piston.set(DoubleSolenoid.Value.kForward);	
	
		System.out.println("'A' button is pressed: Piston moves forward");
	}
 else if(stick.getRawButton(2))
	{
		Piston.set(DoubleSolenoid.Value.kReverse); 

		System.out.println("'B' button is pressed: Piston moves backward");
	}
	else
	{
		Piston.set(DoubleSolenoid.Value.kOff); }
	
	}

    /**
     * This function is called periodically during test mode
     */

    public void testPeriodic() {
    
    }
    
}


option 2:

Code:
package org.usfirst.frc.team5676.robot;

import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.DoubleSolenoid;
import edu.wpi.first.wpilibj.RobotDrive; 
import edu.wpi.first.wpilibj.Timer;


public class Robot extends IterativeRobot {
    RobotDrive myRobot;
    Joystick stick;
    DoubleSolenoid Piston;
    
    public void robotInit() {
    	myRobot = new RobotDrive (0, 1, 2, 3);
    	stick = new Joystick(0);
    			
    }
    
    
    public void autonomousPeriodic() {

    }

  public void teleopPeriodic() {
        	
	  while (isOperatorControl() && isEnabled()) {
        	myRobot.arcadeDrive(stick);
            Timer.delay(0.01);		
        }
	  
    	Piston = new DoubleSolenoid (0,1);
    	   		
    	   		if(stick.getRawButton(5)) {
    	   			
    	   			Piston.set(DoubleSolenoid.Value.kForward);	
    	   		
    	   			System.out.println("'A' button is pressed: Piston moves forward");
    	   		}
    	   	  else if(stick.getRawButton(6))
    	   		{
    	   			Piston.set(DoubleSolenoid.Value.kReverse); 
    	   	
    	   			System.out.println("'B' button is pressed: Piston moves backward");
    	   		}
    	   		else
    	   		{
    	   			Piston.set(DoubleSolenoid.Value.kOff);		
    	   		}
    	   	
    
    	
    Piston = new DoubleSolenoid(2,3 );
		
		if(stick.getRawButton(3)) {
			
			Piston.set(DoubleSolenoid.Value.kForward);	
		
			System.out.println("'A' button is pressed: Piston moves forward");
		}
	  else if(stick.getRawButton(4))
		{
			Piston.set(DoubleSolenoid.Value.kReverse); 
	
			System.out.println("'B' button is pressed: Piston moves backward");
		}
		else
		{
			Piston.set(DoubleSolenoid.Value.kOff);		
		}
 
    	
 
Piston = new DoubleSolenoid(4,5 );
	
	if(stick.getRawButton(1)) {
		
		Piston.set(DoubleSolenoid.Value.kForward);	
	
		System.out.println("'A' button is pressed: Piston moves forward");
	}
 else if(stick.getRawButton(2))
	{
		Piston.set(DoubleSolenoid.Value.kReverse); 

		System.out.println("'B' button is pressed: Piston moves backward");
	}
	else
	{
		Piston.set(DoubleSolenoid.Value.kOff); }
	
	}

    /**
     * This function is called periodically during test mode
     */

    public void testPeriodic() {
    
    }
    
}

Last edited by SirGibbs : 13-03-2015 at 14:39.
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 12:03.

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