Go to Post Who wouldn't love to see a circular FRC field, on the backs of four elephants, all riding on a gigantic turtle? - Taylor [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 10-10-2009, 00:25
nighterfighter nighterfighter is offline
1771 Alum, 1771 Mentor
AKA: Matt B
FRC #1771 (1771)
Team Role: Mentor
 
Join Date: Sep 2009
Rookie Year: 2007
Location: Suwanee/Kennesaw, GA
Posts: 835
nighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant future
Pneumatics Code

Hey, thanks to some great help from Jon236, Alan Anderson and Mark McLeod, I think I got some code that *might* work with the pneumatics system...

If someone could take a look over it and maybe give me some pointers, that'd be great! (School is closed until Tuesday...Furlough days. )

Code:
#include "WPILib.h"
#include "1771Constants.h"
#include <iostream>
using namespace std;

namespace Team1771
{
class Team1771Robot : public SimpleRobot 
{
	RobotDrive driveTrain;
	Joystick leftStick;
	Joystick rightStick;
	Joystick manipulator;
	Compressor compressorControl;
	Solenoid turret;
	
	
	

public:
	Team1771Robot(void): 
		driveTrain(LEFT_DRIVE_MOTOR_PORT, 
				   RIGHT_DRIVE_MOTOR_PORT), 
		leftStick(LEFT_JOYSTICK_PORT),
		rightStick(RIGHT_JOYSTICK_PORT),
		manipulator(MANIPULATOR_JOYSTICK_PORT),
		compressorControl(3,3,COMPRESSOR_PORT,7),
		turret(5)												//THIS *HAS* TO BE CHANGED
//I just made up random number
//TODO: Figure out how to hook it up!!!
		{
	
		compressorControl.Start();
		};
	
	void Autonomous(void)
	{
		GetWatchdog().SetEnabled(false);
		while(IsAutonomous() && !IsDisabled())
		{}
	}
	
	void OperatorControl(void) 
	{	
		GetWatchdog().SetEnabled(false);
		while (IsOperatorControl() && !IsDisabled()) 
		{
			
			//FIRE AWAY CAP'N!
			if(manipulator.GetRawButton(1))
			{
				
				//Seeing if I have enough. Just a rough estimate.
				if(compressorControl.GetPressureSwitchValue() < 100)
				{
					cout << "Not enough power to fire. " << endl;
					cout << compressorControl.GetPressureSwitchValue() << endl;					
					Wait(1);
				}
				else //Fire into the crowd! Rawr!
				{
					//Uncomment to see pressure values before firing
					/*
					cout << compressorControl.GetPressureSwitchValue() << endl;
					*/
					turret.Set(1); //I think this will tell the solenoid(I think its the solenoid?) 
					//to switch and let the air fire from the chamber.
					turret.Set(0);//Then that should turn it off?					
					//TODO: Figure out if 1 is letting air in, or if 0 is.					
					//Uncomment this below for seeing how much pressure we lose from firing.
					/*
					cout << compressorControl.GetPressureSwitchValue() << endl;
					*/
					Wait(1);
				}
	
			}
			
			
		}
	}
};
START_ROBOT_CLASS(Team1771Robot);
}



One of my questions that I already have however, is with the Compressor.Start()
I noticed in the Compressor.h file, there is a function called void SetRelayValue(Relay::Value relayValue). Does the Compressor class automatically call this is needed?
From what I understand, calling compressorControl.Start() will turn on the compressor, and automatically keep the pressure to a certain level.
Reply With Quote
 


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems integrating CMUCAM code and IFI Default Code Windward Programming 2 06-02-2007 16:48
problems using gyro/adc code with camera default code tanstaafl Programming 7 22-01-2006 23:09
Pneumatics-Code [and piston output length] reilly Programming 5 13-02-2005 11:42
Pneumatics-Code [and piston output length] reilly Technical Discussion 0 10-02-2005 12:21
Team THRUST - Kevin's Code and Camera Code Combine Chris_Elston Programming 3 31-01-2005 22:28


All times are GMT -5. The time now is 11:58.

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