|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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
|
||||
|
||||
|
Re: Problem in Pneumatics programming
Quote:
-q |
|
#3
|
||||
|
||||
|
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. |
|
#4
|
||||||
|
||||||
|
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
|
|||||
|
|||||
|
Re: Problem in Pneumatics programming
after checking the voltage on it, also make sure that your solenoid isn't the problem either.
|
|
#6
|
||||
|
||||
|
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
|
||||
|
||||
|
Re: Problem in Pneumatics programming
Quote:
-q |
|
#8
|
|||
|
|||
|
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
}
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. */ 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
}
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
|
|||||
|
|||||
|
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;
}
|
|
#10
|
|||
|
|||
|
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
|
||||
|
||||
|
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 |
|
#12
|
|||
|
|||
|
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....
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
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 |