Home    LittleBigPlanet 2 - 3 - Vita - Karting    LittleBigPlanet 2    [LBP2] Tutorials
#1

Mini tutorial: Applying different analogue signals to a single input

Archive: 11 posts


Applying different analogue signals to a single input based on different conditions (updated)

When you need specific outputs based on different conditions to a single element that accepts only a single input, such as followers, holograms, neons, animated materials, etc etc., you can use the following methods:

http://i1141.photobucket.com/albums/n590/hesido/Gaming/LBP2SelectingAnalogueSignal-2.jpg

Update 2: Based on Aya042's invaluable feedback, I've placed the first methods again. Method 1 is deemed to be less thermo intensive and has less latency.
2011-06-16 09:25:00

Author:
hesido
Posts: 166


For method 1, you could just keep the normal selector and replace all the XORs with ANDs (also, why the doubled wires from the selector?)

Otherwise, it looks good, and is pretty much exactly what I use.
2011-06-16 14:41:00

Author:
SSTAGG1
Posts: 1136


@sttagg1:

You are so right that it is embarrassing! What you say is the better and more sane method. The reason for this unnecessary convolution is because I first did a non-selector version of this and used it. Since analogue outputs of the conditions interfered with the actual signal I wanted to apply, I did an Xor trick. When more conditions were needed, I thought, why not add a selector to it, not remembering the fact that selector outputs are always 1.0, therefore it doesn't interfere AND gates.

Basically, those double wires were there to suppress the XOR gate when the analogue output we wanted to apply went down to 0. That was the actual trick that started this madness.

I'll have to remove / update this.
2011-06-16 16:03:00

Author:
hesido
Posts: 166


Hah, yeah, I've done that too many times to count, working on something just to find a simpler solution elsewhere.2011-06-16 16:16:00

Author:
SSTAGG1
Posts: 1136


There is an alternative to this that I see many people use as well: a positional sequencer with batteries on it, led to an OR gate. Both are valid methods but what sets them apart is that a selector is very practical for processing separate false/true signals while the sequencer does great when the incoming signal is an ana.log one (i.e. a counter, timer, battery, strength tag sensor, etcetera).

Pick your method depending on the nature of the incoming signal.
2011-06-16 17:18:00

Author:
Antikris
Posts: 1340


Hi guys,

It turns out, my crazy XOR setup with an inverted selector wasn't so crazy after all, it is the one I removed, method 1 seen below:
http://i1141.photobucket.com/albums/n590/hesido/Gaming/LBP2SelectingAnalogueSignal-2.jpg

I stumbled upon a bug(???!) when using a normal selector coupled with AND gates, the AND gates made the incoming signal positive, so negative signals were made positive on certain conditions. So either the chip activation, or the XOR setup would be the way to go if negative analogue values will be involved.

Is AND making negative signals positive (on certain conditions) by design,or is it a bug?? I have a test object ready and I can post it to anyone who is willing to test it.
2011-06-27 22:47:00

Author:
hesido
Posts: 166


...negative signals were made positive on certain conditions.

Despite what rtm's blog (http://www.lbpcentral.com/forums/entry.php?2069-Analogue-Logic-1-Fundamentals) claims...



Inputs | AND / | OR /
a | b | min() | max()
------------------------------------
100 | 35 | 35 | 100
50 | 65 | 50 | 65
50 | -10 | -10 | 50
-50 | 30 | 30 | -50
-45 | -60 | -45 | -60
0 | 100 | 0 | 100
0 | -100 | 0 | -100


...that is, that the sign of the output from an AND gate matches the sign of the lowest (absolute) input, it seems instead that the sign of the analog output is equal to the product of the two signs of the digital inputs, such that...



a | b | a AND b
------+-----+---------
+ve | +ve | +ve
+ve | -ve | -ve
-ve | +ve | -ve
-ve | -ve | +ve


...so the two figures highlighted in red in the first table both have the wrong sign, assuming the digital sign matches the analog sign, where digital zero counts as positive.

Thus, using an AND gate to relay an analog signal is prone to failure when the analog sign doesn't match the digital sign, which can be a pretty common occurrence.

From a few experiments, it seems the three-input XOR solution works in all cases, is probably marginally cheaper on the thermo than the typical solution of using a Microchip as a relay, and avoids the signal latency problems you would usually encounter when enabling a Microchip.



...by design,or is it a bug??

Probably neither - it most likely falls into the category of undefined behavior.
2011-06-28 17:12:00

Author:
Aya042
Posts: 2870


Aya, are you sure you're not some supercomputer masquerading as a human? Seems you have an answer for just about everything regarding LBP.

Also, now I feel like an idiot, suggesting a flawed design.
2011-06-28 17:43:00

Author:
SSTAGG1
Posts: 1136


...that is, that the sign of the output from an AND gate matches the sign of the lowest (absolute) input, it seems instead that the sign of the analog output is equal to the product of the two signs of the digital inputs, such that...


That is seriously a very important piece of information!

The situation with me is still a bit weird, tho, I'll revert to my XOR's indeed, but I'd like to send you my test object that is connected to a controllinator, if that is possible.

@SSTAG1:
You couldn't have known, that was the common knowledge. Actually, I should have felt like an idiot for feeling like an idiot the first time Somehow, my "leave the desired signal completely alone using XORs" approach was the better method, it turns out..
2011-06-28 18:00:00

Author:
hesido
Posts: 166


...I'd like to send you my test object that is connected to a controllinator, if that is possible.

Not sure it's necessary - I tested with all combinations of analog and digital signs. The Controlinator is one of those which can easily give you a negative analog sign with a non-negative digital sign.

There's a couple of really useful tools here (https://lbpcentral.lbp-hub.com/index.php?t=44113-Logic-Probe-and-Signal-Combiner), which allow you to combine arbitrary analog/digital signals, and view the values/signs after feeding them through various logic gates.
2011-06-28 18:35:00

Author:
Aya042
Posts: 2870


Thanks Aya for the headsup.

Edit:
I just checked the probe, and the problem indeed is the digital sign. Until you hit about 75%, the analoge stick does not relay the digital negative, thereby making the combination a positive, like your table says.
2011-06-28 19:09:00

Author:
hesido
Posts: 166


LBPCentral Archive Statistics
Posts: 1077139    Threads: 69970    Members: 9661    Archive-Date: 2019-01-19

Datenschutz
Aus dem Archiv wurden alle persönlichen Daten wie Name, Anschrift, Email etc. - aber auch sämtliche Inhalte wie z.B. persönliche Nachrichten - entfernt.
Die Nutzung dieser Webseite erfolgt ohne Speicherung personenbezogener Daten. Es werden keinerlei Cookies, Logs, 3rd-Party-Plugins etc. verwendet.