07-26-2021 06:44 AM
Hi
I have a laser distance sensor, which is measuring the distance of a free falling and then rebouncing object. The sensors range is 300mm (from 50 to 350mm). Is there a way how I can set the signal, when the object is outside of the sensors range, to the upper range (350mm) instead of the lower (50mm)?
Right now when the object approximates from outside of the sensors range, it jumps up to 350mm as soon as it enters the sensors range, stays there a while and then continues its way down (see attached image). The reason I want to change it that way is, that I can derivate the position signal to the velocity and atm these jumping peaks prevent me from doing that correctly.
Thanks in advance!
Michael
07-26-2021 08:22 AM
Would code like this work?
which results in behavior:
07-26-2021 08:24 AM
By only watching at the program graph , we can guess that the usable data are those for which 50 < pos < 350.
It's by no means clear why the signal lingers on 350 so long. Whatever the reason, deriving in those regions is useless.
07-26-2021 08:50 AM
07-26-2021 09:31 AM - edited 07-26-2021 09:37 AM
@GerdW wrote:
what about a simple MinMax function instead of the FOR loop, the Select and the comparison before? 😄
You might have to show us what you mean. I am not getting your hint.
07-26-2021 09:35 AM - edited 07-26-2021 09:50 AM
EDIT: message removed
07-26-2021 09:39 AM
07-27-2021 02:51 AM
Thank you all for your quick responses!
dsb@NI wrote:
Would code like this work?
which results in behavior:
Sounds like a great solution!
The only challenge now is, that I get the message "Not enough memory to complete this operation".
Guess that's because of the sampling frequency of 5kHz.
Does the implementation of a producer/consumer loop solve this or do you may have any other suggestions?
Michael
07-27-2021 03:15 AM
Hi Michael,
@Michael_Jr wrote:
The only challenge now is, that I get the message "Not enough memory to complete this operation".
Guess that's because of the sampling frequency of 5kHz.
Does the implementation of a producer/consumer loop solve this or do you may have any other suggestions?
Suggestion: attach the current state of your VIs…
Implementing a producer-consumer scheme will not solve "out of memory" problems magically!
A sample rate of 5kS/s is not that high, many people before you could handle the data without running into memory problems…
07-27-2021 10:20 AM
~40 s * 5000 S/s is only ~200000 samples. I would not expect this data to bog down a modern computer. As @GerdW suggests, share your code (with acquired data in a constant or saved as default in a control).