Go to Post Now, I either need to convince Mike Martus to start the webhug early (or move it back 1 hour), skip the webhug, miss the first part of the presentation, or just clone myself. - Andy Baker [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 25-02-2007, 01:04
dpick1055's Avatar
dpick1055 dpick1055 is offline
David Pick
FRC #1739 (Chicago Knights)
Team Role: Alumni
 
Join Date: May 2005
Rookie Year: 2004
Location: Chicago
Posts: 75
dpick1055 is on a distinguished road
Send a message via AIM to dpick1055
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;
}
__________________
Always remember to take your powered wheels off the ground when first testing code. Otherwise you'll end up with holes in the wall like us

Last edited by dpick1055 : 25-02-2007 at 01:09.
  #2   Spotlight this post!  
Unread 25-02-2007, 01:20
Stvn's Avatar
Stvn Stvn is offline
FIRST Competition Competer
AKA: Steven Rhodes
FRC #0100 (WHS/CHS - WildHats)
Team Role: Leadership
 
Join Date: Feb 2007
Rookie Year: 2004
Location: Woodside, CA
Posts: 90
Stvn is an unknown quantity at this point
Send a message via AIM to Stvn
Re: PROGRAMMING PNEUMATICS

Quote:
Originally Posted by dpick1055 View Post
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.
__________________
  #3   Spotlight this post!  
Unread 25-02-2007, 01:58
dpick1055's Avatar
dpick1055 dpick1055 is offline
David Pick
FRC #1739 (Chicago Knights)
Team Role: Alumni
 
Join Date: May 2005
Rookie Year: 2004
Location: Chicago
Posts: 75
dpick1055 is on a distinguished road
Send a message via AIM to dpick1055
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.
__________________
Always remember to take your powered wheels off the ground when first testing code. Otherwise you'll end up with holes in the wall like us
  #4   Spotlight this post!  
Unread 01-03-2007, 18:18
gauntletguy gauntletguy is offline
Registered User
AKA: Eric Nelson
FRC #2771
Team Role: Leadership
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Grandville, MI
Posts: 6
gauntletguy is an unknown quantity at this point
Send a message via AIM to gauntletguy
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
  #5   Spotlight this post!  
Unread 04-03-2007, 23:19
Neo3One3 Neo3One3 is offline
Registered User
AKA: Nick
FRC #0175 (Buzz)
Team Role: Driver
 
Join Date: Mar 2006
Rookie Year: 2004
Location: Enfield, CT
Posts: 21
Neo3One3 is a name known to allNeo3One3 is a name known to allNeo3One3 is a name known to allNeo3One3 is a name known to allNeo3One3 is a name known to allNeo3One3 is a name known to all
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
__________________

Go Buzz!
  #6   Spotlight this post!  
Unread 05-03-2007, 00:01
oddjob oddjob is offline
Registered User
no team
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Earth
Posts: 118
oddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to beholdoddjob is a splendid one to behold
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;
  #7   Spotlight this post!  
Unread 01-02-2008, 09:54
Aarnat's Avatar
Aarnat Aarnat is offline
Senior Captain
AKA: Aaron
FRC #2199 (Robo-Lions)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Eldersburg, MD
Posts: 24
Aarnat will become famous soon enoughAarnat will become famous soon enough
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!
  #8   Spotlight this post!  
Unread 01-02-2008, 11:10
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,800
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
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.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
  #9   Spotlight this post!  
Unread 01-02-2008, 15:26
Aarnat's Avatar
Aarnat Aarnat is offline
Senior Captain
AKA: Aaron
FRC #2199 (Robo-Lions)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Eldersburg, MD
Posts: 24
Aarnat will become famous soon enoughAarnat will become famous soon enough
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?
  #10   Spotlight this post!  
Unread 02-02-2008, 00:04
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,800
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: PROGRAMMING PNEUMATICS

Quote:
Originally Posted by Aarnat View Post
What if you wanted a Single Pole Double Throw switch to toggle up to extend a piston and toggle down to retract a piston?
You can toggle a piston with just an SPST since it has the two states you'd need, on/off (in/out for a piston).

But if you wanted to use a SPDT just pick a pair of pins from 2, 7, 10, or 14 and ground on 4 or 12.
Your code would decide what to do with that information.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
  #11   Spotlight this post!  
Unread 02-02-2008, 07:55
Aarnat's Avatar
Aarnat Aarnat is offline
Senior Captain
AKA: Aaron
FRC #2199 (Robo-Lions)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Eldersburg, MD
Posts: 24
Aarnat will become famous soon enoughAarnat will become famous soon enough
Re: PROGRAMMING PNEUMATICS

Thank you to Mark and Leav,
I think we will use a SPST switch to save pins and the "off" position is to retract the piston and the "ON" position is to exstend it.

Thanks!!!
  #12   Spotlight this post!  
Unread 02-02-2008, 00:44
Leav's Avatar
Leav Leav is offline
Spud Gun Division
AKA: Leav Oz-Ari
FRC #3316 (D-Bug)
Team Role: Mentor
 
Join Date: Dec 2004
Rookie Year: 2005
Location: Technion, Haifa, Israel
Posts: 774
Leav has a reputation beyond reputeLeav has a reputation beyond reputeLeav has a reputation beyond reputeLeav has a reputation beyond reputeLeav has a reputation beyond reputeLeav has a reputation beyond reputeLeav has a reputation beyond reputeLeav has a reputation beyond reputeLeav has a reputation beyond reputeLeav has a reputation beyond reputeLeav has a reputation beyond repute
Send a message via ICQ to Leav Send a message via AIM to Leav Send a message via MSN to Leav
Re: PROGRAMMING PNEUMATICS

you could either use a couple of resistors to imitate the function of the analog "wheel" (circular thing on top of joystick), or use two seperate binary button inputs.

when using the "wheel" remember to account for slight variance in values.

-Leav
__________________
"We choose to build robots this season and do the other things; Not because they are easy, but because they are hard."
-Paraphrasing JFK

Participated in FIRST as a student: 2005-2006 (But still learning every season!)
Mentor: 2008 - ? (Team 2630 2008-2011, and Team 3316 since 2013)
Engineer: 2011 - ? (B.Sc. and M.Sc. in Mech. Eng. from the Technion IIT)
FIRST Volunteer - 2007 - ? (MC, FTA, FIRST Aid etc.)
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
programming the pneumatics Armando Programming 2 17-02-2007 21:47
Programming Pneumatics? itzrobz Programming 2 20-01-2007 00:30
Programming of Pneumatics Ben Piecuch Programming 3 18-02-2005 02:39
Pneumatics Programming KWalsh Programming 8 19-02-2004 09:17
Programming PBASIC for pneumatics archiver 2001 2 23-06-2002 23:58


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

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