06-25-2012 02:12 PM
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?
Solved! Go to Solution.
06-26-2012 10:02 AM
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.
06-28-2012 10:51 AM
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?
06-29-2012 12:07 PM
You can find some more information and tutorials at the link below.
These forums are also a great place to find suggestions and get help (as you have probably seen).