I have provided an example. The top box and piston are first connected to each other and then made into a group. The bottom box is then attached to both the bottom piston and the top piston. This can get cumbersome but one can nest probably 5 deep to theoretically allow control of rotations as well as tranlations.

double piston