Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   HELP!! Our Robot Is Not Driving (http://www.chiefdelphi.com/forums/showthread.php?t=125159)

Astrophysicist 24-01-2014 12:35

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
        */
    }
   
}


Joe Ross 24-01-2014 12:50

Re: HELP!! Our Robot Is Not Driving
 
The flashing lights on the Victors mean they aren't getting a PWM signal. Here are some of the most common causes:

Is there communication with the Driver Station?
Did you enable the robot in Teleop mode on the Driver Station?
Are all three power LEDs on the Digital Sidecar brightly lit?
Are the PWM cables fully seated in the Victors? It can be very hard to get them correctly seated. Have several people try several times.

Quote:

theRobot.ArcadeDrive(moveValue,rotateValue); //rodbo0t drivinDm
Is this the exact code you ran? This line won't compile because the ArcadeDrive method doesn't exist in RobotDrive. The correct method is arcadeDrive (lower case a).

Quote:

"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 .
This is a known issue with older JREs, they detect the netmask improperly. If the code successfully downloaded to the robot, you can ignore that message.


All times are GMT -5. The time now is 02:35.

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