View Single Post
  #1   Spotlight this post!  
Unread 22-02-2011, 20:21
Bethie42's Avatar
Bethie42 Bethie42 is offline
Registered User
AKA: Bethany Carlson
FRC #0956 (Eagle Cybertechnology)
Team Role: Alumni
 
Join Date: Dec 2009
Rookie Year: 2008
Location: Oregon
Posts: 126
Bethie42 is a splendid one to beholdBethie42 is a splendid one to beholdBethie42 is a splendid one to beholdBethie42 is a splendid one to beholdBethie42 is a splendid one to beholdBethie42 is a splendid one to beholdBethie42 is a splendid one to beholdBethie42 is a splendid one to behold
Limit switches in autonomous

Our limit switches [to regulate Jaguar-implemented 'elevator' for arm] are working fine in teleop but not in autonomous. I've tried putting a print to driver station in the limit-switch statement in autonomous, and it never prints:

Code:
// test if limit switch works: it doesn't. 
	  
	  if (topElevatorLimitSwitch->Get() == false){
	  elevatorJaguar->Set(0.0);
	 driverStationLCD->Printf(DriverStationLCD::kUser_Line5, 1, "Elevator stopped"); 
	driverStationLCD->UpdateLCD();
}
	else {
	     elevatorJaguar->Set(1.0); // Run elevator up
	    driverStationLCD->Printf(DriverStationLCD::kUser_Line5, 1, "Elevator up"); 
	    driverStationLCD->UpdateLCD();
					}
I tried running just that bit during autonomous, and it never runs: the motor does nothing, the lights indicate it's not running, and the driver station never displays either printf.

Here's the full autonomous code:


Code:
LencVal = lEncoder->Get();
		RencVal = rEncoder->Get();
		
		//it turns out, the input must be less than ~21 characters.  Anything longer won't be displayed
		driverStationLCD->Printf(DriverStationLCD::kUser_Line4, 1, "Lenc cnt:%d         ", LencVal); 
		driverStationLCD->Printf(DriverStationLCD::kUser_Line5, 1, "Renc cnt:%d         ", RencVal); 
		driverStationLCD->UpdateLCD();
				

		//compressor control
		int compressorValue = pneumaticLimitSwitch->Get();
		if (compressorValue == 1) {
			compressorRelay->Set(Relay::kOff);  // If relay is true (120 PSI) turn off compressor
		}
		else {
			compressorRelay->Set(Relay::kOn);
		}
		
		leftValue = lLineTracker->Get();	// read the line tracking sensors
		middleValue = mLineTracker->Get();
		rightValue = rLineTracker->Get();

if ( (LencVal < 7300 )){  // overshoots: goal encoder count is 7390
			
			robotDrive->TankDrive(-0.25, 0.25);
			driverStationLCD->Printf(DriverStationLCD::kUser_Line2, 1, "Still driving"); 
			driverStationLCD->UpdateLCD();
			if (topElevatorLimitSwitch->Get() == false){
				elevatorJaguar->Set(0.0);
				driverStationLCD->Printf(DriverStationLCD::kUser_Line5, 1, "Elevator stopped"); 
				driverStationLCD->UpdateLCD();
			}
			else {
				elevatorJaguar->Set(1.0); // Run elevator up
				driverStationLCD->Printf(DriverStationLCD::kUser_Line5, 1, "Elevator up"); 
				driverStationLCD->UpdateLCD();
			}
						

		
		
			
		}
		
		else {
			robotDrive->TankDrive(0.0, 0.0);
			elevatorJaguar->Set(0.0);
			gripperSol->Set(true); // If we're at the T, let's score
			driverStationLCD->Printf(DriverStationLCD::kUser_Line2, 1, "At T"); 
			driverStationLCD->UpdateLCD();
			
		}
The Jaguar happily obeys the commands to stop when the encoder value is reached.

Teleop limit switch stuff works perfectly.

Code:
//compressor control
		int compressorValue = pneumaticLimitSwitch->Get();
		if (compressorValue == 1) {
			compressorRelay->Set(Relay::kOff);  // If relay is true (120 PSI) turn off compressor
		}
		else {
			compressorRelay->Set(Relay::kOn);
		}
			
		
		
		// move the elevator up, as long as the limit switch hasn't been pressed
		if ((elevatorJS->GetY() < 0.0) && (topElevatorLimitSwitch->Get() == true)) { // false means pressed...
			elevatorJaguar->Set(elevatorJS->GetY()); 
		}
		
		// move the elevator down, as long as the limit switch hasn't been pressed
		else if (elevatorJS->GetY() > 0.0 && bottomElevatorLimitSwitch->Get() == true){
			elevatorJaguar->Set(elevatorJS->GetY());
		}
		
		// in all other cases, turn motor off
		else {
			elevatorJaguar->Set(0.0);
		}
		
	
		// y = x linear relationship
		//robotDrive->TankDrive(rJS->GetY(),-lJS->GetY()); // inverted with - to circumvent non-con wiring
		

		// Joystick sensitivity adjustment: y = .6x^3 + .4x, leftJS negative (see above)
		//driverStationLCD->Printf(DriverStationLCD::kUser_Line2, 1, "L:%f         ", lJS->GetY()); 
		//driverStationLCD->Printf(DriverStationLCD::kUser_Line3, 1, "R:%f         ", rJS->GetY()); 
		//driverStationLCD->UpdateLCD();
				
		robotDrive->TankDrive(((.6*(rJS->GetY())*(rJS->GetY())*(rJS->GetY())) + (.4*(rJS->GetY()))), -((.6*(lJS->GetY())*(lJS->GetY())*(lJS->GetY())) + (.4*(lJS->GetY()))));
			
		//motor for elevator : this works, after the the Great Jaguar Fiasco of 02-18
		//elevatorJaguar->Set(elevatorJS->GetY());  // Assigns elevatorJS to control Jag
				
		
		
		//solenoid control
		
		
	    //Raise and lower arm
		if(driverStation->GetDigitalIn(2) == true) {
			elbowSol->Set(true);     // raise and lower 'elbow'
			//driverStationLCD->Printf(DriverStationLCD::kUser_Line4, 1, "Elbow sol raised"); 
			//driverStationLCD->UpdateLCD();
		}
		else {
			elbowSol->Set(false);
		}
		
		// Open and close gripper
		if(driverStation->GetDigitalIn(3) == true) {
			gripperSol->Set(true);    
			//driverStationLCD->Printf(DriverStationLCD::kUser_Line5, 1, "Gripper sol closed"); 
			//driverStationLCD->UpdateLCD();
		}
		else {
			gripperSol->Set(false);
		}  
		
		// Release pneumatic latch to deploy minibot
		if (driverStation->GetDigitalIn(4) == true){
			deploymentSol->Set(true);
			//driverStationLCD->Printf(DriverStationLCD::kUser_Line6, 1, "Deployment latch triggered"); 
			//driverStationLCD->UpdateLCD();
		}
		else {
			deploymentSol->Set(false);
		}
	
       
  	
		       	
		    	// appears to work [02-19 jaguar problem] copied from 02-17 code	       	
		       if (elevatorJS->GetRawButton(3)== true && outDeploymentLimitSwitch->Get() == true){
		       		deploymentJaguar->Set(1.0);  // Run motor out/forward
		       			 } 
		       			       			
		       else if (elevatorJS->GetRawButton(2)== true && inDeploymentLimitSwitch->Get() == true){
		    	   deploymentJaguar->Set(-1.0); //Run motor in/backwards
		       	}
		       			       			
		       else{
		    	   deploymentJaguar->Set(0.0); // Don't run motor
		       	}

Any thoughts? Thanks!
__________________
Robot is now a verb.

We're back to square one...while we're at it, let's redesign square one!

Team 956: Celebrating ten years of FIRST!

Code:
Team record 2002-2011
2002: Highest Rookie Seed, AOR
2003, 2006, 2012: Xerox Creativity Award, AOR
2006: Semi-finalist, Sacramento Regional
2009: Quarter-finalist, AOR
2010: Quarter-finalist, AOR
2011: Semi-finalist, AOR, and Dean's List finalist, AOR 

Personal record: 
2008: Lead scout
2009: Lead scout, publicity
2010: Lead scout, publicity, fundraising, Chairman's, videography
2011: Team captain, lead programmer, fundraising, Chairman's, publicity, wrench-turning, Dean's List finalist at Autodesk Oregon Regional
Reply With Quote