Go to Post CAD sketches are your best friend. - Knufire [more]
Home
Go Back   Chief Delphi > Technical > Programming
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 13-02-2014, 09:55
TechWarlock TechWarlock is offline
Programming Dude
AKA: Jacob
FRC #1396 (Pyrobots)
Team Role: Programmer
 
Join Date: Feb 2014
Rookie Year: 2011
Location: New York
Posts: 24
TechWarlock is an unknown quantity at this point
Compressor Programming Help

i have code that starts and stops the compressor but it doesnt seem to work. Can anyone see whats wrong with the code


Code:
#include "WPIlib.h"
#include "compressor.h"

class RobotDemo : public SimpleRobot
{
		RobotDrive Frankbot; // robot drive system
		Joystick leftjoy;
		Joystick rightjoy;
		Joystick joystick3;      
		Relay Comp;
		Jaguar Winch;
		Jaguar Claw;
		Jaguar Granata;
		Solenoid Sol1;
		Solenoid Sol2;
		Solenoid Sol3;
		Solenoid Sol4;
public:
	RobotDemo(void):
		Frankbot(1, 2), //these are the PWM ports
		leftjoy(1),	
		rightjoy(2),
		joystick3(3),  
		Comp(1, 1),
		Winch(7),  
		Claw(9),
		Granata(5),
		Sol1(1, 1),
		Sol2(1, 2),
		Sol3(1, 3),
		Sol4(1, 4)
		{
	//	usermessages = DriverStationLCD::GetInstance();
	//	Camera->WriteResolution(AxisCamera::kResolution_160x120);
	//	Camera->WriteCompression(20);
	//	Camera->WriteWhite
    //  Balance(AxisCameraParams::kWhiteBalance_FixedIndoor);
	//	Camera->WriteMaxFPS(30);
	//	Camera = &AxisCamera::GetInstance();
	//	myRobot.SetExpiration(0.1); // test
		}

	void Autonomous(void)
		{
		Compressor *c = new Compressor(1, 1);
			    				c->Start();
		}
void OperatorControl(void)
	{
		int Off = 7;
		int On = 8;
		int ClawTurn = 10;
		int ClawTurn1 = 11;
	    int Claw1 = 4;
		int Claw2 = 5;
		int WinchUp = 4;
		int WinchDown = 5;
		int Solup = 2;
	    int Soldown = 3;
		int Sol2Up = 2;
		int Sol2Down = 3;
	    static float speedModifier = 0.7;
		static float speedModifier2 = -0.8;
		Frankbot.SetSafetyEnabled(true);
		Compressor *c = new Compressor(1, 1);
			    				c->Start();
		while (IsOperatorControl())
		{
			Frankbot.TankDrive(-leftjoy.GetY() * speedModifier, rightjoy.GetY() * speedModifier2);
					
			
			if(joystick3.GetRawButton(On)){
						c->Start();
			}

			else if(joystick3.GetRawButton(Off)) {
						c->Stop();
			}
			else {
				c->Stop();
			}
			if(leftjoy.GetRawButton(WinchUp)) {
			Winch.Set(0.5);
	}
		
	else if(leftjoy.GetRawButton(WinchDown)) {
			Winch.Set(-0.5);
	}
	else {
			Winch.Set(0.0);
		}
	if(rightjoy.GetRawButton(Claw1)) {
					Claw.Set(0.5);
				}
				
	else if(rightjoy.GetRawButton(Claw2)) {
					Claw.Set(-0.5);
				}
	else {
					Claw.Set(0.0);
				}
	if(rightjoy.GetRawButton(ClawTurn)) {
						Granata.Set(0.2);
					}
					
	else if(rightjoy.GetRawButton(ClawTurn1)) {
						Granata.Set(-0.2);
					}
	else {
						Granata.Set(0.0);
					}
	
	if(leftjoy.GetRawButton(Solup)){
			Sol1.Set(true);
			Sol2.Set(false);
		}
		else if(leftjoy.GetRawButton(Soldown)){
			Sol1.Set(false);
			Sol2.Set(true);
		}
		else {
			Sol1.Set(false);
			Sol2.Set(false);
		}
		if(rightjoy.GetRawButton(Sol2Up)){
					Sol3.Set(true);
					Sol4.Set(false);
				}
		else if(rightjoy.GetRawButton(Sol2Down)){
					Sol3.Set(false);
					Sol4.Set(true);
				}
		else {
					Sol3.Set(false);
					Sol4.Set(false);
				}
		        }
	}

	};
START_ROBOT_CLASS(RobotDemo);
Any and all help is appreciated, thank you
 


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 10:17.

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