LabVIEW for LEGO MINDSTORMS and LabVIEW for Education

cancel
Showing results for 
Search instead for 
Did you mean: 

How to build an array of clusters?

Solved!
Go to solution

I am building a room mapping application for the Mindstorms NXT robot using LabVIEW for LEGO MINDSTORMS.

 

The attached VI shows the initial data processing segment.  The IR sensor is driven by the stepper motor, and Range and Angle measurements are made at 1 degree intervals.  The Cylindrical Coordinate (Range, Angle) data is then converted to Cartesian Coordinates (X, Y), and it is my desire to collect each (X, Y, Angle) in a cluster and then create an array of cluster to give me a file that will then be transmitted, via Bluetooth, from the NXT to the computer where it will be displayed.

 

On the fron panel, I created a 3 slot cluster, and on the Block Diagram, I created an array with a 3-slot cluster data type and the array index wired to the loop index.  However, I get erroes every time I hook the cluster and the array together.  My intention is that the array will index at each cycle of the While Loop.  What am I doing wrong?

0 Kudos
Message 1 of 4
(10,205 Views)

The index array node is intended for getting elements out of an existing array, not for building an array. What you are looking for is an indexing tunnel on the loop structure. Note however that indexing tunnels are not supported on while loops when targetting NXT.

1. First right click the while loop and replace with for loop.

2. Move the "360" constant outside the loop and wire it to the N terminal. (specifies 360 iterations).

3. Wire the output of your bundle cluster node right to the frame of structure, It should automatically configure the tunnel to be indexing.(you can also right-click configure it)

4. Move the array indicator outside the loop and wire it to the indexing tunnel. (it should be array wired to array now, so no syntax errors).

 

If you dont want to switch to using a for-loop for any reason, you can still accomplish this with a while loop but you will need to use the build array node and a shift register.

 

good luck!

0 Kudos
Message 2 of 4
(10,201 Views)
Solution
Accepted by jpnoon

Thank you once again, Ethan (ou seem to have been assigned permanently to my case).  Does everyone who buys LabVIEW for LEGO MINDSTORMS have as much trouble as I am having?  Why does the product come with no step by step, user documentation?

0 Kudos
Message 3 of 4
(10,187 Views)

You can find some more information and tutorials at the link below.

http://www.ni.com/academic/mindstorms/

 

These forums are also a great place to find suggestions and get help (as you have probably seen).

Zach P.

Staff Software Engineer | LabVIEW R&D | National Instruments
0 Kudos
Message 4 of 4
(10,180 Views)