Go to Post "You fogot the gears!!!!" - The_Gman [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 29-01-2016, 19:21
simon1636 simon1636 is offline
Registered User
FRC #4501
 
Join Date: Dec 2015
Location: California
Posts: 9
simon1636 is an unknown quantity at this point
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.
     */
Reply With Quote
  #2   Spotlight this post!  
Unread 29-01-2016, 20:17
TimTheGreat's Avatar
TimTheGreat TimTheGreat is offline
ArchdukeTim
FRC #1418 (Vae Victis)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2011
Location: Falls Church
Posts: 236
TimTheGreat has a spectacular aura aboutTimTheGreat has a spectacular aura aboutTimTheGreat has a spectacular aura about
Re: Throttle Trouble

Quote:
Originally Posted by simon1636 View Post
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())
__________________
There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.



2012 - Gracious Professionalism - Greater DC
2014 - Regional Finalist - Virginia | Industrial Design - Virginia | Regional Finalist - Greater DC
2015 - Innovation in Control - Greater DC
2016 - District Event Winner - VAHAY | Innovation in Control - VAHAY | District Event Winner - MDBET | Industrial Design - MDBET | District Champion - CHCMP | Innovation in Control - CHCMP
Reply With Quote
  #3   Spotlight this post!  
Unread 30-01-2016, 17:59
simon1636 simon1636 is offline
Registered User
FRC #4501
 
Join Date: Dec 2015
Location: California
Posts: 9
simon1636 is an unknown quantity at this point
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.
     */
Reply With Quote
  #4   Spotlight this post!  
Unread 01-02-2016, 02:47
mmaunu's Avatar
mmaunu mmaunu is offline
Registered User
FRC #2485 (W.A.R. Lords)
Team Role: Mentor
 
Join Date: Mar 2013
Rookie Year: 2010
Location: San Diego, CA
Posts: 89
mmaunu is a jewel in the roughmmaunu is a jewel in the roughmmaunu is a jewel in the roughmmaunu is a jewel in the rough
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?
__________________
2014 Las Vegas (Winners with 987, 2478; Excellence in Engineering)
2014 San Diego (Finalists with 987, 3250; Quality Award)
2013 Inland Empire (Winners with 1538, 968; Excellence in Engineering Award)
2013 San Diego (Finalists with 2984, 4322; Creativity Award)
2012 Las Vegas (Finalists with 2034, 3187; Quality Award)
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 12:35.

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