Go to Post I hope FIRST hurries up and releases the regional schedule soon. I have a vacation schedule to plan. - Koko Ed [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-02-2012, 13:38
kingkurry kingkurry is offline
Registered User
FRC #4067
 
Join Date: Jan 2012
Location: Maryland
Posts: 20
kingkurry is an unknown quantity at this point
Spike Relay code failing

We are using a spike relay to control a spinbrush in the front of the robot to sweep in balls. I created a new spike relay object and used the left trigger to get it to move. However, every time I hit the trigger, the ENTIRE robot jerks forward and then becomes unresponsive until I disable and renable teleop. And when i say jerk froward, I mean that the CIM motos, which are connected to our 4 jaguars, move and the spin brush moves too, albeit for a short period of time. Is there some issue in the code that could cause this to happen?


Code:
package edu.wpi.first.wpilibj.templates;


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

public class Test extends IterativeRobot {
    Joystick leftStick;
    Joystick rightStick;
    RobotDrive robot; 
    Relay spike;
    double leftValue, rightValue;
    
    public void robotInit() {
        leftStick = new Joystick(1);
        rightStick = new Joystick(2);
        
        robot = new RobotDrive(1,2,3,4);
        
        spike = new Relay(5);
       
    }

    public void disabledPeriodic(){
       
    }
    public void autonomousPeriodic() {
      
    }


    public void teleopPeriodic() {
        //robot.setSafetyEnabled(false);
        
        
        robot.tankDrive(leftStick.getY(),rightStick.getY());  

        //robot.tankDrive(leftValue, rightValue);
        
        
        //spike.set(Relay.Value.kForward);
        
        if(leftStick.getRawButton(1)){
            spike.set(Relay.Value.kForward);
        }
    
}
Also, I am plugging in the relay to the relay port of the sidecar. We are just using 5 here because we tried switching between different relay port numbers.
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 11:06.

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