12-03-2013 11:51 AM
Hi,
I am using Dynamixel MX 64 servos in my project. I have 4 of them tied in series. P1,P2,P3, P4 represents degree rotation of each servo/axis. I am trying to run my code for set 50 values of P1,P2,P3,P4
Not sure what is the best method to update numeric control multiple times. I have used property nodes when I had only few values. How can I send 4*50 array.
Really appreciate your help!
Thanks,
Ana
Solved! Go to Solution.
12-04-2013 10:30 AM
If I understand your question right, you would like to know an easy way to cycle through a set of 50 control values without the user having to manual put each value each time. Is that right?
You actually have a lot of options here. Probably the easiest would be to create an 1-D array control for each axis. The user can enter in all 50 values to the array before running the program. Individual values of the arrays can be pulled out with the Index Array function. You can use the interation terminal of the While Loop to select the index of the array that corresponds to the interation number of the loop. That way, the code automatically cycles through each element in the array one at a time.
Another option would be to write the 50 points to a file--maybe a delimited text file or a spreadsheet--and load these values into an array in LabVIEW. Then, you could proceed to extract these points one at a time as described in the previous paragraph.
Jeremy P.
12-04-2013 12:08 PM
I think second option is what I was looking for. I want to put all my values to excel spreadsheet and load these values into an array in Labview. Would you be able to provide me a simple example how to extract spreadsheet values ?
Thanks,
12-05-2013 11:04 AM
Here is an example about how to load data from a spreadsheet file. https://decibel.ni.com/content/docs/DOC-12287
Once the data has been transfered into the LabVIEW enviroment, it will be a 2-D array. You will have to use array manipulation in order to pull out the individual values. Also, if you don't already know about the auto-index feature of loops in LabVIEW, I would recommend that you read more about them. I believe that they will be very helpful for your project. Here is a link to a document that discusses the concept: https://decibel.ni.com/content/docs/DOC-20828
Jeremy P.
12-05-2013 06:42 PM
Hi Jeremy,
Thanks for your help! I was able to load data from excel spreadsheet. Now I am trying to extract elements column wise using autoindexing function and assign each element in that column A(1,1), A(2,1) ,A(3,1) ,A(4,1) to P1,P2,P3,P4 respectively. So basically want to run my code with P1= A(1,1), P2=(2,1), P3=A(3,1), P4=A(4,1) at iteration 1
P1= A(1,2), P2=(2,2), P3=A(3,2), P4=A(4,2) at iteration 2 P1= A(1,3), P2=(2,3), P3=A(3,3), P4=A(4,3) at iteration 3 and so on.. Asuuming I have 4*50 array.
I am concerned about extracting 4 elements of every column at same time so I will be able to move all my 4 servo motors synchronously without any delay between the motors.
Plese let me know what you think.
Thanks for your help,
Sahana
12-06-2013 10:33 AM
I think that the easiest way to do this would be to use the index array function to split the 2D array into 4 1-D arrays (each row of the 2-D array becomes a row). Then, you can send each of these 1-D arrays into your loop. The auto-indexing tunnels will extract one element at a time from each row. That way, each iteration of the loop will have the individual data points for all for of your motors. I have attached an example VI that demonstrates this.
I believe that you should take a close look at your LabVIEW code to make sure that the arrays have the correct data. Your starting data set is actually a three dimensional array. I believe that is the case because you are using auto-index tunnels a loop to extract your spreadsheet data. The auto index tunnel adds an extra dimension to the array to turn it from a 2-D array to a 3-D array. I don't believe that the For Loop is necessary there. You should be able to extract the entire 2-D array from the spreadsheet with a single function.
Jeremy P.
12-06-2013 05:30 PM
Thanks a lot Jeremy ! That was really helpful 🙂