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

Strange logic failure with pulses (somewhat solved, but not really)

Archive: 14 posts


I really don't know how to describe this. It may be due to digital loss, but it doesn't exactly seem like it.

I have a 3-input AND gate. The three inputs are:
- A selector
- A tag sensor
- A timer (no input, 10s)

The AND gate outputs into a counter (/1) and the timer reset (timer then refills to allow another pulse)

When I activate the tag, the timer resets, but the counter doesn't change. I replaced the components just in case they broke, and remade all the wire connections, but I still had the issue.

I fixed it by using a positional sequencer w/battery. The pulse does give an analog value, so the sequencer is activated, turning on the battery. This DOES activate the counter.

What I'm wondering is if a timer reset responds to analog values, whereas a counter does not. It seems strange to me that one would activate while the other would not.

Note: I also tried different methods of achieving the same end goal, but for every combination, the counter would not pulse.
2011-08-17 01:43:00

Author:
SSTAGG1
Posts: 1136


What do you mean by (/1)?

Could it be that the AND gate is resetting the timer and thus resetting itself before it has a chance to pulse the counter? You could try and see if the problem persists by placing a one shot self resetting counter between the AND gate and the timer reset. Or instead use a 0.1 second timer to be absolutely certain it's not the AND gate output which is the problem.
2011-08-17 02:28:00

Author:
Xaif
Posts: 365


i set it up as you described and it worked fine for me without the sequencer......wouldnt have a clue why it's playing up for you2011-08-17 02:34:00

Author:
evret
Posts: 612


You could try attaching a NOT gate to your timer, then into a self resetting counter that runs into your other counter (or replaces it).

Since the timer only resets when all conditions of the AND is met, then it should also only activate that second counter when the timer loses 100% signal. It seems like a bit of a workaround, but it should work...even though it adds a frame of delay.
2011-08-17 02:34:00

Author:
tdarb
Posts: 689


I also tried every timer type (count-down, count-up, power, etc), and nothing worked. Only things which took analog input (speedscale) worked. This was why I had suspicion for digital loss, but the reset activated, so I dismissed that.

Maybe it's something obscure, like the position on the MC. I have it working now, but it is slightly worrying since I use a similar pulse system (AND gate to timer reset, sounds, emitters, etc) for several other things.

(/1) means that counter max is 1.... or at least that's how I've always used it.

EDIT: Restarting LBP fixed it.
2011-08-17 04:02:00

Author:
SSTAGG1
Posts: 1136


Sorry for the double post, but I think I've isolated the cause of this glitch.

It only occurs when playing with another player. Due to what appears to be lag, the timer reset signal will be sent before the pulse to anything else is received. Using anything that relies on a full 100% signal will not work (timer, sound effect, counter, hologram, etc), but if I produce a delay by using a sequencer, that full signal is kept, and everything still works.

Strangely, a one-shot emitter still works.

Also, this occurs randomly, which is why I blame it on lag. While watching the logic system, occasionally I'll notice it pulse without anything happening as a result.

The main issue that I think is causing this entire mess comes from the use of a tag sensor. If I hold down the button which activates the tag, the first pulse randomly fails, but every pulse after that is fine. If I tap the button which activates the tag, I can produce a failed pulse much more commonly.

Again, this only occurs with another online player with you. Not sure if it still exists in play mode though.
2011-08-18 02:09:00

Author:
SSTAGG1
Posts: 1136


If you want to make absolutely sure something of consequence happens before the logic that causes it resets itself, you will have to wire it through the consequence logic into the resets. Not split the signal before the consequence logic.

In this case, wire the output of the 1-shot counter (not the output of the AND gate or the tag sensor) to the reset of the timer.
2011-08-18 09:15:00

Author:
Antikris
Posts: 1340


Yeah, that's actually exactly what I just did to fix it. I thought I'd point it out though, since it does seem to be a glitch. Depending on how much latency there is, different outcomes could occur.2011-08-18 10:30:00

Author:
SSTAGG1
Posts: 1136


I don't think it's a glitch. It's what's known as a race condition. Two tasks are running simultaneously with each trying to finish on time before the other terminates or alters its input. Under optimal conditions both tasks complete properly, but add any form of strain to any other process in the system, and it can slow down one of the "racers" ever so slightly, causing it to complete its task late.

It's not an error inherent in the programming or components of LBP2, it's more of a logic error, and can be really hard to track down or fix sometimes. These conditions can be very easy to encounter or create in LBP2 when trying to remove latency from a circuit. They can also be very unpredictable. I've had the output of a circuit change just by adding an AND gate at the end of it, so I could override the output of the chip with a switch.
2011-08-18 19:17:00

Author:
tdarb
Posts: 689


I was just playing online with another player. I tested the setup with the counter activating the timer reset. Counter outputs to: an emitter (1-shot), 3 sound effects (1-shot), a hologram (on/off), a timer (count down), and a different timer's reset (power)

The AND gate being used to activate the counter has inputs from: A selector, a tag sensor, and a timer (the one that gets reset).

The reason why I have it set up this way is because I want everything to activate the second the tag is activated. If I just use a timer to make each pulse, you need to hold the fire button (which activates a key) in order to produce a pulse.

Here's the series of events:

- I activated tag using the r1 button on a controllinator
- Tag sensor activated
- AND gate DID NOT activate (no glowing wire)
- Counter DID NOT activate
- Timer reset
- Emitter activated
- Other timer DID NOT activate
- Hologram DID NOT activate
- Sound effects DID NOT activate

I could produce this outcome almost every time. Like before, tapping r1 is a reliable failure, while holding r1 sometimes fails at first, but then works until r1 is released.

EDIT: Sorry tdarb, missed your post. I've never encountered race condition issues before, so this is new to me. Mind if I ask you to take a look, see if you can find a way to solve it.

I'm fairly certain my sequencer design from before worked, but it's just strange that the design without it only fails when playing online, and certain things activate while others do not. I don't know much about race conditions. Do different logic pieces have different conditions or something (however it's termed)?
2011-08-18 19:32:00

Author:
SSTAGG1
Posts: 1136


What you had last time should have worked. There's no reason the timer should have reset without the counter activating. That should have fixed the race condition. Judging by your description, the emitter shouldn't have activated either if the counter never cycled.

Unfortunately I can't really get online in LBP at the moment, my internet is being loads of fun and not connecting at a reasonable speed. If you could post a picture of the circuit, maybe someone will be able to better spot something.
2011-08-18 20:08:00

Author:
tdarb
Posts: 689


how have you got it set up on the microchip? i have encountered similar issues but it seems to depend on which way things are setup on the chip, for example i have had some issues with components wired from right to left, and on more than one occasion simply changing the layout to left-right has fixed it (i normally work left-right anyway)2011-08-18 20:40:00

Author:
evret
Posts: 612


Like I posted in my second post, I moved the counter down 1 spot and changed it to a count-down timer (1s), with nothing to its reset.

Before, simply moving the counter had no impact, and simply changing the counter to a the timer did nothing as well. Doing both though, moving it and changing it to a timer, seems to have fixed it.

Very strange, but at least it's working now. It worked with another online player. What worries me though is that when the count-down timer 'lit up', it was only 1/3 full. I did not see it count down from 1s. I'll need to test this with more players to see if similar issues occur.
2011-08-18 22:02:00

Author:
SSTAGG1
Posts: 1136


Bah! Turns out this issue is completely tied to lag. Was playing online with 2 other players, and occasionally it would fail (the sounds, hologram, and danger tweaker), but the emitter and timer work fine.

That design worked fine in SP (and apparently fine with 1 additional player, but that's probably just due to less lag). No matter how much lag there is, the components which don't fail will always work, but those that have failed will fail depending on latency between players.

Does anyone have any idea of how to prevent lag from ruining this system? My new plan is to put a count-down timer for each device. If this continues to fail, many of my designs will not work, since they all rely on the tag sensor activation.

Also, this was done in both play mode (published) and create mode.
2011-08-20 10:10:00

Author:
SSTAGG1
Posts: 1136


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.