Go to Post Feelings are like the laws of physics: if some one feels offended or alienated, then they are offended or alienated - it doesnt matter why you dropped a hammer, if it falls on someones head they will be hurt. You cant expect it to not hurt, because you did not intend to hurt them. - KenWittlief [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 29-03-2008, 07:27
beefy23 beefy23 is offline
Registered User
no team
 
Join Date: Mar 2008
Location: Israel
Posts: 9
beefy23 is an unknown quantity at this point
Question Problem in Pneumatics programming

I have a problem trying to cause the piston going forwards and backwards.

What I`ve tried to do is to move the piston backwards when the user clicks on the joystick`s trig and to move the piston forwards when the user get rid of the joystick`s trig.

I had a problem which seemed ambiguous for me and I couldn`t find the error, it compiled successfully.

I made sure the spike is plugged in the proper relay, and the joystick is plugged in the proper port.

Here is the code:

if(p1_sw_trig)
{
relay1_fwd = 0;
relay1_rev = 1;
}
else
{
relay1_fwd = 1;
relay1_rev = 0;
}

but it doesn`t do anything .
  #2   Spotlight this post!  
Unread 29-03-2008, 08:12
Qbranch Qbranch is offline
wow college goes fast.
AKA: Alex
FRC #1024 (Kil-A-Bytes)
Team Role: Alumni
 
Join Date: Apr 2006
Rookie Year: 2006
Location: Indianapolis
Posts: 1,174
Qbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond repute
Re: Problem in Pneumatics programming

Quote:
Originally Posted by beefy23 View Post
I have a problem trying to cause the piston going forwards and backwards.

What I`ve tried to do is to move the piston backwards when the user clicks on the joystick`s trig and to move the piston forwards when the user get rid of the joystick`s trig.

I had a problem which seemed ambiguous for me and I couldn`t find the error, it compiled successfully.

I made sure the spike is plugged in the proper relay, and the joystick is plugged in the proper port.

Here is the code:

if(p1_sw_trig)
{
relay1_fwd = 0;
relay1_rev = 1;
}
else
{
relay1_fwd = 1;
relay1_rev = 0;
}

but it doesn`t do anything .
Your software is entirely correct. Unfortunately the connectors on the Spikes are very finicky, so you might try plugging them in a few times. But, before you do that, I suggest taking a volt meter or an led and seeing if the fwd and rev pins are being set/unset. If they aren't, you can test it at the pin too. If it isn't working there, check with dashboard to see if your button is working and is showing up where your software thinks it should be.

-q
__________________
Electrical Engineer Illini
1024 | Programmer '06, '07, '08 | Driver '08
  #3   Spotlight this post!  
Unread 29-03-2008, 11:28
billbo911's Avatar
billbo911 billbo911 is offline
I prefer you give a perfect effort.
AKA: That's "Mr. Bill"
FRC #2073 (EagleForce)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Elk Grove, Ca.
Posts: 2,383
billbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond repute
Re: Problem in Pneumatics programming

Qbranch is correct. Your code is not the problem.

In addition to what Qbranch said about verifying the connections, you may need to verify you are connecting the solenoids correctly to the Spike.
For this code to work, you need to have the positive (red) lead from each solenoid connected to either the M+ or M- on the Spike (one lead per side). You also need to have both negative (black) wires connected to ground, preferably at the distribution block.

If the piston functions backward from your intent, swap the two red leads on the Spike, or, swap the two pneumatic lines on the valve assembly.
__________________
CalGames 2009 Autonomous Champion Award winner
Sacramento 2010 Creativity in Design winner, Sacramento 2010 Quarter finalist
2011 Sacramento Finalist, 2011 Madtown Engineering Inspiration Award.
2012 Sacramento Semi-Finals, 2012 Sacramento Innovation in Control Award, 2012 SVR Judges Award.
2012 CalGames Autonomous Challenge Award winner ($$$).
2014 2X Rockwell Automation: Innovation in Control Award (CVR and SAC). Curie Division Gracious Professionalism Award.
2014 Capital City Classic Winner AND Runner Up. Madtown Throwdown: Runner up.
2015 Innovation in Control Award, Sacramento.
2016 Chezy Champs Finalist, 2016 MTTD Finalist
  #4   Spotlight this post!  
Unread 29-03-2008, 11:40
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,590
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Problem in Pneumatics programming

Where did you put your code? The default code also messes with the relays, so if you put your code before the default code, the default code would overwrite your settings.
  #5   Spotlight this post!  
Unread 30-03-2008, 13:18
Alex_Miller's Avatar
Alex_Miller Alex_Miller is offline
2175 College Mentor
AKA: Alex Miller
FRC #2175 (The Fighting Calculators)
Team Role: College Student
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Minnesota
Posts: 78
Alex_Miller is an unknown quantity at this point
Send a message via AIM to Alex_Miller Send a message via MSN to Alex_Miller
Re: Problem in Pneumatics programming

after checking the voltage on it, also make sure that your solenoid isn't the problem either.
  #6   Spotlight this post!  
Unread 30-03-2008, 13:40
Un Luchador's Avatar
Un Luchador Un Luchador is offline
Electricity is my pastime
AKA: Gustavo
FRC #2543 (TitanBot)
Team Role: Electrical
 
Join Date: Mar 2008
Rookie Year: 2008
Location: San Diego
Posts: 22
Un Luchador is an unknown quantity at this point
Send a message via MSN to Un Luchador
Re: Problem in Pneumatics programming

Have you checked the pwm cable connection? One problem we kept getting was that the Spikes' long port between the controller had a tendency of bending the pins and sometimes slipping out quite easily. We had to resort to taping them down with electrical tape.
__________________
  #7   Spotlight this post!  
Unread 30-03-2008, 17:51
Qbranch Qbranch is offline
wow college goes fast.
AKA: Alex
FRC #1024 (Kil-A-Bytes)
Team Role: Alumni
 
Join Date: Apr 2006
Rookie Year: 2006
Location: Indianapolis
Posts: 1,174
Qbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond repute
Re: Problem in Pneumatics programming

Quote:
Originally Posted by billbo911 View Post
In addition to what Qbranch said about verifying the connections, you may need to verify you are connecting the solenoids correctly to the Spike.
For this code to work, you need to have the positive (red) lead from each solenoid connected to either the M+ or M- on the Spike (one lead per side). You also need to have both negative (black) wires connected to ground, preferably at the distribution block.
Actually, when i said FWD and REV pins I was specifically referring to the logic level (5VDC) outputs from the controller to eliminate the spike from the system at first. If you're getting the 5V signals, then you can work down the chain of command from there (5V signal -> spike -> solenoid -> piston -> mechanical action).

-q
__________________
Electrical Engineer Illini
1024 | Programmer '06, '07, '08 | Driver '08
  #8   Spotlight this post!  
Unread 30-03-2008, 18:52
Roger Roger is offline
Registered User
FRC #1153
 
Join Date: Jan 2006
Rookie Year: 1900
Location: Walpole MA
Posts: 688
Roger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond repute
Re: Problem in Pneumatics programming

Not to be contradictory -- but I guess I may be. I had to dig out our last year's pneumatic code to check how we did it. In autonomous, the routine was called with variable Position either 1 or 0:

Code:
   if (Position==1)                          //Open pinchers/release tube?
   {
      relay1_fwd= 1;                         //Pressurize to open
      relay1_rev= 0;                         //This always zero
   }
   else if (Position==0)                     //Close pinchers/pinch tube?
   {
      relay1_fwd= 0;                         //Depressurize to open (release tube)
      relay1_rev= 0;                         //This always zero
   }
The relay1_rev was always zero, and only relay1_fwd switched between one and zero. I always thought it was odd, but hey, it did work.

But another place was in user_routines.c/User_Initialization routine -- make sure your digital_io was set to INPUT:
Code:
  digital_io_18 = INPUT;  /* Used for pneumatic pressure switch. */
We also had a slightly different way with the joystick trigger, to click it each time to reverse state:

Code:
   if (p2_sw_trig != SqueezeTrigLast)           //Trigger changed state? (squeeze/no squeeze)
      {                                         //Yes:
         if (p2_sw_trig == 1)                   //...Trigger pressed
         {
            SqueezeState= 1 - SqueezeState;     //Toggle state 0 to 1 to 0
         }  
         //printf("SS=%d  fwd=%d  rev=%d",SqueezeState, relay1_fwd, relay1_rev); 
        // Part 2 Open... or... shut???   
         if (SqueezeState==0)                   //Is state to be OPEN?
         {                                      //Yes:
            relay1_fwd= 1;                      //Pressurize
            relay1_rev= 0;                      //This stays zero
            //printf ("OPEN\r\n");
         }
         else                                   //State is NOT OPEN
         {
            relay1_fwd= 0;                      //Depressurize       
            relay1_rev= 0;                      //This stays zero
            //printf ("SHUT\r\n");
         }
         SqueezeTrigLast= p2_sw_trig;           //Save trigger state for next time check
      }
This way you don't have to hold the trig button.

And yes, because programmers are always perfect, have the hardware guys make sure they did everything right.
________________________________
Every revolutionary idea seems to evoke three stages of reaction. They may be summed up by the phrases: (1) It's completely impossible. (2) It's possible, but it's not worth doing. (3) I said it was a good idea all along. RIP Arthur C. Clarke
  #9   Spotlight this post!  
Unread 30-03-2008, 21:28
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,862
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: Problem in Pneumatics programming

The code necessary depends on the type of solenoid used and the method of wiring.

The code you posted is correct for a double solenoid (two red and two black wires) if the two red wires are wired to the spike and the grounds connect to ground elsewhere.

A single solenoid has one red and one black wire going to the spike and is controlled by (as in Roger's example):
Code:
if(p1_sw_trig)
{
relay1_fwd = 1;
relay1_rev = 0;
}
else
{
relay1_fwd = 0;
relay1_rev = 0;
}
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
  #10   Spotlight this post!  
Unread 31-03-2008, 07:43
Roger Roger is offline
Registered User
FRC #1153
 
Join Date: Jan 2006
Rookie Year: 1900
Location: Walpole MA
Posts: 688
Roger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond repute
Re: Problem in Pneumatics programming

So I have to call out the "it all depends" escape clause? I'm glad I wasn't wrong -- it did work -- but I'm also glad I wasn't saying Qbranch and billbo911 were wrong, either. Now I know why relay1_rev never gets set to one. I guess this is what happens when I don't pay attention to the hardware end of the robot...
  #11   Spotlight this post!  
Unread 31-03-2008, 10:30
Qbranch Qbranch is offline
wow college goes fast.
AKA: Alex
FRC #1024 (Kil-A-Bytes)
Team Role: Alumni
 
Join Date: Apr 2006
Rookie Year: 2006
Location: Indianapolis
Posts: 1,174
Qbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond repute
Re: Problem in Pneumatics programming

*chuckle* Ok, I guess we all jumped the gun and assumed you had a double acting/double pull solenoid. Glad you got it working... now I have a question for you:

What is this mysterious piston for?

-q
__________________
Electrical Engineer Illini
1024 | Programmer '06, '07, '08 | Driver '08
  #12   Spotlight this post!  
Unread 31-03-2008, 14:37
Roger Roger is offline
Registered User
FRC #1153
 
Join Date: Jan 2006
Rookie Year: 1900
Location: Walpole MA
Posts: 688
Roger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond repute
Re: Problem in Pneumatics programming

Sorry, I meant our last year's code did work on our (Team 1153) robot. I don't know if beefy23 got his/hers to work, or what solenoid type it was. It was a loooooong weekend....
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 pneumatics problem program1 Programming 4 18-02-2008 17:35
Pneumatics Rookie Problem Squishylizard Pneumatics 4 06-02-2007 17:30
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
Pneumatics Problem + possible fix Srkasner Pneumatics 4 24-02-2004 10:39


All times are GMT -5. The time now is 18:47.

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