06-29-2016 09:44 AM
Hello,
I am working in LabVIEW 13. I am receiving a string from a robot in this format: "[X,Y,Z]," where X,Y,Z are numbers that can vary in character count. I am wanting to split these strings into 3 seperate doubles with just the numeric values (i.e. omit the brackets and commas), and then graph the error between the commanded position data vs the returned position data. I have looked at the search/replace and split string vi's, but I am kind of confused on how to use them properly...
Can someone help point me in the right direction to first split the strings and then graph the numbers?
Thanks,
SM
Solved! Go to Solution.
06-29-2016 09:48 AM - edited 06-29-2016 09:50 AM
Graphing, I think you can figure out by playing around a bit with the numbers. To get you started, here is how you would use Scan From String to get the 3 numbers:
If you are just graphing the error between actual and theoretical, that's easy. Get the difference in XYZ between the two points, then perform a Pythagorean theorem calculation on the resulting vector.
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
06-29-2016 09:48 AM - edited 06-29-2016 09:48 AM
06-29-2016 09:54 AM - edited 06-29-2016 10:05 AM
Works excellent! Thanks guys!
Now that that part is done, how can I graph these 3 numbers vs the numbers I send the robot? In other words graph the error/discrepency between the 2. I have been looking at the Plot Multi-XY but I can't figure out how to get the data into it correctly, I am confused on how to go from dobule to cluster to all the other data types it needs...
EDIT: Also I should note, that these strings are coming from the robot 4 times a second, so it's a constant update.
Thanks,
SM
06-29-2016 10:15 AM - edited 06-29-2016 10:16 AM
Show us what you've tried so far. If you only care about the error, and not the direction in which the error is, then just generate a single error value (DBL) using the method I described above. If you need to plot 3 axes, that will be a bit more difficult.
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
06-29-2016 12:29 PM
Guys, thanks for all the help. I got it all figured out and it works how I need it to.
Attached is a snippet of my code and what my waveform looks like.
Thanks again!
SM