Go to Post Funny, I came to robotics for the robot, but find I stay for the people. - Mr. Pockets [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

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 11-02-2008, 21:50
Nguyen Nguyen is offline
Registered User
AKA: Handsome Rob
FRC #0401 (Hokie Guard)
Team Role: Mentor
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Blacksburg, VA
Posts: 8
Nguyen is an unknown quantity at this point
Send a message via AIM to Nguyen
Exclamation Pneumatics coding

I'm helping out a team with no programming experience and I have basic experience but none relating to FIRST.

They are trying to code their pneumatics but don't know how to do so or even where to start.

The basic setup is as follows:

there are 3 pneumatic valves:
the first one is connected as follows: festo valve -> spike relay -> pwm8
the second is festo valve -> spike relay -> pwm12
the third is festo valve -> spike relay -> pwm16

the compressive is compressor-> spike-> relay8

the 3 valves would be independently controlled by 3 arbitrary joystick buttons

Would anyone be so kind as to point me in the right direction?
__________________
401 Mentor
384 Alumni
3rd Year Virginia Tech BSME
  #2   Spotlight this post!  
Unread 11-02-2008, 22:01
mlucas's Avatar
mlucas mlucas is offline
Registered User
FRC #1516 (Grizzlies)
Team Role: Mechanical
 
Join Date: Sep 2007
Rookie Year: 2007
Location: San Ramon
Posts: 14
mlucas is an unknown quantity at this point
Send a message via AIM to mlucas
Re: Pneumatics coding

what program are you using?
__________________
Team 1516-Grizzlies
Architect

CNC Machining, Electrical, Pneumatics, Drivetrain, and mostly GOPHER

  #3   Spotlight this post!  
Unread 11-02-2008, 22:04
Nguyen Nguyen is offline
Registered User
AKA: Handsome Rob
FRC #0401 (Hokie Guard)
Team Role: Mentor
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Blacksburg, VA
Posts: 8
Nguyen is an unknown quantity at this point
Send a message via AIM to Nguyen
Re: Pneumatics coding

sorry about that, mplab
__________________
401 Mentor
384 Alumni
3rd Year Virginia Tech BSME
  #4   Spotlight this post!  
Unread 11-02-2008, 22:08
mlucas's Avatar
mlucas mlucas is offline
Registered User
FRC #1516 (Grizzlies)
Team Role: Mechanical
 
Join Date: Sep 2007
Rookie Year: 2007
Location: San Ramon
Posts: 14
mlucas is an unknown quantity at this point
Send a message via AIM to mlucas
Re: Pneumatics coding

ill have to let someone else help you then, i only no easyc...srry, i would try a help menu on mplab...they are surprisingly helpful, our programmer taught himself that way...only took 2.5 months
__________________
Team 1516-Grizzlies
Architect

CNC Machining, Electrical, Pneumatics, Drivetrain, and mostly GOPHER

  #5   Spotlight this post!  
Unread 11-02-2008, 22:21
Joohoo's Avatar
Joohoo Joohoo is offline
Registered User
FRC #0340 (G.R.R.)
Team Role: Mentor
 
Join Date: Jun 2005
Rookie Year: 2005
Location: Rochester
Posts: 241
Joohoo is just really niceJoohoo is just really niceJoohoo is just really niceJoohoo is just really niceJoohoo is just really nice
Send a message via AIM to Joohoo Send a message via Yahoo to Joohoo
Re: Pneumatics coding

Quote:
Originally Posted by Nguyen View Post
I'm helping out a team with no programming experience and I have basic experience but none relating to FIRST.

They are trying to code their pneumatics but don't know how to do so or even where to start.

The basic setup is as follows:

there are 3 pneumatic valves:
the first one is connected as follows: festo valve -> spike relay -> pwm8
the second is festo valve -> spike relay -> pwm12
the third is festo valve -> spike relay -> pwm16

the compressive is compressor-> spike-> relay8

the 3 valves would be independently controlled by 3 arbitrary joystick buttons

Would anyone be so kind as to point me in the right direction?
ok, so first of all spike relays cannot be plugged into pwm outputs. What they do need to be plugged into are the relay outputs.

ok now that you have all the pneumatics plugged into relays and not pwms, ill go over how they work. The relays are basically 2 digital outputs slapped into a single cable, so there are two bits that you can set. relay#_fwd and relay#_rev. What this gets translated into is either +12V, -12V, 0V to the festo Valves. So in order to set them to one direction you would use this line of code

relay#_fwd = 1;
relay#_rev = 0;

this will set your festo valve to actuate your pneumatic one way and if you switch which bit is set to 1 then you actuate the pneumatic the other way. Now is for some reason you dont want any pressure in the cylinders then you set each bit to 0.

Now if you want to change these based on a button on a joystick then you can change the relay#_fwd and relay#_rev bits inside an if statment such as

if(p1_sw_top ==1)
{
relay#_fwd = 1;
relay#_rev = 0;
}

If you need any help any further feel free to pm me and I'll try to help you.
  #6   Spotlight this post!  
Unread 11-02-2008, 23:28
Racer26 Racer26 is offline
Registered User
no team
Team Role: Alumni
 
Join Date: Apr 2003
Rookie Year: 2003
Location: Beaverton, ON
Posts: 2,229
Racer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond repute
Re: Pneumatics coding

Quote:
Originally Posted by Joohoo View Post
ok, so first of all spike relays cannot be plugged into pwm outputs. What they do need to be plugged into are the relay outputs.

ok now that you have all the pneumatics plugged into relays and not pwms, ill go over how they work. The relays are basically 2 digital outputs slapped into a single cable, so there are two bits that you can set. relay#_fwd and relay#_rev. What this gets translated into is either +12V, -12V, 0V to the festo Valves. So in order to set them to one direction you would use this line of code

relay#_fwd = 1;
relay#_rev = 0;

this will set your festo valve to actuate your pneumatic one way and if you switch which bit is set to 1 then you actuate the pneumatic the other way. Now is for some reason you dont want any pressure in the cylinders then you set each bit to 0.

Now if you want to change these based on a button on a joystick then you can change the relay#_fwd and relay#_rev bits inside an if statment such as

if(p1_sw_top ==1)
{
relay#_fwd = 1;
relay#_rev = 0;
}

If you need any help any further feel free to pm me and I'll try to help you.
You're close, but you're not quite right.

First off, you're right about the connections to RC. Spikes MUST be plugged into the RELAY outputs on the RC. I don't know that there is a rule saying this, but its implied by the fact that they won't work if you don't.

The FESTO valves are single solenoid. I don't know what these will do with reverse polarity, but I imagine its along the lines of either a) just not do anything, or b) cease to function ever again.

Thusly, I wouldn't touch relay#_rev on those units, except to ensure its set to 0.

The FESTO valves can be simply switched using relay#_fwd = 1;, and relay#_fwd = 0;

The SMC single solenoid is the same.

The SMC Double solenoid is used in the way you describe, using relay#_fwd for one direction, and relay#_rev for the other direction, assuming you've wired the two positives to M+ and M- on your spike, and the grounds to ground.

Setting _fwd and _rev to zero on a SMC double will leave the gate in whichever direction it was last set to. We are not given "center-off" valves that would give the behavior you describe.
  #7   Spotlight this post!  
Unread 12-02-2008, 02:43
Inetta's Avatar
Inetta Inetta is offline
NaNa
FRC #1703 (R.A.W.R.)
Team Role: Webmaster
 
Join Date: Feb 2008
Rookie Year: 2008
Location: Las Vegas
Posts: 5
Inetta is an unknown quantity at this point
Re: Pneumatics coding

First off thanks so much to everyone that replied and helped and also thanks so much Squishy for helping me at all, I really appreciate it. <3

basically I used this line of code so far

relay2_fwd = 0;
relay2_rev = 0;

if(p4_sw_trig == 1)
{
relay2_fwd=1;
relay2_rev=0;
}
else if (p4_sw_trig == 0)
{
relay2_fwd=0;
relay2_rev=0;
}

like would that work.. or is that completely wrong?

sorry, I really don't have any experience in programming so my questions might seem pointless. So like I said, sorry ahead of time

Last edited by Inetta : 12-02-2008 at 03:01.
  #8   Spotlight this post!  
Unread 12-02-2008, 08:48
Racer26 Racer26 is offline
Registered User
no team
Team Role: Alumni
 
Join Date: Apr 2003
Rookie Year: 2003
Location: Beaverton, ON
Posts: 2,229
Racer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond repute
Re: Pneumatics coding

That will work famously.

Pulling the trigger on port 4's joystick will result in the spike at relay2, and presumably, the solenoid valve attached to it, to actuate, and releasing the trigger will de-actuate the cylinder, assuming you're using the FESTO single solenoid valves (the roundish white ones with a blue lever and 4 grey ports.)
  #9   Spotlight this post!  
Unread 13-02-2008, 08:00
Inetta's Avatar
Inetta Inetta is offline
NaNa
FRC #1703 (R.A.W.R.)
Team Role: Webmaster
 
Join Date: Feb 2008
Rookie Year: 2008
Location: Las Vegas
Posts: 5
Inetta is an unknown quantity at this point
Re: Pneumatics coding

okay, I understand how it all works now however I'm not sure how I could write a block of coding that would allow me to toggle the buttons.. if that is possible.

Is there a code that would allow me to just press button = active;
press again = inactive?
  #10   Spotlight this post!  
Unread 13-02-2008, 08:32
JBotAlan's Avatar
JBotAlan JBotAlan is offline
Forever chasing the 'bot around
AKA: Jacob Rau
FRC #5263
Team Role: Mentor
 
Join Date: Sep 2004
Rookie Year: 2004
Location: Riverview, MI
Posts: 723
JBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond repute
Send a message via AIM to JBotAlan Send a message via Yahoo to JBotAlan
Re: Pneumatics coding

Quote:
Originally Posted by Inetta View Post
okay, I understand how it all works now however I'm not sure how I could write a block of coding that would allow me to toggle the buttons.. if that is possible.

Is there a code that would allow me to just press button = active;
press again = inactive?
Well, you need to know some characteristics about these switches.

First off, you will need to probably de-bounce the switches. The chances that you get something like "000000100010101110111111" when the button is pressed are likely. I don't use toggles, so I don't know about code for this. While I could script it up, it would likely be horribly inefficient...

Second, you will need to have a static variable that you set to 1 when the switch is triggered; set it to 0 when the switch goes to 0. Before you set this variable, check if the switch is 1 and the variable is 0; if this condition is true, change the pneumatic, then set the variable to 1.

Let me know if you would like pseudo code, but I'd prefer not to write specific code. That should be left up to you.

JBot
__________________
Aren't signatures a bit outdated?
  #11   Spotlight this post!  
Unread 13-02-2008, 08:53
COACHTJ1688's Avatar
COACHTJ1688 COACHTJ1688 is offline
-STICKSHIFT ROBOTICS-
AKA: TJ
FRC #1688 (Stickshift)
Team Role: Coach
 
Join Date: Jan 2007
Rookie Year: 2004
Location: Staten Island
Posts: 13
COACHTJ1688 is an unknown quantity at this point
Re: Pneumatics coding

We're having issues programming the compressor and pressure switch, which I thought was part of the original question, but never got answered.

Our team is using Easy C, which we're really efficient with. I believe that we lack the sufficient knowledge of the pneumatics system, due to years of the coach saying that it was a waste of time.

Well, the future is NOW! people. Team 1688 has ventured into the land of safety orange tubing, and pressure gauge happiness!

I thought that I read somewhere that input 16 was used for the pressure switch and one of the spike relays was used for the compressor? Can someone help? Or at least direct me to a thread that can?

THANKS!

~Tom
__________________




"If you can't fix it with duct tape...you haven't used enough duct tape."
  #12   Spotlight this post!  
Unread 13-02-2008, 11:59
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
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,854
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: Pneumatics coding

Put InitPressureSwitch() into the Initialize block and just specify the digital input that the pressure sensor is plugged into and the Relay the compressor's Spike is connected to.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
  #13   Spotlight this post!  
Unread 13-02-2008, 14:57
COACHTJ1688's Avatar
COACHTJ1688 COACHTJ1688 is offline
-STICKSHIFT ROBOTICS-
AKA: TJ
FRC #1688 (Stickshift)
Team Role: Coach
 
Join Date: Jan 2007
Rookie Year: 2004
Location: Staten Island
Posts: 13
COACHTJ1688 is an unknown quantity at this point
Re: Pneumatics coding

We had something similar. Perhaps we just had it backwards. I'll check it when I get to the lab.

THANKS!
__________________




"If you can't fix it with duct tape...you haven't used enough duct tape."
  #14   Spotlight this post!  
Unread 13-02-2008, 21:24
hipsterjr's Avatar
hipsterjr hipsterjr is offline
Your bot can score but can it dance
AKA: CJ
FRC #4451 (The Burning Magnetos)
Team Role: College Student
 
Join Date: Dec 2006
Rookie Year: 2002
Location: summerville,SC
Posts: 587
hipsterjr has a reputation beyond reputehipsterjr has a reputation beyond reputehipsterjr has a reputation beyond reputehipsterjr has a reputation beyond reputehipsterjr has a reputation beyond reputehipsterjr has a reputation beyond reputehipsterjr has a reputation beyond reputehipsterjr has a reputation beyond reputehipsterjr has a reputation beyond reputehipsterjr has a reputation beyond reputehipsterjr has a reputation beyond repute
Send a message via AIM to hipsterjr
Question Re: Pneumatics coding

We are having a similar problem. We have this basic layout for our shifters and another cylinder:

Quote:
relay2_fwd = 0;
relay2_rev = 0;

if(p4_sw_trig == 1)
{
relay2_fwd=1;
relay2_rev=0;
}
else if (p4_sw_trig == 0)
{
relay2_fwd=0;
relay2_rev=0;
}
We are using a button on the control panel to activate it. The problem is that the we have to hold the button to say in high or low gear. I tried to set it so that one press of the button would activate the cylinder and a second would deactivate the cylinder. I have tried doing this a couple different ways, but as the code cycles every 20 something milliseconds, the shift state changes with it. So as I press the button quickly, it will activate and deactivate a couple dozen times. How do I stop this? (using MBLAB)
__________________
2010 Palmetto Chairmens Winner
2009 Peachtree Finalist Thanks 1319 & 590 "Sure your robot can score, but can it dance?!"
2008 Palmetto Regional Finalist Thanks 343 & 804
2008 Florida Regional Finalist Thanks 179 & 69
2007 Palmetto Regional winners Thanks 1319 & 832
2005 Palmetto Chairmens Winner
  #15   Spotlight this post!  
Unread 13-02-2008, 22:24
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
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,854
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: Pneumatics coding

Something such as:
Code:
  static char toggle=1;

  if(p4_sw_trig && toggle)
  {
	toggle = 0;
  	relay2_fwd = !relay2_fwd; 
  	relay2_rev = 0;
  }
  if(!p4_sw_trig)
  {
	toggle = 1;
  }
prevents further toggling until the button has been released again.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
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
C coding ExarKun666 General Forum 12 21-12-2007 14:13
Photoswitch coding magical hands Programming 0 17-01-2006 21:20
pneumatics coding problem (or technical) wildabyss Programming 2 22-02-2005 22:16
pneumatics coding problem (or technical) wildabyss Pneumatics 2 22-02-2005 22:16
coding a potentiometer incognito_NICK Programming 5 14-02-2005 15:56


All times are GMT -5. The time now is 19:07.

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