Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   FRC Control System (http://www.chiefdelphi.com/forums/forumdisplay.php?f=176)
-   -   Only port 1 working on RoboRio (http://www.chiefdelphi.com/forums/showthread.php?t=134360)

mistersands 11-02-2015 15:13

Only ports 0 and 1 working on RoboRio
 
This is our current code:

Code:

package org.usfirst.frc.team4528.robot;


import edu.wpi.first.wpilibj.Joystick;

import edu.wpi.first.wpilibj.RobotDrive;

import edu.wpi.first.wpilibj.SampleRobot;

import edu.wpi.first.wpilibj.Victor;

import edu.wpi.first.wpilibj.Timer;

public class Robot15 extends SampleRobot {

                        Victor frontLeft;
               
                        Victor rearLeft;

                        Victor frontRight;

                        Victor rearRight;

                        Victor motor;        //add-on
               
                        RobotDrive myRobot;        // class that handles basic drive operations
           
                        XBoxJoystick gamepad;        // declare gamepad as a Joystick object to get Joystick functionality, but with different buttons

                public void Robot()
                {
                   
                        frontLeft = new Victor(1);        //change port to appropriate PWM port on roboRIO
                   
                        rearLeft = new Victor(2);        //change port to appropriate PWM port on roboRIO
                   
                        frontRight = new Victor(3);        //change port to appropriate PWM port on roboRIO
                   
                        rearRight = new Victor(4);        //change port to appropriate PWM port on roboRIO

                        motor = new Victor(5);                //add-on
               
                        myRobot = new RobotDrive(frontLeft, rearLeft, frontRight, rearRight);        // robot drivetrain functionality; takes in front left motor, rear left motor, front right motor, rear right motor ports
               
                        gamepad = new XBoxJoystick(0);        // port gamepad is plugged into

                    }

                //add-on
           

                public void runMotor()
           
                {

                        if(gamepad.getLeftZ() > 0)

                        {

                                motor.set(gamepad.getLeftZ());

                        }

                        else if(gamepad.getRightZ() > 0)

                        {

                                motor.set(-gamepad.getRightZ());

                        }

                        else

                        {

                                motor.set(0.0);

                        }
           
                }

        //end of...
           

        /**
           
        * Runs the motors with tank steering.
           
        */
           
                public void operatorControl()
                {

                        myRobot.setSafetyEnabled(false);
               
                        while (isOperatorControl() && isEnabled())
                        {
                       
                                myRobot.tankDrive(gamepad.getRightY(), gamepad.getLeftY());
                   
                                Timer.delay(0.005);                // wait for a motor update time
                               
                   
                                runMotor();
                   
               
                        }
           
                }


}

No matter what victor we connect to the RoboRIO in port 1, it works. None of the other ports work. The victors blink even when robot is enabled.

Any Victor we put in port 0 or 1 will turn solid when enabled, but any other will not. The PWM cable is not the issue either. We replaced the battery in case it was low voltage.

This code was working 5 days ago. Now it is not. We've re-imaged the RoboRio and uploaded the code again. Still same issue.

We don't even call port 0 in our code but it runs the victor connected to port 1.

Alan Anderson 11-02-2015 17:20

Re: Only ports 0 and 1 working on RoboRio
 
Quote:

Originally Posted by mistersands (Post 1441962)
Any Victor we put in port 0 or 1 will turn solid when enabled, but any other will not. The PWM cable is not the issue either.

I don't see anything wrong with the code.

It is unfortunately easy to get the PWM connection not-quite-right on a Victor. Find someone with lots of practice and have him or her verify that the cables are correctly plugged in. And make doubly sure at both ends that the connectors are not plugged in backwards.

mistersands 11-02-2015 17:29

Re: Only ports 0 and 1 working on RoboRio
 
Quote:

Originally Posted by Alan Anderson (Post 1442044)
I don't see anything wrong with the code.

It is unfortunately easy to get the PWM connection not-quite-right on a Victor. Find someone with lots of practice and have him or her verify that the cables are correctly plugged in. And make doubly sure at both ends that the connectors are not plugged in backwards.

We've done that. If I take the PWM out of port 1 and put it in port 2, it doesn't work. If I take the PWM out of victor 1 and put it into victor 2, it doesn't work. Any cable I swap into port 1 will work, and I can swap it among every victor and see each victor turn to solid light in turn.

But the big thing is, our code doesn't initialize PWM port 0. But everything I just said for Port 1 is also true for port 0. So I'm at a complete loss.

GeeTwo 11-02-2015 17:32

Re: Only port 1 working on RoboRio
 
An easy way to see if the PWM port is actually generating signals is to connect a servo to it. The servo will change angle when you change the applied "speed". At full forward or full reverse, servos may end up jamming against their stops and making a ticking sound. Don't do that for an extended time.

Alan Anderson 11-02-2015 19:57

Re: Only ports 0 and 1 working on RoboRio
 
Quote:

Originally Posted by Alan Anderson (Post 1442044)
I don't see anything wrong with the code...

...except for the mismatch between the class named Robot15 and the constructor Robot(). That might be a problem.

Jared 11-02-2015 21:42

Re: Only ports 0 and 1 working on RoboRio
 
Quote:

Originally Posted by Alan Anderson (Post 1442134)
...except for the mismatch between the class named Robot15 and the constructor Robot(). That might be a problem.

and void before Robot() shouldn't be there.

Don't change the name of the main class!

mistersands 12-02-2015 08:28

Re: Only port 1 working on RoboRio
 
Thanks! We completely reinstalled Java and Eclipse on the Classmate and then implemented the changes mentioned and it seems to be working.

Thanks so much for the help!


All times are GMT -5. The time now is 19:05.

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