Go to Post I guess that we will just have to live with it, EH!!! :D - Steve W [more]
Home
Go Back   Chief Delphi > Technical > Pneumatics
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 20-02-2011, 16:54
Matthew Blake's Avatar
Matthew Blake Matthew Blake is offline
Registered User
FRC #3481 (Bronc Botz)
 
Join Date: Feb 2011
Rookie Year: 2009
Location: Helotes, Texas
Posts: 43
Matthew Blake is an unknown quantity at this point
Pneumatics WindRiver Programming HELP

Hi all,

We have run into trouble with our pneumatics programming. We have everything set up correctly (we think) and all of the values our correctly set for the compressor and the solenoids. However, when we press the button assigned to set the solenoids to (TRUE) and then to (FALSE) the actuator doesn't move. Does anyone see the problem in the following code?



#include "WPILib.h"
#include "sockLib.h"
#include "inetLib.h"
#include "hostLib.h"

/**
* This is a demo program showing the use of the RobotBase class.
* The SimpleRobot class is the base of a robot application that will automatically call your
* Autonomous and OperatorControl methods at the right time as controlled by the switches on
* the driver station or the field controls.
*/
class RobotDemo : public SimpleRobot
{
// CANJaguar leftFrontJag; // CAN attached Jag
// CANJaguar leftRearJag; // CAN attached Jag
// CANJaguar rightFrontJag; // CAN attached Jag
// CANJaguar rightRearJag; // CAN attached Jag
// RobotDrive myRobot;
Joystick stick; // only joystick
Solenoid sol1;
Solenoid sol2;
Compressor compress;

public:
RobotDemo(void):
// leftFrontJag(2),
// leftRearJag(4),
// rightFrontJag(6),
// rightRearJag(8),
// myRobot(leftFrontJag, leftRearJag, rightFrontJag, rightRearJag),
stick(1), // as they are declared above.
sol1(8,1),
sol2(8,2),
compress(5,2)

{
// myRobot.SetExpiration(0.1);
}

/**
* Drive left & right motors for 2 seconds then stop
*/
void Autonomous(void)
{
// myRobot.SetSafetyEnabled(false);
// myRobot.Drive(0.5, 0.0); // drive forwards half speed
// Wait(2.0); // for 2 seconds
// myRobot.Drive(0.0, 0.0); // stop robot
}

/**
* Runs the motors with arcade steering.
*/
void OperatorControl(void)
{
bool buttonPressed[17];
int indexVar;

// myRobot.SetSafetyEnabled(false);
compress.Start();

while (true)
{

}
while (IsOperatorControl() && !IsDisabled())
{
// myRobot.ArcadeDrive(stick); // drive with arcade style (use right stick)
for (indexVar=1; indexVar<2; indexVar++) {
buttonPressed[indexVar] = stick.GetRawButton(indexVar);
if (buttonPressed[indexVar]) {
switch (indexVar) {
case 1:
sol1.Set(TRUE);
sol2.Set(FALSE);
Wait(2.0);
sol2.Set(TRUE);
sol1.Set(FALSE);
break;/*
case 2:
sol2.Set(TRUE);
Wait(1.0);
sol2.Set(FALSE);
break;
case 3:
sol3.Set(TRUE);
Wait(1.0);
sol3.Set(FALSE);
break;
case 4:
sol4.Set(TRUE);
Wait(1.0);
sol4.Set(FALSE);
break;
case 5:
sol5.Set(TRUE);
Wait(1.0);
sol5.Set(FALSE);
break;
case 6:
sol6.Set(TRUE);
Wait(1.0);
sol6.Set(FALSE);
break;
case 7:
sol9.Set(TRUE);
Wait(1.0);
sol9.Set(FALSE);
break;
case 8:
sol10.Set(TRUE);
Wait(1.0);
sol10.Set(FALSE);
break;
case 9:
sol11.Set(TRUE);
Wait(1.0);
sol11.Set(FALSE);
break;
case 10:
sol12.Set(TRUE);
Wait(1.0);
sol12.Set(FALSE);
break;
case 11:
sol13.Set(TRUE);
Wait(1.0);
sol13.Set(FALSE);
break;
case 12:
sol14.Set(TRUE);
Wait(1.0);
sol14.Set(FALSE);
break;
case 13:
break;
case 14:
break;
case 15:
break;
case 16:
break;*/
default:
break;
}
} else {
// sol1.Set(FALSE);
// sol2.Set(FALSE);
// sol3.Set(FALSE);
// sol4.Set(FALSE);
// sol5.Set(FALSE);
// sol6.Set(FALSE);
// sol7.Set(FALSE);
// sol8.Set(FALSE);
// sol9.Set(FALSE);
// sol10.Set(FALSE);
// sol11.Set(FALSE);
// sol12.Set(FALSE);
// sol13.Set(FALSE);
// sol14.Set(FALSE);
// sol15.Set(FALSE);
// sol16.Set(FALSE);
}
}

Wait(0.005); // wait for a motor update time
}
compress.Stop();
}
};

START_ROBOT_CLASS(RobotDemo);
__________________
FTC Team 4008: 2009-2012
FTC Team 4602: 2010-2012
FRC Team 3481: 2010-2012
  #2   Spotlight this post!  
Unread 22-02-2011, 18:23
tux tux is offline
Registered User
AKA: Lee Harr
FRC #3842 (Shock-a-Bots)
Team Role: Mentor
 
Join Date: Apr 2005
Rookie Year: 2005
Location: Rochester, NY
Posts: 91
tux is an unknown quantity at this point
Re: Pneumatics WindRiver Programming HELP

When you press your buttons, you should be able to see the small green LEDs changing on top of the solenoid breakout board. Are you seeing that?

The problem with your code looks like it might be in the for loop.

You start with indexVar=1 and exit the loop if indexVar is > 2, so you will only check indexVar values of 1 and 2 but you have cases where it looks like you want to check up to 12.
  #3   Spotlight this post!  
Unread 22-02-2011, 18:52
wireties's Avatar
wireties wireties is offline
Principal Engineer
AKA: Keith Buchanan
FRC #1296 (Full Metal Jackets)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2004
Location: Rockwall, TX
Posts: 1,170
wireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond repute
Send a message via AIM to wireties
Re: Pneumatics WindRiver Programming HELP

your while(true) loop will never let the code after it run

hth
Closed Thread


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 16:27.

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