03-21-2016 05:54 AM
Greetings,
I have 4 arrays that I will read to control an autonomous robot vehicle as instructions.
I need to be able to read the first elements in each array and store in 4 separate variables (direction, speed, angle, distance). Then wait until that first instruction has been executed. Then I move on to the second elements in each array. I will repeat this until I have gone through all the elements. I am struggling to figure out how to do this?
Please note:
-The number of elements in the arrays are always the same, although the number of elements vary because the can be less instructions or more.
For example a complete instruction takes 1st element from array 1, array 2, array 3 and array 4 and this builds up something like: Forward, 10, 20, Left. This then will result in the robot moving Forward at a speed of 10 for a distance of 20 and then make a left turn. Once thats done then it takes the 2nd elements and so on.
Please find attached my VI that reads a text file and creates the 4 arrays.
Thank you.
Solved! Go to Solution.
03-21-2016 06:24 AM
Hi Stan,
I need to be able to read the first elements in each array and store in 4 separate variables (direction, speed, angle, distance).
Well, right now you read a 2D array and get it's first 4 columns in seperate indicators…
LabVIEW doesn't use "variables" in the same way as text-based programming languages, values are stored in wires and shift registers. When you have problems understanding this you should take the (free) beginner courses offered by NI…
I am struggling to figure out how to do this?
Learn about using "auto indexing" with loops. It will make your live easier - and solve your current problem too!
03-21-2016 06:32 AM
Hi GerdW,
Firstly, I would like to thank you for your time replying to me.
Unfortunately, I don't think you understood my question.
Kind regards,
03-21-2016 06:35 AM
Hi Stan,
Unfortunately, I don't think you understood my question.
I think I understood your question very well.
I even think I gave you the correct answer.
When you still think, that's not the case: Explain your problem with more details and examples…
03-21-2016 06:44 AM - edited 03-21-2016 06:45 AM
stanm13 wrote: Unfortunately, I don't think you understood my question.
Then I would say either a) you don't understand the answer or b) you did not explain it well enough.
To perform each element in an array, using a FOR loop with autoindexing inputs is the way to go.
03-21-2016 06:55 AM
Thank GerdW.
I know where I was going wrong now.
Kind regards,
03-21-2016 06:56 AM
Thank you crossrulz.
It was a mixture of both.
Kind regards,