Since you are using two double solenoids, you are going to have to wire up both sides of the second solenoid to relay 3 like you did the first solenoid to relay 2. As I only see relay3_fwd in your code and only one side hooked up in your diagram, I'm guessing that this is at least some of the problem. Otherwise, the second solenoid will never switch back to venting, and never allow the piston to move. Also, in the code snippet, relay3_fwd is never set to 1, which seems to be inconsistent with your description of what happens but does make the logic a little harder to trace.
Also, your diagram shows both positive and negative connections from the solenoids going to the relays, when if I remember correctly the correct way to wire solenoids is to have the positive go to the spike and the negative directly to ground. This way, you can control two solenoids with the same spike by connecting one to M+ and another to M- on the spike. (Yes, both positive and negative terminals can be positive at the same time on a spike. They are strange little things. See
http://www.ifirobotics.com/docs/spik...uide-sep05.pdf for a diagram and explanation of this.)
Anyways, I like what you are attempting where the piston always has pressure on both sides way more than my old design where one side vents when it is being "held" in place. So to anyone who sees this thread in the future, try this instead!
