Hi,
I am creating a program that gets the coordinates for the robot via TCP from a server. There are a lot of paths that need to be send with varying lengths. The coordinates come in structured strings with this form: #Type/(x1/y1/z1/x2/y2/z2)/speed in mm/s/accuracy/end_of_line_distance#
Depending on the path type (circle/line) x2,y2 and z2 are used. One path consists of multiple of such segments and sometimes there are up to 20 paths. Since the parsing of the string using $DECOMPOSE takes too long, I created a PC program to do the transmission of paths and the parsing while the Robot already moves (the first path is parsed, then the robot starts moving and the next path is received and parsed). First, I only had two buffers and once the first path was done I overrode it with a new path. But this also lead to delays when the second path was very short and the third one long (the robot would finish the second one before the third one was ready). So I just parse every path in one separate dimension of an array. This works fine, but it creates a lot of global variables (every speed of each path segment is stored in one array dimension, and each path in a seperate dimension like this:
Path1 | Path2 | Path3 |
---|---|---|
v[p1,s3} | v[p3,s3] | … |
v[p1,s2] | v[p2,s2] | … |
v[p1,s1] | v[p2,s1] | … |
… | … | … |
The same is done for the accuracy, for the distance value at the end and for the x,y and z coordinates (since there are potentially 2 coordinates, this array as 2 dimensions already)
Since all those array variables are stored as global variables (they are created in the PC program and are used in the motion program) they are not deleted. So I end up with 2000 real variables in memory. From what I have seen, it still works without a problem. But it looks messy and feels useless.
Is there a way to not have those variables as persistent or to free them up after a path has been used (I tried the DELETE/R command, but since I use the variables in the program, it does not work)?
Has anyone else done something similar before and what was the solution?
Thanks a lot in advance and have a nice day,
Arwed