Go to Post Ice cream is an iterative process. - JVN [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #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: 685
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
 


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 04:32.

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