Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Pneumatics (http://www.chiefdelphi.com/forums/forumdisplay.php?f=54)
-   -   PROGRAMMING PNEUMATICS (http://www.chiefdelphi.com/forums/showthread.php?t=54454)

Reaper40 18-02-2007 14:10

PROGRAMMING PNEUMATICS
 
WE HAVE 4 SPIKES THAT WILL CONTROL SPIKES. THE SPIKES CONTROL THE FOLLOWING:
SPIKE 1: DOUBLE SOLENOID
SPIKE 2: SINGLE SOLENOID
SPIKE 3: COMPRESSOR
SPIKE 4: DOUBLE SOLENOID
WE CANNOT GET THE PNEUMATICS TO WORK BECAUSE WE DONT KNOW HOE TO PROGRAM THE RELAYS.SOMEONE PLEASE HELP!!!!!!!!!!!!

Racer26 18-02-2007 14:20

Re: PROGRAMMING PNEUMATICS
 
well, the compressor is easy:

Code:

relay3_fwd = !rc_dig_in18;
Wire the compressor's + and - leads to the +/- on the output of the 3rd spike, and wire the pressure switch in the pneumatic system into the 18th digital input.

single solenoids are similarly easy:

Code:

relayN_fwd = 1; //to go
relayN_fwd = 0; //to stop

wire the solenoid to the +/- leads of the spike.

double solenoids are slightly trickier.

different people do them different ways, but 1075 in the past has coded them by wiring the +ve's of each side of the double solenoid to + and - on the spike, and wiring the -ve's of each side of the double solenoid to the ground reference on the robot. switching _fwd gives one direction, and _rev goes the other way.

dominic.danna 23-02-2007 08:59

Re: PROGRAMMING PNEUMATICS
 
But how would you program to turn the switch on and off with the click of the trigger

Would it be

if (p1_sw_trig == 1)
{
relay2_fwd = 1; //to go
}
else
{
relay3_fwd = 0; //to stop
}

would this work for having the switch be in relay2 for on and relay3 is for the switch off. Thanks

seanl 23-02-2007 10:49

Re: PROGRAMMING PNEUMATICS
 
Quote:

Originally Posted by dominic.danna (Post 584873)
But how would you program to turn the switch on and off with the click of the trigger

Would it be

if (p1_sw_trig == 1)
{
relay2_fwd = 1; //to go
}
else
{
relay3_fwd = 0; //to stop
}

would this work for having the switch be in relay2 for on and relay3 is for the switch off. Thanks

if your going to do that you will have to hold the trigger while you want that action. your going to need a much more complicated code to have it switch on by pressing the trigger once.and have your device turn on.

dominic.danna 24-02-2007 23:53

Re: PROGRAMMING PNEUMATICS
 
Quote:

Originally Posted by seanl (Post 584919)
if your going to do that you will have to hold the trigger while you want that action. your going to need a much more complicated code to have it switch on by pressing the trigger once.and have your device turn on.

But if i wired a switch to the wires in the controller and bypass the trigger to replace with a switch, would that work?

whytheheckme 25-02-2007 00:12

Re: PROGRAMMING PNEUMATICS
 
Yes, this would work.

We have a totally custom OI. Our box has 4 custom switches on it, along with an xbox port for our controller. We also have 4 different voltages on board the box for different devices.

But in short, yes. Give it a try and see what happens! Let us know your results so that we can give you a hand.

Jacob

dpick1055 25-02-2007 01:04

Re: PROGRAMMING PNEUMATICS
 
It's actually fairly simple to have the trigger control an action with the pneumatics. What have you to do is declare some variable like handstate.

Then when your trigger is pressed changed the value of handstate to 1 or 0. Then when the trigger is pressed you know whether your hand is opened or closed and you can do an action based on it.
Code:

int handstate;
handstate = 0; //default position for whatever your using

if (p1_sw_trig == 1 && handstate == 0)
{
relay2_fwd = 1;
handstate = 1;
}
if (p1_sw_trig == 1 && handstate == 1)
{
relay2_rev = 1;
handstate = 0;
}


Stvn 25-02-2007 01:20

Re: PROGRAMMING PNEUMATICS
 
Quote:

Originally Posted by dpick1055 (Post 586011)
It's actually fairly simple to have the trigger control an action with the pneumatics. What have you to do is declare some variable like handstate.

Then when your trigger is pressed changed the value of handstate to 1 or 0. Then when the trigger is pressed you know whether your hand is opened or closed and you can do an action based on it.
Code:

int handstate;
handstate = 0; //default position for whatever your using

if (p1_sw_trig == 1 && handstate == 0)
{
relay2_fwd = 1;
handstate = 1;
}
if (p1_sw_trig == 1 && handstate == 1)
{
relay2_rev = 1;
handstate = 0;
}


Wouldn't that code just rapidly switch between forward and reverse relays? The handstate would immediately change to 1 when the trigger is pressed, so the next if statement will be true and the relay will be set to reverse. You need to check when the trigger is depressed. Something like:
Code:

int handstate;
handstate = 0; //default position for whatever your using

if (p1_sw_trig == 1 && handstate == 0)
{
relay2_fwd = 1;
handstate = 1;
}
if (p1_sw_trig == 0 && handstate == 1)
{
handstate = 2;
}
if (p1_sw_trig == 1 && handstate == 2)
{
relay2_fwd = 1;
handstate = 3;
}
if (p1_sw_trig == 0 && handstate == 3)
{
handstate = 0;
}

I think. Please correct me if I am wrong.

dpick1055 25-02-2007 01:58

Re: PROGRAMMING PNEUMATICS
 
Oops. Sorry I think it should be
Code:

int handstate;
handstate = 0; //default position for whatever your using

if (p1_sw_trig == 1 && handstate == 0)
{
relay2_fwd = 1;
handstate = 1;
}
else if (p1_sw_trig == 1 && handstate == 1)
{
relay2_rev = 1;
handstate = 0;
}

Though I think your code would work too.

gauntletguy 01-03-2007 18:18

Re: PROGRAMMING PNEUMATICS
 
the code will work, but you would need a timer or something, because if this code is evaluated more that once while the button is held down, the state would alternate very rapidly

Neo3One3 04-03-2007 23:19

Re: PROGRAMMING PNEUMATICS
 
I had a similar issue when programming the pneumatics for our upper/lower claws, wrist, extension, and lateral drive. Let me show you how I solved the issue.

Code:

if (CLAW1IN == 1 && clawTimer < 3)
        {
                clawTimer++;
        }
        else if (CLAW1IN == 1 && clawTimer >= 3 && clawTest == 0)
        {
                CLAWFWD = !CLAWFWD;
                CLAWREV = !CLAWREV;
                clawTest = 1;
        }
        else if (CLAW1IN == 0 && clawTimer >= 3)
        {
                clawTimer = 0;
                clawTest = 0;
        }

In this case we use double action solenoids, so if you just use single ignore the CLAWREV. The clawTimer is used as a measure of necessary depression of the trigger to create a change (eliminating accidental presses) and clawTest is a signal to keep the values from changing again. However, you do need to make sure for doubles that you initialize them as 1, 0, or 0, 1 to begin with, or you'll get 0, 0, and 1, 1 values for the solenoid, I.E. nothing happening.

EDIT:
Oops, forgot to fill in for the definitions.

Code:

#define CLAW1IN p1_sw_aux1
#define CLAWFWD relay2_fwd
#define CLAWREV relay2_rev


oddjob 05-03-2007 00:01

Re: PROGRAMMING PNEUMATICS
 
If you need an edge trigger rather than level trigger, do something like this - assuming that variable 'buttons' holds the state of the joystick(s) buttons, and 'old_buttons' keeps track of the previous state of the buttons:

Code:

  if(buttons!=old_buttons)
  {
    if((buttons&0x1)==0)      /* example - bit 0 is the button to react to */
    {
      do_something_here();    /* execute once per button push */
    }
  }
  old_buttons=buttons;


Aarnat 01-02-2008 09:54

Re: PROGRAMMING PNEUMATICS
 
Hi,
I have seen teams with a board of switches that they have created themselves that controll things like pnunmatics. I would just like to know how we should wire the joystick port with the switches and then use them in the programming.

Thanks!

Mark McLeod 01-02-2008 11:10

Re: PROGRAMMING PNEUMATICS
 
Wiring/programming for the joystick ports is detailed in
http://www.ifirobotics.com/docs/oi-ref-guide-5-8-07.pdf
starting on page 7.

Aarnat 01-02-2008 15:26

Re: PROGRAMMING PNEUMATICS
 
Thanks!
So correct me if I'm wrong: a Single Pole Single Throw switch could have one end to pin 2, 7, 10, or 14 and its power to either 4 or 12. What if you wanted a Single Pole Double Throw switch to toggle up to exstend a piston and togle down to retract a piston?


All times are GMT -5. The time now is 17:06.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi