Besiege

Besiege

Logic extensions mod
Dark May 15, 2021 @ 3:04pm
Steering Hinge FPIO bug?
Hello,

I've been playing with this a bit in a project I'm working on. I actually think I'm pushing this mod to it's limit (since I need 10 separate code blocks to do what I need).

In the description on the mod page, it mentions how the difference between left and right will determine the angle of the steering hinge (with Auto Return + Limits).

I was able to observe this behavior by setting the limits on each side to 55º (an effective 110º total), and use the code block to increment the value of the left and right arrow.

Specifically, I was doing 0.1 increments, where the left arrow is the value, and the right is the inverse, so specifically:

// pid00 = LeftArrow // pid01 = RightArrow let angle = 0; let down = false; function start() { out(0, angle); out(1, 1 - angle); print(`${angle} - ${down}`) angle = down ? angle - 0.1 : angle + 0.1; if (angle > 1 || angle < 0) { down = !down; angle = angle > 1 ? 1 : 0; } setTimeout(0.25, start); } start();

I was able to confirm through the console that the values are correct, so the logic for this code is certainly working.

However, when the LeftArrow gets to 1 and starts to go back down the 0, the steering hinge doesn't follow. It seems to get stuck.

If it helps, here is a gif of the issue[i.ibb.co].

Is there anything I'm doing wrong? Is there anything else I can try?

I would love to get this working because I have identified that this FPIO behavior of the Steering Hinge is exactly what I need to get my project working properly.
Last edited by Dark; May 15, 2021 @ 3:27pm
< >
Showing 1-4 of 4 comments
Dark May 15, 2021 @ 7:25pm 
So just for fun I decided to try another test, where I simply swap the two like this:

function wide() { out(0, angle); out(1, 1 - angle); angle = angle == 0 ? 1 : 0; setTimeout(0.25, wide); }

...and it worked fine.

Tried it again with 0.5 set to RightArrow (pid01):

function wide() { out(0, angle); out(1, 0.5); angle = angle == 0 ? 1 : 0; setTimeout(0.25, wide); }

...and it also worked.

So I'm not sure what is going on here. Is this a bug? Or did I write something wrong?
Dark May 15, 2021 @ 8:16pm 
Alright, another test, which is closer to my goal. But now it's failing again.

This time, I created a while(true) loop with asleep() so it will fire every tick. And then, I have a UTC timestamp which allows me to toggle it based off real time while pumping up the physics speed to 200%.

No matter what I do, with this 1000 ms delay added to "lastFrame", it wont move the block. If I remove the delay, it will go to the default 0 position once the sim starts, but then nothing after that.

I am logging the condition at 200ms (5 fps), and it is working. It is even properly setting the LeftArrow to 0 and 1 with every switch. It's only the steering hinge that isn't listening and failing.

let angle = 0; let lastFrame = Date.now() + 1000; let playing = true; const fps = 5; while(true) { const currentTime = Date.now(); if ((currentTime - lastFrame) >= (1000/fps)) { print(`${currentTime - lastFrame} >= ${1000/fps} - ${in(0)}`); out(0, angle); out(1, 0.5); angle = angle == 0 ? 1 : 0; lastFrame = currentTime; } asleep(); }
Last edited by Dark; May 15, 2021 @ 8:31pm
Lambda  [developer] May 21, 2021 @ 12:24pm 
Hello, sorry for late reply.
Could you please upload machine file somewhere, so I can make *exact* reproduction of the issue?
Lambda  [developer] May 21, 2021 @ 12:51pm 
Nm, I've reproduced it by myself using your gif. The reason was that the steering hinge itself is locked by pin. This issue should be fixed now.
Last edited by Lambda; May 21, 2021 @ 12:52pm
< >
Showing 1-4 of 4 comments
Per page: 1530 50