View Single Post
  #1   Spotlight this post!  
Unread 24-01-2014, 12:35
Astrophysicist Astrophysicist is offline
Registered User
FRC #4777
 
Join Date: Jan 2014
Location: Mississauga,Ontario
Posts: 1
Astrophysicist is an unknown quantity at this point
Exclamation HELP!! Our Robot Is Not Driving

Hello,

We have been trying to get our robot to drive in Java, which successfully worked before on our last robot but now for some reason does not work. On our driverstation all of the LEDs (robot code, communication, joystick) are green but when we deploy the code, nothing happens. Everything on our sidecar is green except for the Victors which are flashing orange. We double-checked the PWM ports and they are plugged in properly. Yesterday we FTP'd our code to the CRIO and it pinged so we knew it was communicating, but we are still getting the problem, "Host may nnot be on same subnet as robot. IP address: 10.47.77.9 , subnet: 255.255.255.254." still presists. We checked our network and the subnet should be 255.255.255.0 .

HELP!!!

This is our code
Code:
package edu.wpi.first.wpilibj.templates;

import edu.wpi.first.wpilibj.IterativeRobot;

import edu.wpi.first.wpilibj.Compressor;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.Relay;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.Solenoid;
import edu.wpi.first.wpilibj.Victor;

public class RobotTemplate extends IterativeRobot {
    
    //Joystick
    int joystickPort = 1;
    
    //RobotDrive
    int leftMotorChannel = 2;
    int rightMotorChannel = 1;
   
    //Compressor
    int pressureSwitchChannel = 2; //5
    //The GPIO channel that the pressure switch is attached to.
    int compressorRelayChannel = 1;
    //The relay channel that the compressor relay is attached to.
    
    //Relay
    int relayModuleNumber = 1;
    int relayChannelNumber = 2;//2 
    
    //Victor Motors
    int victorOneChannel = 3;
    int victorTwoChannel = 4;
    
    //Object declarations
    RobotDrive theRobot = new RobotDrive(leftMotorChannel, rightMotorChannel);
    Joystick driveStick = new Joystick(joystickPort);
    //Make sure electrical team moves the compressor to relay 1 and the spike to relay 2. 
    Compressor mainCompressor = new Compressor(pressureSwitchChannel, compressorRelayChannel);
    //Relay spike = new Relay(relayModuleNumber, relayChannelNumber);
    Victor wheelOne = new Victor(victorOneChannel);
    Victor wheelTwo = new Victor(victorTwoChannel);
    
    //if relay doesn't work - use this:
    Solenoid pistonExtract = new Solenoid (1);
    Solenoid pistonRetract = new Solenoid (2);

    public void robotInit() {
    mainCompressor.start();
    }
    
    public void disabledInit() {
    
        //mainCompressor.start();
    }
    
    public void autonomousPeriodic() {
        // will fill later
        //mainCompressor.start();
      //  Timer.delay(2.0);
      
    }

    public void teleopPeriodic() {
        
        //variables expected to update periodically
        double moveValueX = driveStick.getAxis(Joystick.AxisType.kY);
        double rotateValue = driveStick.getAxis(Joystick.AxisType.kX);
        
        theRobot.ArcadeDrive(moveValue,rotateValue); //rodbo0t drivinDm 
        
        double speed = 1.0; //adjustment back of joystick

        if (driveStick.getTrigger()) { //shooter wheels
            mainCompressor.start();
            wheelOne.set(speed);
            wheelTwo.set(speed);
        }else{
            wheelOne.set(0.0);
            wheelTwo.set(0.0);
        }
        if (driveStick.getRawButton(4)) {
            mainCompressor.start();
            
        }

      /*  if (driveStick.getRawButton(3)) { top-middle button
            spike.setDirection(Relay.Direction.kForward);
        } else if (driveStick.getRawButton(4)) {
            spike.setDirection(Relay.Direction.kReverse);
        }else{
            spike.set(Relay.Value.kOff);
        }*/ 
        
        
        /*Either will work. It will depend on what the electrical team hooks it 
        up to. The solenoid module can work with either 12v or 24v solenoids, 
        while a spike relay will only work with 12v solenoids. 
        */
        
        
        if (driveStick.getRawButton(5)) {
            pistonExtract.set(true);
            pistonRetract.set(false);
        }else if (driveStick.getRawButton(6)) {
            pistonRetract.set(false);
            pistonExtract.set(true);
        }else{
            pistonExtract.set(false);
            pistonExtract.set(false);
        }
        
    }
    
    public void testPeriodic() {
        /*
        relay.set(Relay.Value.kForward); //Power flows Positive to Negative, light green
        relay.set(Relay.Value.kOff); //No power flows, light orange
        relay.set(Relay.Value.kReverse); //Power flows Negative to Positive, light red
        */
    }
    
}