Go to Post At this rate, Team Update #2 should just eliminate the Minibots and replace it with the drive team captains playing rock-paper-scissors to determine the bonus points. - artdutra04 [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 Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 02-10-2009, 03:16 PM
Alex_2487 Alex_2487 is offline
Registered User
AKA: Alex Korpi
no team
Team Role: Alumni
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Sayville, New York
Posts: 31
Alex_2487 is an unknown quantity at this point
Send a message via AIM to Alex_2487
Compressor won't start

i'm using this code and everytihng works on our robot but the compressor won't start. here is my code any help would be appreciated. thanks in advanced

Quote:
//************************************************** *************************
//2009 Sayville High School Robotics Code
//Uses a 2 motor tank drive system with 2 sim motors wired to jaguars
//has a front roller using a cut in half fisherprice motor wired to a victor
//has a beater bar system power by 1 sim motor wired to a victor
//has a compressor which uses standard compressor class to run during match
//has 2 solenoid that on run together with a pully system used to dump balls
//drive joysticks are standard usb joysticks fron kit of parts
//third joystick is used to control frontroller,beatbars,and both solenoids
//************************************************** ***********************
//INPUTS
//
//left drive motor(jaguar) - pwm1
//right drive motor(jaguar) - pwm2
//beater bars(victor) - pwm3
//front roller(victor) - pwm4
//Compressor1 - spike relay(relay1),pressure switch (digitalinput1)
//Solenoid 1 -solenoid 1
//Solenoid 2 - solenoid 2
//Left Joystick - USB 1
//Right Joystick - USB 2
//************************************************** ***********************
//NOTES
//
//victor can only run as slow as 10%
//jaguars can run as slow as 3%
//drive function is (speed,turn)
//setleftmotorrightmotorspeed function is (leftmotor,rightmotor)
//instead of speeds being 0 to 255(binary) speed has been normalized to be -1.0 to 1.0
//************************************************** **********************

#include "WPILib.h" // include the WPI robotics library

class RobotDemo : public SimpleRobot //class being used is simple robot
//Global Varaibles
{
RobotDrive myRobot; //Robot Drive defines the 2 drive motors
Joystick LeftJoystick; // Defines Leftjoystick
Joystick RightJoystick; // Defines RightJoystick
Joystick ThirdJoystick; // Defines Thirdjoystick
Compressor *Compressor1; // Defines compressor
Solenoid *Solenoid1,*Solenoid2; // Defines Both soleoinds
Victor *FrontRoller, *BeaterBars; // Defines FrontRoller and BeaterBars

public:


RobotDemo(void): // inizalation code
myRobot(1, 2), // drive motors are in pwm 1 and 2
LeftJoystick(1), // leftjoystick in usb port 1
RightJoystick(2), // rightjoystick in usb port 2
ThirdJoystick(3) // thirdjoystick in usb port 3
{
GetWatchdog().SetExpiration(100);
Compressor1 = new Compressor(1, 1); // compressor spike is in realy 1 and pressure switch is in digital input 1
Compressor1->Start(); // compressor will run when not fill during autonomous and operator control mode
Solenoid1 = new Solenoid(1); // solenoid1 is in solenoid module port 1
Solenoid2 = new Solenoid(2); // solenoid2 is in solenoid module port 2
FrontRoller = new Victor(3); // front roller motor in pwm 3
BeaterBars = new Victor(4); // beater bar motor in pwm 4
}

void Autonomous(void) //start of autonomous
{
GetWatchdog().SetEnabled(false); //watchdog is disabled durning autonomous
myRobot.SetLeftRightMotorSpeeds(1.0, 1.0);
Wait(2.0);
myRobot.SetLeftRightMotorSpeeds(-1.0, 1.0);
Wait(2.0);
myRobot.SetLeftRightMotorSpeeds(1.0,0.0);
Wait(2.0);
myRobot.SetLeftRightMotorSpeeds(0.0,0.0);
}


void OperatorControl(void) //start operator control
{
GetWatchdog().SetEnabled(true); // watchdog is enabled during operator control mode
while (IsOperatorControl())
{
GetWatchdog().Feed();
myRobot.TankDrive(LeftJoystick,RightJoystick); //2 Motor Tank Drive
{
{
if (ThirdJoystick.GetRawButton (1)==1 ) //if leftjoystick button 1(trigger) is click
{
Solenoid1->Set(true); // then solenoid1 will be out
Solenoid2->Set(true); // and solenoid2 will be out
}
else // if button 1(trigger) is not pressed
{
Solenoid1->Set(false); // solenoid1 will be in
Solenoid2->Set(false); // and solenoid2 will be in
}
}
{
if (ThirdJoystick.GetRawButton (3)==1 ) {
BeaterBars->Set(0.0); }
else
{
BeaterBars->Set(1.0); }
}
{
if (ThirdJoystick.GetRawButton (5)==1 ) {
FrontRoller->Set(0.0); }
else
{
FrontRoller->Set(1.0); }
}
}
}
}
};

START_ROBOT_CLASS(RobotDemo); // start robot class and starup library(run program)
__________________
Events
2009 SBPLI Long Island Regional
2008 Deer Park Invitational, Championships- Galileo Division, SBPLI Long Island Regional
Awards
2009 Long Island Semifinalists
2008 Deer Park Invitational Finalist (353,1546), Long Island Regional Champion (2010,102),Highest Rookie Seed, Rookie Inspiration, Best Website, Website Excellence Award
2009 Record(2487): 5-9-1
2008 Record(2487): 23-10-3
Overall Record(2487): 27-19-4
www.wbsts.com/gnomes.html
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
Wind River won't start radau C/C++ 6 01-19-2009 11:09 PM
Won't Download! diaperrash89 Programming 4 10-25-2007 11:02 PM
It won't build anymore cgront Programming 3 02-02-2007 05:26 PM
Running just the compressor (was: free compressor) sciguy125 Pneumatics 15 02-06-2006 06:23 PM
Help! My 2003 Bot compressor won't shut off Jack21 Control System 10 02-11-2004 12:24 PM


All times are GMT -5. The time now is 10:55 AM.

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