LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calculate Maximum Difference of all Values in an Occupancy Cell

Hi,

 

I wasn't quite sure how to phrase the question so I'll give a little bit of back ground. I'm mapping the X, Y, Z coordinates of returns from a LIDAR sensor onto a 2D Occupancy Grid (I can do that successfully). The array of all LIDAR returns is 3 x L (where L is the number of returns in a LIDAR rotation, typically around 18,000). So far I've been mapping the returns by changing the cell value at each X, Y point by using these as the indices and essentially ignoring Z. 

 

What I would like to do, is find the maximum difference in Z for all returns within a given cell. For example, each occupancy cell in my grid (a 200x200 cell grid) represents a 0.25mx0.25m area, so any XY pair that falls within 0-0.25 are all mapped to the same cell. Not a problem, as it just enqueues the same value change. 

 

What I would like to do is change the value of each cell to the maximum difference in Z for all returns within that cell, i..e |Zmax-Zmin|. This is for filtering purposes later, I have attempted this in two VIs, the first of which is the simple process I have implemented for finding this value from a simple array. The second VI is my attempt to implement this method to set the value of each cell in a large array. In this version, I incrememnt the range of X and Y I am searching for by "Cell Size" using the iterations of a nested loop to scan through each element in the array. It does seem to work but scanning through every element just seems inordinately slow and speed is a definite factor for how I intend to implement this.

 

How can I improve either of these VIs to better achieve my goal?

 

I apologise for the long-winded question, but I thought some context might help convery my question.

 

Any and all advice is appreciated.

Download All
0 Kudos
Message 1 of 2
(2,806 Views)

Hi D.Taylor,

 

I think you are on the right track with this but I think you have slightly overcomplicated your calculations. You can calculate the maximum value of dZ for a whole 2D array by using the array Max & Min function which means you can calculate the maximum value of dZ for each plot very quickly. If you use a while loop you can auto index a 4D array containing all of your cells and then generate a 2D array with the maximum dZ for each cell. I’ve attached a simplified down VI that generates random data equivalent to a row of occupancy cells and then calculates a 1D array of maximum dZ values.

 

Please let me know if this helps or if I have misunderstood anything.

 

Regards,

 

George Fiddes

National Instruments

Applications Engineering

0 Kudos
Message 2 of 2
(2,691 Views)