Go to Post In the professional world, spelling mistakes, grammatical shortcuts, leet-speek, and misused verbiage are not interpreted as signs of cute, efficient communications. They are indicators of illiteracy, inefficiency, unprofessional behavior, and sloppy work habits. - dlavery [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 03-12-2015, 18:51
simon1636 simon1636 is offline
Registered User
FRC #4501
 
Join Date: Dec 2015
Location: California
Posts: 9
simon1636 is an unknown quantity at this point
Spike Code Problems

Hi! My robotics class is using cRIO FRC 2014 on Netbeans with Java. The code we are using does not seem to work. We are coding a Spike relay as a kind of intake system, yet each time we upload it to try and control it, nothing happens! If any of you could take a look at the code to see if you notice any problems that would be great! Thanks!

Code:
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.GenericHID;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.Relay;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.Talon;
import edu.wpi.first.wpilibj.Timer;


public class RobotTemplate extends SimpleRobot {
    RobotDrive myDrive;
    Joystick moveStick, rotateStick;
    Talon backRight, backLeft, frontRight, frontLeft;
    Relay relay;

    public void robotInit(){
                frontLeft = new Talon(1);
                backLeft = new Talon(2);
                backRight = new Talon(3);
                frontRight = new Talon(4);
                
                relay=new Relay(1);
                    
                        
       
		
                //myDrive = new RobotDrive(frontLeft, backLeft, frontRight, backRight);
                myDrive = new RobotDrive(backLeft, backRight, frontLeft, frontRight);
		
                moveStick = new Joystick(2);
		rotateStick = new Joystick(1);
          
       
        
              
        
        
    }
    /**
     * This function is called once each time the robot enters autonomous mode.
     */
   

    /**
     * This function is called once each time the robot enters operator control.
     */
    public void operatorControl() {
   //   
        //while(true &&isOperatorControl() &&isEnabled()){
        //myDrive.setInvertedMotor(RobotDrive.MotorType.kRearRight, true);
        //myDrive.setInvertedMotor(RobotDrive.MotorType.kRearLeft, true);
        
        
        while (isOperatorControl() && isEnabled()) {
      
            myDrive.mecanumDrive_Cartesian(moveStick.getY(), rotateStick.getX(), moveStick.getX(), 0);
           
            
            }
        
        if (rotateStick.getTrigger(GenericHID.Hand.kLeft)&& isEnabled()){
            relay.set(Relay.Value.kOff);
            relay.setDirection(Relay.Direction.kForward);
        }
         
                    //mecanumDrive_Polar(moveStick.getY(), moveStick.getX(), rotateStick.getX());
           Timer.delay(0.1);
        }

    }
    
    /**
     * This function is called once each time the robot enters test mode.
     */
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 08:43.

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