PDA

View Full Version : Variable Length Pistons (Stops at different locations)



comphermc
09-07-2009, 03:00 AM
I was asked by holomcamp if it was possible to make a piston extend a certain amount, then stop. Then extend a certain amount, stopping a bit later [lather, rinse, repeat]. I figure that it would make more sense to make a new thread here than to explain it in an unrelated thread.

It's not very easy to make a piston extend to different length intervals by itself, as it would involve timing the piston out (which doesn't work so well, as they automatically resync when turned on and off).

Solution: combine winches and a piston.

This type of solution was pioneered by our very own rtm223, so you can thank him for most of this. I don't think he has done this particular method, per se, but I'm sure he'll be making an appearance in this thread.

The setup:

http://img4.imageshack.us/img4/4618/lengths.jpg

The idea is that a strong winch will overpower a weaker piston, which can be used in conjunction with the idea that winches cannot push outwards, but pistons can.

In this diagram, we have a stiff piston set to strength 5.0 and a max length of [say] 15, and a min length of 0. Also attached to the same piece of DM and cardboard are two winches, each of strength 10, but one has a minimum length of 10, and the other has a minmum length of 5. Both have a max length of 15 [or longer].

Next, put a directional grab switch anywhere that is not grab-able, such as the chunk of DM shown in the picture. Invert it and wire it to the piston. The piston is now always pushing outward, and will do so when allowed.

Next place two arbitrary directional two way switches on the ground (these will simulate your inputs for whatever you are using this for). Invert both of the switches and wire them to the winches (one goes to the longer winch, the other goes to the shorter one).

When neither of the winches has been activated , the piston is free to push outward to its maximum length of 15, as shown as object A.

When the longer winch is triggered, however, it will overpower the piston and pull the block into its minimum length of 10. The other winch has no effect since it cannot push outward. You will have a situation as shown as object B.

When The shorter winch is triggered, it will likewise pull the block even closer to its minimum length of 5. This winch has precedence over the the longer one, as it has a shorter minimum length. You will now have a situation as shown in as object C.

------------

If you would like the piston to extend at each stage, just run it in reverse. Deactivate the short winch and it will extend to length 10, as "ordered" by the long winch. Deactivate both winches and it will extend the full length of the piston.

------------

This method can be used with platforms as well, but it will take additional tweaking to ensure the piston is strong enough to push the platform (its strength can be increased slightly, but do not set it too close to 10).

The basic idea is that the stiff piston forces the movement into uni-directional motion, so the winches can act as if they were stiffened. You can likely extend this technique to as many winches/lengths as desired.

[B]Side note: This method is used nicely in the upcoming level from Phife211. Keep an eye out.

Thanks.

Side note 2: I might as well say it now before rtm tries to correct me, but it's possible to make the setup shown with a piston and a single winch. The difference would be that the piston receives one of the directional inputs, rather than a permanent out [via grab switch]. I put it this way because it's probably a bit simpler to understand. If you would like to know more about that, ask me privately.

BassDeluxe
09-07-2009, 03:11 AM
Yeah, I used the strength setting a lot in my boss level, it's possibly one of the most underrated settings in the game. Great post, this is sure to help lots of people.

halomcap
09-07-2009, 04:32 AM
Wow that's awesome, thanks. :D

rtm223
09-07-2009, 08:46 AM
This type of solution was pioneered by our very own rtm223, so you can thank him for most of this. I don't think he has done this particular method, per se.

Think again :p I tried to make a prioritised inputs device (which was iffy) semi-reset timers, it's great for variable speed control and it's pretty much the main mechanic in the project I'm working on ATM (doors and elevators that lift to half way when at half power). It also works nicely with wobble bolts and motor bolts - try it for complex angular positioning of creature limbs etc. I would be interested to know how many inputs you've managed to get working properly though. On my prioritised inputs device I think I found after about 4 or 5 it started behaving weirdly, but then I was trying to get everything switching perfectly in 0.1s



Side note 2: I might as well say it now before rtm tries to correct me, but it's possible to make the setup shown with a piston and a single winch.

Yup. It does come with the issue that the piston must have the longest length though, therefore needs to either be slow, or needs to be very weak. Probably best to avoid unless it's something very simple.

.

comphermc
09-07-2009, 11:17 AM
Think again :p I tried to make a prioritised inputs device (which was iffy) semi-reset timers, it's great for variable speed control and it's pretty much the main mechanic in the project I'm working on ATM (doors and elevators that lift to half way when at half power). It also works nicely with wobble bolts and motor bolts - try it for complex angular positioning of creature limbs etc. I would be interested to know how many inputs you've managed to get working properly though. On my prioritised inputs device I think I found after about 4 or 5 it started behaving weirdly, but then I was trying to get everything switching perfectly in 0.1s

Ah, well, I stand corrected. I haven't actually done this, but it would obviously work. I'll see how many it works with sometime later today. Doing this with wobble/motor bolts seems like a nightmare...

[OP edited]

BSprague
09-07-2009, 12:11 PM
I use something like this in my Key Room. A block of emitters moves from slot to slot using almost that exact configuration after each grab input from the player. It does work great and you nailed down the explanation. :)

Night Angel
09-07-2009, 04:00 PM
I need try this soon. Need a bit of easy logic...

comphermc
09-07-2009, 08:44 PM
Update: I tried it with 5 different lengths and didn't have any problems. The timing of each of the pistons/winches need to be tweaked as desired, though. I can't imagine needing more than 5 different lengths, but I'm confident that it would work regardless.

thefrozenpenquin
09-10-2009, 12:35 PM
i love this stuff. i love getting on and seeing some new concept i haven't thought of or seen. i tried to duplicate it without reading, just the idea you kno, and was tinkering around for 20 minutes. then i figured i would just read how you do it and had a moment where it seemed so simple when you kno the answer.

goldenclaw13
09-10-2009, 02:48 PM
Idea on a how a vertical platform could work(Regarding Comphermc's comment on a pistons strength setting):

Perhaps, a platform, could be suspended from the piston and winches. The winches at strength 10 should be able to keep sack boy and the platform extended, no?

But this is awesome, I should have to try this when I get the chance :D

rtm223
09-10-2009, 04:09 PM
Perhaps, a platform, could be suspended from the piston and winches. The winches at strength 10 should be able to keep sack boy and the platform extended, no?

Remember that the piston will be pushing against them. Assuming your piston will be at strength 5, then add gravity into the equation and you winch @ strength 10 will have seriously reduced strength.


Another method of achieving this is to use a 0 strength, stiff piston. This will hold alignment and fix minimum and maximum position. You can then use winches to do all of the movement. You can get some really complex movement patterns, variable speeds etc. if you do this.


.

Memodrix
09-11-2009, 04:13 AM
Wow. this seems almost stupidly simple to do compared to some of the stuff i was failing a.......trying.:cry:

now to remember what I was doing that i could use this with.:idea:

rtm223
09-14-2009, 09:21 AM
More notes on this technique:

Because you are dealing with weaker connectors, you can end up in a scenario where you get a bounce effect, especially if the winch is pulling in to fast (the pushing out effect of the piston is to weak to stop it dead).

You can use connectors in pairs to give you up to strength 20 (or in triplets to get strength 30, etc. I'm sure you can do the maths :p) if you are finding the strength is not high enough.

KlawwTheClown
09-19-2009, 01:21 AM
Ah yes, using winches to overpower pistons...

That's almost like what I used in my 10-way "OR" gate...

http://i704.photobucket.com/albums/ww46/644Klaww/LittleBigPlanet/APhoto_1.jpg

As you can see, it uses winches to pull a key to a switch, with the assistance of a stiff spring...

I never thought of overpowering a piston before... :D

comphermc
09-19-2009, 02:40 AM
Ah yes, using winches to overpower pistons...

That's almost like what I used in my 10-way "OR" gate...

http://i704.photobucket.com/albums/ww46/644Klaww/LittleBigPlanet/APhoto_1.jpg

As you can see, it uses winches to pull a key to a switch, with the assistance of a stiff spring...

I never thought of overpowering a piston before... :D

That is almost exactly rtm's design for flexible AND and OR gates. Just replace your spring on the left with a weak piston on the right and you are all set. It also doesn't require you to put a frame all the way around the logic. There's not much need to make the pistons and winches longer than 5 units as well.

rtm has a thread about that here: Link (http://www.lbpcentral.com/forums/showthread.php?t=10537)

KlawwTheClown
09-19-2009, 03:51 AM
That is almost exactly rtm's design for flexible AND and OR gates. Just replace your spring on the left with a weak piston on the right and you are all set. It also doesn't require you to put a frame all the way around the logic. There's not much need to make the pistons and winches longer than 5 units as well.

rtm has a thread about that here: Link (http://www.lbpcentral.com/forums/showthread.php?t=10537)

Wow. :eek:

On the LittleBigWorkshop, nobody ever brings up stuff like that! (I think that's why I don't see how that's an AND gate.) :blush:

I have a feeling I'm gonna like using 2 LBP forums... ;)

Okay enough of this discussion, don't wanna get off-topic. :)

comphermc
09-19-2009, 01:50 PM
That's not terribly off topic. The idea to turn that design into an AND gate is to invert your key switch and every one of the winches/pistons so that the key is triggered when the whole thing is extended, which only occurs when all of the inputs are TRUE/ON.

rtm223
09-19-2009, 02:05 PM
I should probably go back and update that thread with an update on the reduced thermo versions of those gates.


how it's an AND gate is simple. Take an OR gate and invert all of the inputs and the output.

OR gate:


.
Winch Input | Piston Input || Output |
--------------|------------------||------------|
FALSE | FALSE || FALSE |
FALSE | TRUE || TRUE |
TRUE | FALSE || TRUE |
TRUE | TRUE || TRUE |
------------------------------------------------
.


Now if we take invert all the inputs and the output (turn the TRUEs to FALSEs and the FALSEs to TRUEs) we get:



.
Winch Input | Piston Input || Output |
--------------|------------------||------------|
TRUE | TRUE || TRUE |
TRUE | FALSE || FLASE |
FALSE | TRUE || FALSE |
FALSE | FALSE || FALSE |
------------------------------------------------
.

And it should be clear that thatís an AND gate (output TRUE when both inuts are TRUE

robalabob
09-21-2009, 11:40 AM
love the ideas brewing here and like many sackpeople i too have neglected the strength tool for pistons and such. that is why, tonight i shall be playing around with strengths of a number of items tonight to research new actions that the strength tool will bring.

this is a setup i used in a level that produces a stepping action for a singular shelf. the times can be changed to suit your needs but if you want it to be a clean action, you have to sync the 2 pistons so that when the larger piston reaches its length limits it will stop and start the reverse action cleanly. it will still work if you dont do this but wont look as nice.

Crashdance22
09-26-2009, 09:33 PM
This is great! I can use this for a tour platform-like mechanism that stops at certain points and resumes!

coyote_blue
11-16-2009, 01:08 PM
Making a three-floor elevator at the moment. It has a DM "base", up top. Three stiff/str10 pistons run down to a metal block as wide as the shaft. Three more identical pistons run from the block to the elevator car. The entire length is somewhere around 350.

Anyway, I used the magic of Logic Pack to gin up a switchboard that was floor-sensitive: Top floor=both piston sets contracted; mid floor=one in, one out, so on.

Problem is, it behaves strangely. Though I'm constantly checking the shaft for "bumps," there's enough torque to make the elevator car "wobble" and bang into the sides of the shaft as it goes up. If the car is as wide as the shaft, it catches on the sides (specifically, where the car passes the opening on the second floor when moving straight between 1 and 3) about 5% of the time. If I try narrowing the car so there's a 1-square gap between car and shaft, it gets crazier. The whole car cants to a 20-degree-angle when first starting out, and occasionally hits a side hard enough to rip the car off the pistons.

I'm sorry if this seems off topic, but I'm debating switching to the rig you've got here. How would I counteract gravity in my case, as you discussed earlier? Should I just add EVEN MORE pistons to my current rig? Is the 10-strength pulling the car too hard?

rtm223
11-16-2009, 02:28 PM
Make sure you're always using 1 piston and the rest are winches, as per the examples here. Set that up and see how it goes. The piston should be a lower strength than the winches and all should move at the same speed (i.e. total distance / time should be constant).

If you find that the system doesn't have the power to move properly, you can always start doubling up. Make the piston strength 10 and use 2 strength 10 winches, with the same settings, at each position. That should give you plenty of power.

coyote_blue
11-16-2009, 11:35 PM
Thanks. As the car is 3-fat, I'm also considering adding a DM thin-layer "guardrail" on the sides, to prevent the car from catching in the gaps.

Will try purely your answer first...but it'll be aggravating to revise all the lovely, freshly-jiggered logic in my original design.

comphermc
11-16-2009, 11:45 PM
As long as you use a single piston, you shouldn't be getting any torque issues. The magic of LBP's simulated physics is that winches don't apply torque to pistons, but they do provide translational force. What you can do instead of worrying about the strength of the piston would be to just not use its strength at all. Set it to zero strength, but leave it stiff, so it forces the direction in one motion. Then, use only winches to do the pulling. If you're still having problems, it can't hurt to slightly shrink down the car so that it has no chance of rubbing on the walls. The grid is nice, but it's not absolutely perfect - these problems of sticking are exacerbated by slow speeds.

And, yes, as rtm states, make sure that your winch speeds are constant. Set up the speed of the shortest one, and expand the other speeds based on how much longer they need to travel. For example, if you have a winch pulling up 40 units, another winch pulling up 80 units, and third winch pulling up 120 units, your timings should be as follows*:

40 units - 3 seconds
80 units - 6 seconds
120 units - 9 seconds

*As an example. Hope that helps.

coyote_blue
11-17-2009, 01:02 AM
Good to know. I used the modified version you spoke of up top - 1 piston, 1 winch. Winch was set to "2nd floor and 3rd floor", piston set to "1st floor and 3rd floor". After re-examining my diagram for the new setup, turns out I needed only 3/4 of the OR switches I used in my original design (since the winch only pulls one way).

Strangest thing happened - when switching manually (sending Sackboy in to pull temporary levers), 10 winch strength to 8 piston strength worked perfectly. Once I connected the logic - which shouldn't have mattered - the elevator would only stop at the 2nd floor on the way DOWN. I tweaked the piston down to 6, and it worked...but it slows down now, moving more slowly when it's "just the piston" moving outward from 2 to the bottom. This doesn't seem like it's obeying gravity...

But whatever, the wobble's gone, right? I'll ride the sucker another zillion times before I publish and make sure. Given some other weird behavior in the level - decorations disappearing after saves, a magnet switch that is visible, but does not exist - I'm just praying my profile survives till v. 1.21.

Rogar
11-18-2009, 09:26 AM
The magic of LBP's simulated physics is that winches don't apply torque to pistons, but they do provide translational force.

That sounds really interesting and useful to know. Too bad I don't understand what it is saying. Mind explaining it to those of us less proficient in technical english? :confused:

I suppose the player tracking device does work with three pistons because it is small and light?

rtm223
11-18-2009, 09:51 AM
@rogar: Having a piston connected to dark matter and set to stiff will force all movement into a straight line. If you add winches either side of the piston, you might expect a twisting or rotation of the end piece, but the piston keeps it in check and forces all movement into 1 dimension.

The player tracker would actually work with heavy objects - it moves with a strength of around 15. The three pistons are in parrallel so all movement is confined to 1 dimension and the forces applied by the pistons just get added up. That's why you need a break (piston controlled by the grab switch). If one piston is pushing out at strength 10, and the other is pulling in at strength 10, you get an overall force of 0... without the break there would be no resistance force to make the tracker stop.

coyote_blue
11-18-2009, 01:18 PM
@rogar: What I learned from all this was, along those lines: avoid using multiple pistons just for show. If you've got multiple pistons moving an object, and they're not EXACTLY the same length, or the thing they're glued to/moving isn't perfectly straight, those pistons WILL impart what I called torque, or more technically, Wobble Force.

Since two pistons might glue themselves to the same object slightly differently (making them not the same length), and tweaking can't always fix that issue, start with one piston. Don't add more unless you're sure your machine won't work otherwise...and then, try extra winches first.

rtm223
11-18-2009, 02:39 PM
@rogar: What I learned from all this was, along those lines: avoid using multiple pistons just for show. If you've got multiple pistons moving an object, and they're not EXACTLY the same length, or the thing they're glued to/moving isn't perfectly straight, those pistons WILL impart what I called torque, or more technically, Wobble Force.

If you are working in the grid, then you can be pretty safe on the multiple pistons in parrallel, because you can trust them to be parrellel. Also, if using connectors purely for show, tweak them to be strength 0 and increase the max min lengths beyond what you need.

coyote_blue
11-19-2009, 12:08 AM
The very instant AFTER I make something/run two things parallel, grid stays true. Absolutely. But I've had pistons "sink" into material; I've had grid-built objects cant slightly off grid, so on. I know that building in pause is the cure for this, but unpausing to test ANYTHING can have unexpected results, and I'm bad at noticing subtle "tectonic shifts" until it's way too late to go back.

For this elevator, I once ran two pistons in parallel from one grid-horizontal surface to another grid-horizontal surface, and made sure they were parallel. But when I tweaked stiffness, both max lengths were different. RAGE, I say.

So for me, that "cosmetics set to 0/useless" is really good advice. Thanks! Now, if you can just PM me which thread to go to for "maintaining grid-trueness in levels"...that way, I could keep this thread on topic. :P

claptonfann
11-29-2009, 07:46 PM
I'm trying to use this technique for a mechanism I'm working on, but I'm having trouble with the winches.The goal is to make the movement more controlled than a simple 3-way switch.

The mechanism is fairly simple:


|-----|-winch--|-----|
| |-winch--| |
| DM |-winch--| |
| |-winch--| |
| |-winch--| |
|-----|-piston-|[key]|

|DM|-piston-[key]
[switch]__[switch]__[switch]__[switch]__[switch]
[switch]__[switch]__[switch]__[switch]__[switch]


The winch gate on the top is intended to stop at each switch (5 positions).
The key on the single piston activates the top row of switches, which activate the winches. The key on the winch gate activates the second row of switches, which activate arbitrary outputs (ex: sounds, lights, etc). The max length for ALL connectors involved in this design is 28 units. The minimum for the piston gate is 8 units, and each position for the winch gate is 5 units more than the last one (8,13,18,23,28).

I've been fiddling around with inverting switches, making connectors backwards, placing the "origin points" for the connectors on the dark matter or the cardboard. It's giving me a real headache :(

comphermc
11-29-2009, 08:29 PM
I'm sorry, but I'm not sure I understand the problem. It seems as if you are very close to whatever you are trying to accomplish, but I'm not sure exactly what it is. Please excuse me if I am being dense - I'm slow sometimes...

What are the inputs? External switches?

What are the outputs? Lights?

:)

claptonfann
11-29-2009, 10:30 PM
* Input for the piston gate (on the bottom of the diagram) is a grab switch set to on/off.
* Output for the piston gate is the 5 winches in the winch gate (on the top of the diagram)

* Input for the winch gate is the piston gate's output (the top row of switches)
* Output for the winch gate is arbitrary (lights, sound, etc)

I thought I might need to add to the other side of the winch gate (more winches on the right side) so that it would stop EXACTLY above its intended switch. When I hook everything up as shown, the winch gate seems to perform as intended, but it extends out to the end of the row of switches briefly before stopping at any of the 5 positions that it's supposed to.

Connector specs are as follows:
Maximum Length: (all) 28 units
Minimum Length:
top winch: 28
second top winch: 23
middle winch: 18
second bottom winch: 13
bottom winch: 8
piston: 8
Timing: (all) 0.1 sec
Pause, Sync: none
Stiffness of piston: yes
Backwards: .....I'm trying combinations on that part
Flipper Motion: none
Visible: doesn't matter, really

rtm223
11-29-2009, 10:37 PM
*it extends out to the end of the row of switches briefly before stopping at any of the 5 positions that it's supposed to.

Do you mean it overshoots? Like goes too far in the direction it is moving and then comes back, or is it always going outwards and then coming back?

claptonfann
11-29-2009, 10:42 PM
Yeah, it overshoots. It ZOOMS out to the end of the row at each activation, then goes back to where I want it to: right above the next switch in line.

rtm223
11-29-2009, 10:57 PM
Lol, still not 100% on this. Say it is moving left, and outwards (i.e away from the darkmatter), is right...

If it shoots all the way out to the right and then comes back, then you have a dead zone in between the magnetic switches - at certain points none of them are active so the piston overrides them. Make the detection areas overlap. When you are in the overlap area, the shorter of the two winches will take precedence, which should be fine and predictable.

If it shoots all the way to the left and then comes back, then you have an issue with momentum. This will be a little tricky to acocunt for. You can slow things down, which may not be acceptable, try shortening the gaps to 2.5 (which is one small grid square), or the winches on both sides solution might work.

claptonfann
11-29-2009, 11:02 PM
Also, some things to consider (and to properly assess the problem) .3.;

All of the connectors originate from the dark matter and not the cardboard.
The piston, appropriately, has half the strength of the winches.
The angle radii of the top row of switches, I think, is around 20 or 30 (maybe even 40) for each one.

I'm thinking if it still malfunctions, something must be wrong with the top winch. It might not be necessary. I dunno. Thoughts?

It's not shooting to the left, it's going to the right. And on the return trip from the end of the row (extended all the way to the right), it's also a bit wonky.

rtm223
11-29-2009, 11:06 PM
Yes, the top winch in not needed. Technically the bottom winch is not needed either, you can attach the input to the bottom winch to the piston and it should all still work fine.

Have you checked for any dead-zones? Try slowing the piston gate piston right down and watching to see if there are any points where no switches are active.

claptonfann
11-29-2009, 11:09 PM
...attach the input to the bottom winch to the piston
Attach the what to who? :S lol

Yeah, I make sure that each switch light comes on by slowing every connector down to 4.0 sec rather than 0.1 sec. I could check for dead zones again once I go back in there.

EDIT: It doesn't need 5 winches to stop at 5 locations? :O Cool!

comphermc
11-29-2009, 11:22 PM
Right, the piston can have an input wired to it instead of the bottom winch. Just set the minimum for the piston to the desired minimum length of the set.

Are the timings for each of the winches different? The "longer" ones should have a longer time setting. I'm going to go try and replicate your design real quick, and see if I can't figure out what the issue might be.

Be back in a bit.

rtm223
11-29-2009, 11:23 PM
3 winches to stop at 5 locations. The piston does the other two. Connect whatever activates the shortest winch (leftmost magnetic switch in your case) to the piston, and delete that winch. Also delete the longest winch and the magnetic switch that controls it.

Set all winches and the piston to backwards. When nothing is activated, all extend and the piston controls the max length. When a winch is retracted it will overpower the piston. When the piston retracts it goes to the shortest point. Probably easier to see in create mode than in text.

You might want to also try... thank god for live topics... you might want to try what comphermc just said.

comphermc
11-29-2009, 11:28 PM
Well, shoot. It seems Leerdammer is live now (I'm downloading now). If you add me, I can probably work on it with ya.

:)

claptonfann
11-29-2009, 11:30 PM
I think I already added you, comp. But wait...do you live in the UK? If so, then it must be Monday already there. It's still Sunday here in the states...But if rtm goes onto LBP as well tonight, it'll be a blast with the three of us :D

Anyway, like I said, all connectors in the winch gate are 0.1 sec.

lbpholic
12-03-2009, 11:15 AM
that tutorial was really helpful thank you so much!!!