Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Throttle Trouble (http://www.chiefdelphi.com/forums/showthread.php?t=142792)

simon1636 01-29-2016 07:21 PM

Throttle Trouble
 
Hi! I am trying to get our shooter to work with two talons by moving the throttle on the Attack 3 joystick upwards. My code looks right, but is not doing anything. Can any of you guys see anything? Any help would be greatly appreciated! Thanks! :)

Code:

/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008. All Rights Reserved.                            */
/* Open Source Software - may be modified and shared by FRC teams. The code  */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project.                                                              */
/*----------------------------------------------------------------------------*/

package edu.wpi.first.wpilibj.templates;



import edu.wpi.first.wpilibj.Jaguar;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.SimpleRobot;

/**
 * The VM is configured to automatically run this class, and to call the
 * functions corresponding to each mode, as described in the SimpleRobot
 * documentation. If you change the name of this class or the package after
 * creating this project, you must also update the manifest file in the resource
 * directory.
 */
public class RobotTemplate extends SimpleRobot {
    /**
    * This function is called once each time the robot enters autonomous mode.
    */
   
    Jaguar lTalon,rTalon;
    Joystick throttle;
    RobotDrive driveTrain;
   
   
   
   
    public void autonomous() {
       
    }

    /**
    * This function is called once each time the robot enters operator control.
    */
   
    public void robotInit(){
        lTalon=new Jaguar(1);
        rTalon=new Jaguar(2);
       
        throttle=new Joystick(0);
       
        driveTrain=new RobotDrive(lTalon,rTalon);
    }
    public void operatorControl() {
   
        while(isOperatorControl() &&isEnabled()){
         
            driveTrain.arcadeDrive(throttle.getAxis(Joystick.AxisType.kZ), 0);
           
               
           
       
   
           
           
        }
               
         
        }

    }
   
    /**
    * This function is called once each time the robot enters test mode.
    */


TimTheGreat 01-29-2016 08:17 PM

Re: Throttle Trouble
 
Quote:

Originally Posted by simon1636 (Post 1532191)
Hi! I am trying to get our shooter to work with two talons by moving the throttle on the Attack 3 joystick upwards. My code looks right, but is not doing anything. Can any of you guys see anything? Any help would be greatly appreciated! Thanks! :)

Code:

        driveTrain=new RobotDrive(lTalon,rTalon);
        driveTrain.arcadeDrive(throttle.getAxis(Joystick.AxisType.kZ), 0);


Are you trying to use the driveTrain on a shooter mechanism? If so, probably not the best way to do it.

Try using throttle.getZ().

Also, since you have a simple robot you should use

Code:

#In the operatorControl method
lTalon.set(throttle.getZ())
rTalon.set(-throttle.getZ())


simon1636 01-30-2016 05:59 PM

Re: Throttle Trouble
 
It still does not seem to be working. Do you see anything else weird? I did all that you said.

Code:

/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008. All Rights Reserved.                            */
/* Open Source Software - may be modified and shared by FRC teams. The code  */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project.                                                              */
/*----------------------------------------------------------------------------*/

package edu.wpi.first.wpilibj.templates;



import edu.wpi.first.wpilibj.Jaguar;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.SimpleRobot;

/**
 * The VM is configured to automatically run this class, and to call the
 * functions corresponding to each mode, as described in the SimpleRobot
 * documentation. If you change the name of this class or the package after
 * creating this project, you must also update the manifest file in the resource
 * directory.
 */
public class RobotTemplate extends SimpleRobot {
    /**
    * This function is called once each time the robot enters autonomous mode.
    */
   
    Jaguar lTalon,rTalon;
    Joystick throttle;
   
   
   
   
    public void autonomous() {
       
    }

    /**
    * This function is called once each time the robot enters operator control.
    */
   
    public void robotInit(){
        lTalon=new Jaguar(1);
        rTalon=new Jaguar(2);
       
        throttle=new Joystick(0);
       
    }
    public void operatorControl() {
   
        while(isOperatorControl() &&isEnabled()){
          lTalon.set(throttle.getZ());
          rTalon.set(-throttle.getZ());
           
               
           
       
   
           
           
        }
               
         
        }

    }
   
    /**
    * This function is called once each time the robot enters test mode.
    */


mmaunu 02-01-2016 02:47 AM

Re: Throttle Trouble
 
Your class needs to extend SampleRobot, not SimpleRobot. I'm surprised that even compiles as SimpleRobot is not part of the Java API anymore. Give that a try?


All times are GMT -5. The time now is 08:27 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi