Home    LBP Showcase / Reviews / Recommendations    Object Showcase
#1

Analog Signal Display

Archive: 22 posts


http://lbp.me/v/xmwwgy

PRETTY PICTURES BELOW!

This level gives a brief introduction to analog signals in LBP2 and shows off a ton of uses for my device.

If you've ever done anything with analog signal computation in LBP2, you've had this problem: You want to see what the value of an analog signal is before and after you perform some simple computation, but it's too difficult to actually verify that it's working or figure out what is wrong.

Now there's an easy-to-use device that you can plug into any signal and read the decimal component!

My signal display is extremely accurate. A timer set to max = 1000 seconds with a current time = 123.4 seconds will read +.1234 on the display.

It's so accurate that I have found many occasions where the math in LBP2 is fairly imprecise! For instance, a timer with a max time set to 10 seconds and current time set to 5 seconds will not read exactly .5000. It is off by a few thousandths.

http://i4.lbp.me/img/ft/b941128d27177148e8994e3b22cbb763a51fb3ed.jpg

http://i9.lbp.me/img/ft/f79ad98e8dd53eaf791e3ff1c053897fc49255d3.jpg

http://i9.lbp.me/img/ft/64959601188f05ed6626b6a5bd9582d85da72023.jpg
2011-02-09 11:00:00

Author:
phort
Posts: 74


Awesome...this will be a huge help debugging

Question: the positive analog output of either of the thumbsticks is always .9922, whereas negative is -1. Is that an anomaly in the game engine or is my controller at fault?
2011-02-09 20:43:00

Author:
Chazprime
Posts: 587


Awesome...this will be a huge help debugging

Question: the positive analog output of either of the thumbsticks is always .9922, whereas negative is -1. Is that an anomaly in the game engine or is my controller at fault?

I had the same problem so it must be the game engine's doing. Not like that extra 0.0078 moving one direction versus the other will make any practical difference in most levels.
2011-02-09 22:05:00

Author:
phort
Posts: 74


Question: the positive analog output of either of the thumbsticks is always .9922, whereas negative is -1. Is that an anomaly in the game engine or is my controller at fault?

I'd guess it's mostly the result of a bad signed integer translation. If the analog stick gives an output of 256 possible values, they'd typically be mapped as a range between -128, and +127. If MM determine the analog value by simply dividing that by 128, then you'd get a floating point value in the range -1.0 and +0.9921875.

There is potentially more error with the iterative design used in this system, however. Other probes tend to use a single sequencer to do the translation, but this design is doing several multiplication and subtraction stages, each of which makes the next digit less precise due to the nature of floating point math. However, since it never displays more than five digits of the mantissa, it's probably negligable.
2011-02-10 01:41:00

Author:
Aya042
Posts: 2870


My signal display is extremely accurate. A timer set to max = 1000 seconds with a current time = 123.4 seconds will read +.1234 on the display.

It's so accurate that I have found many occasions where the math in LBP2 is fairly imprecise! For instance, a timer with a max time set to 10 seconds and current time set to 5 seconds will not read exactly .5000. It is off by a few thousandths.

How do you know it is the timer, and not your device, which is introducing the error? I mean, one timer-based test gives you the answer you expect, and another doesn't...

I look forward to trying this thing out. But I have to wonder how you can have four digits worth of faith in its accuracy.
2011-02-10 22:17:00

Author:
tetsujin
Posts: 187


How do you know it is the timer, and not your device, which is introducing the error? I mean, one timer-based test gives you the answer you expect, and another doesn't...

I look forward to trying this thing out. But I have to wonder how you can have four digits worth of faith in its accuracy.

I know because counters, score sensors, projectile sensors, and batteries are always exactly right, and timers are right for small values such as 0.1s / 0.3s.

You can see in the third screenshot I have a -.4200 coming from the battery which is set to -42%. I have projectile sensors, counters, and score sensor examples in the level as well.
2011-02-11 01:21:00

Author:
phort
Posts: 74


So many numbers!2011-02-11 03:29:00

Author:
DesignedJ
Posts: 57


Okay, I found what broke my (designed by rtm) sine wave producer. At least I think I found it...

Your display gave me some interesting readings with different timer values and here's some things I found out:


All the values up to 1.0s and their halves will produce the correct reading of .5000 on phort's display.
At 1.0s and 0.5s it will give a false reading of .4827.
1.2s and 0.6s gives a correct reading.
Some values (going to give only the target time) that give false readings are:




1.0s
1.4s
2.0s
2.8s
3.0s
3.8s



Going back to the sine wave... As it uses two timers, there are two components that will give a false value (as I set them both to 1.0s) which caused a little problem with the mover it was connected to. The object started to sink because of this weird little problem.

Now, I need to do some testing with some little thingamajigs...
2011-02-11 19:58:00

Author:
Unknown User


Your display gave me some interesting readings with different timer values and here's some things I found out...

Note that there seem to be some (speculatively deliberate) inaccuracies with timers which may account for these results. See this post (https://lbpcentral.lbp-hub.com/index.php?t=47951-Guide-to-Speed-Rotation-and-length-units-in-LBP2-UPDATED-SOME-NEW-INFO&p=765993&viewfull=1#post765993).
2011-02-11 20:36:00

Author:
Aya042
Posts: 2870


Thank you for this information Aya. Well, have to redo some of my logic. Shouldn't be too hard now that I know what's causing problems...2011-02-11 21:40:00

Author:
Unknown User


Just have to say this is absolutely brilliant. Thought of some other uses, like range-finding for distances to target.

Is it okay if I use a slightly modified version of your model to make a minimap with accurate distances displayed. Main change would be to reduce size. Full credit will be given (it's for my top-down space rpg, so perhaps a star system or empire named in your honour)
2011-02-19 05:49:00

Author:
SSTAGG1
Posts: 1136


Just have to say this is absolutely brilliant. Thought of some other uses, like range-finding for distances to target.

Is it okay if I use a slightly modified version of your model to make a minimap with accurate distances displayed. Main change would be to reduce size. Full credit will be given (it's for my top-down space rpg, so perhaps a star system or empire named in your honour)

Yeah, feel free to use it/change it any way LBP allows. If you need to change its look, you can convert the metal pieces on the back to invisible holograms and then glue it to something else.

You might not necessarily get perfectly accurate distances if you use tags and a tag sensor in distance mode, because, as you can see with the player sensor in the level, there's a certain range where if you're close enough it always outputs the max value. I only tested it with the player sensor but I assume it's the same for the tag sensor. You might be able to calibrate for that using some analog math, but it might not be too important if it's just going to be displayed for the user.

Send me a message on PSN or on my LBP profile when you publish the level and I'll check it out.
2011-02-19 08:32:00

Author:
phort
Posts: 74


...there's a certain range where if you're close enough it always outputs the max value. I only tested it with the player sensor but I assume it's the same for the tag sensor.

It is, but tweaking the minimum distance to 0.1 fixes it (in both cases). No-one seems to be able to explain this rather odd behaviour.
2011-02-19 11:31:00

Author:
Aya042
Posts: 2870


Hi, I'm working on a level with a 4 digit number display health bar.(it uses selectors wired up to a hologram number, much like your numbers are, minus the selector) When I saw this, I grew ecstatic because I felt like I could finally implement some accurate damage to it by using simple addition and math. I walked into the level and saw you had a math example, but since I have no idea what's going on in your + symbol microchip, I have no idea how you did this. You think you could help me understand this and implement it to my health bar? All I really need to know is how to use this "analog" signal for math purposes.2011-02-23 16:31:00

Author:
Firemac
Posts: 13


this is very interesting stuff how did you get the idea or the know how to do it?2011-02-23 19:07:00

Author:
Unknown User


I'd guess it's mostly the result of a bad signed integer translation. If the analog stick gives an output of 256 possible values, they'd typically be mapped as a range between -128, and +127. If MM determine the analog value by simply dividing that by 128, then you'd get a floating point value in the range -1.0 and +0.9921875.

There is potentially more error with the iterative design used in this system, however. Other probes tend to use a single sequencer to do the translation, but this design is doing several multiplication and subtraction stages, each of which makes the next digit less precise due to the nature of floating point math. However, since it never displays more than five digits of the mantissa, it's probably negligable.

I love your arguments! Just like rtm223, your comments always tend to make me say "wtf?" in an awesome way!
2011-02-24 01:21:00

Author:
fatman689
Posts: 54


All I really need to know is how to use this "analog" signal for math purposes.

rtm223 published a series of tutorials on analog logic which you can read here:

http://www.lbpcentral.com/forums/entry.php?2069-Analogue-Logic-1-Fundamentals (There is a link to the next post at the end of each one)

That's where I learned it.

I might later publish a level with my + - ? microchips and maybe some tutorials on analog logic.
2011-02-24 02:37:00

Author:
phort
Posts: 74


The signal display is awesome to quickly test out set ups as well as have them ingame during debugging sessions! AWE-waiiiit for it---SOME!2011-02-24 10:13:00

Author:
freak42
Posts: 43


rtm223 published a series of tutorials on analog logic which you can read here:

http://www.lbpcentral.com/forums/entry.php?2069-Analogue-Logic-1-Fundamentals (There is a link to the next post at the end of each one)

That's where I learned it.

I might later publish a level with my + - ? microchips and maybe some tutorials on analog logic.


I read up on it, it was quite interesting, but I have no idea how any of these sine waves or whatever can be used for anything in LBP2. I've taken my fair share of math, trig, calculus, so it's not like it's all foreign to me. (although I have pretty much forgotten how to do any of the math in those subjects) The one thing that caught my eye was using directional combiner as a simple subtraction device, that's not what your addition chip really is, is it? Because I was reading that you'll get an incorrect reading for negative values and so on.

But if you actually have a +, -, and a division math microchip, i'd be more than glad if you shared them. I seriously have no idea how I would be able to hook up my own to do the math.

I also couldn't help but notice that "blog" didn't go over sequencers, when I saw that you in fact did use them for your analog display, so it'd be nice if I could understand their use as well.


Edit: Oh, I did not notice that there were more blog posts. Please ignore most of what I said here. (except the sharing the chips =P) I'll be reading more.


Edit#2: Okay, i've learned a lot more since I last made this post. I may not need your chips anymore, but I would still gladly take some if you're offering just to compare what you have versus what I came up with. =P
2011-02-24 18:59:00

Author:
Firemac
Posts: 13


Awesome...this will be a huge help debugging

Question: the positive analog output of either of the thumbsticks is always .9922, whereas negative is -1. Is that an anomaly in the game engine or is my controller at fault?

I've hooked up analog control sticks to my computer before back in the days when you had to calibrate them (I think N64?) and one side was always a perfect 1 while the other (+ or -) was slightly lower, and if calibrated incorrectly it could read a +1 (full throttle) when in the center position. Might just be the way it was calibrated at the factory?
2011-03-22 17:48:00

Author:
Unknown User


I've hooked up analog control sticks to my computer before back in the days when you had to calibrate them (I think N64?) and one side was always a perfect 1 while the other (+ or -) was slightly lower, and if calibrated incorrectly it could read a +1 (full throttle) when in the center position. Might just be the way it was calibrated at the factory?

I thought that at first as well, but it did it on two other controllers as well which I thought was a bit odd.
2011-03-22 18:06:00

Author:
Chazprime
Posts: 587


If the signal display shows 0.9922 as the max, it's nothing wrong with your controller.

As Aya042 already answered, it's because the analog sticks output signed bytes for each axis. This means the possible values range from -128 to +127. Game developers can map those values however you like to decimals, and LBP2 divides by 128 to get the decimal. Thus the range is -128/128 (1.0000) to +127/128 (0.9922).

This is not an issue in games because analog sticks get unreliable as they get older, so the control programmers add inner and outer "dead zones" so that, say, everything in the range of ?0.1 gets rounded down to zero, and everything above ?0.9 gets rounded up to 1. You can see this in action if you hook a battery up to the left stick X input on a sackbot's controlinator: battery strengths below ?10% (don't remember the exact number) won't result in the sackbot walking at all, and I'm betting that there's an upper dead zone in there as well.

And anyway, the 1/128 difference is very negligible because you're not going to be performing surgery with your sixaxis. When you consider that the stick moves maybe a centimeter from center to side, 1/128 of that is less than 0.1mm, and you probably have less control than that just in the way your thumbs are wired to your brain!
2011-03-27 10:21:00

Author:
phort
Posts: 74


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.