Go to Post you know your team has respect from teachers when classes start waving projects during build season saying you get full credit if the robot ships. - Peck [more]
Home
Go Back   Chief Delphi > Technical > Control System > FRC Control System
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 11-02-2015, 15:13
mistersands mistersands is offline
Registered User
FRC #4528 (Automatons)
Team Role: Coach
 
Join Date: Aug 2013
Rookie Year: 2013
Location: NYC
Posts: 26
mistersands has a spectacular aura aboutmistersands has a spectacular aura aboutmistersands has a spectacular aura about
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.

Last edited by mistersands : 11-02-2015 at 16:07.
Reply With Quote
  #2   Spotlight this post!  
Unread 11-02-2015, 17:20
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Only ports 0 and 1 working on RoboRio

Quote:
Originally Posted by mistersands View Post
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.
Reply With Quote
  #3   Spotlight this post!  
Unread 11-02-2015, 17:29
mistersands mistersands is offline
Registered User
FRC #4528 (Automatons)
Team Role: Coach
 
Join Date: Aug 2013
Rookie Year: 2013
Location: NYC
Posts: 26
mistersands has a spectacular aura aboutmistersands has a spectacular aura aboutmistersands has a spectacular aura about
Re: Only ports 0 and 1 working on RoboRio

Quote:
Originally Posted by Alan Anderson View Post
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.
Reply With Quote
  #4   Spotlight this post!  
Unread 11-02-2015, 17:32
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,564
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
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.
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.
Reply With Quote
  #5   Spotlight this post!  
Unread 11-02-2015, 19:57
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Only ports 0 and 1 working on RoboRio

Quote:
Originally Posted by Alan Anderson View Post
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.
Reply With Quote
  #6   Spotlight this post!  
Unread 11-02-2015, 21:42
Jared's Avatar
Jared Jared is offline
Registered User
no team
Team Role: Programmer
 
Join Date: Aug 2013
Rookie Year: 2012
Location: Connecticut
Posts: 602
Jared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond repute
Re: Only ports 0 and 1 working on RoboRio

Quote:
Originally Posted by Alan Anderson View Post
...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!
Reply With Quote
  #7   Spotlight this post!  
Unread 12-02-2015, 08:28
mistersands mistersands is offline
Registered User
FRC #4528 (Automatons)
Team Role: Coach
 
Join Date: Aug 2013
Rookie Year: 2013
Location: NYC
Posts: 26
mistersands has a spectacular aura aboutmistersands has a spectacular aura aboutmistersands has a spectacular aura about
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!
Reply With Quote
Reply


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 19:05.

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