09-10-2024, 10:37 AM (This post was last modified: 09-10-2024, 10:48 AM by Sergei.)
While generating the path, everything works fine. When generating the program form a path with a pp, unimportant what refernence I choose, it generates the same output program (see attached file).
For my understanding, if i choose different references frames with different values, the output as G-Code should also differ by recalculating. Do I something wrong? What ever I do, the reference frame used by the programm is always the same, not following the choosen frame, its alwas using the frame named "NP-part" (X=556 Y=1112 Z=480 Q1=0 Q2=-90 Q3=0), but I choosed "NP-20kg" (or every other possible reference frame). Also an additional "Set Reference Frame" instruction has no effect. It is always the same output.
I attached the project and also my modified pp („GCode_NCP_TC“), but it is the same with other pp's.
Maybe there is a little button I have to press/activate in the options, please help!
The point is that for the curve follow project exactly, motion instructions are always generated for the object's frame used to create the trajectory (regardless of which frame is selected).
You can use this frame in such postprocessor functions like pos_2_str()
For example:
Code:
def pose_2_str(self, pose, reference = None):
"""
Converts a pose target to a string.
"""
if reference is not None:
pose = reference * pose
[x, y, z, r, p, w] = pose_2_xyzrpw(pose)
return ('(%.3f,%.3f,%.3f,%.3f,%.3f,%.3f)' % (x, y, z, r, p, w))
--
There is another option when you place the object frame on the robot base and use Move Geometry to place the object (it is important to use 'apply' after moving).
The main problem is, that, unimportant which reference frame a choose at the curve following project dialog, the generated nc code it always refers to the reference X=556 Y=112 Z=480 Q=0 Q2=-90 Q3=0, which are the values of the frame “NP-part”, not the choosen “NP-20kg”. In the temp pp file, the string for the reference frame is “NP-20kg”, but the values are from “NP-part”.
I tried to implement the source code you suggested, but unfortunately it only leads to error messages. What can I do?
09-11-2024, 02:26 PM (This post was last modified: 09-11-2024, 03:00 PM by Strider.
Edit Reason: New thoughts.
)
Dear Sergei, sorry, I just read the first lines of your answer from yesterday :-(
"The point is that for the curve follow project exactly, motion instructions are always generated for the object's frame used to create the trajectory (regardless of which frame is selected)."
Sorry for that, im actually a little overmotivated and was fully focused to implement the suggested code to solve my problem.
Here is what I could find out in the meanwhile:
I changed the function "pos_2_str" in the modified pp like you suggestet (I could fix the errors) but the result was still the same.
Like mentioned, the temporary file "PostViereck_20kg.py" contains always the same values for the reference frame. It is not correspondig to a
change of the frame in the curve following project dialog:
temporary file for "NP-20kg" as reference frame
temporary file for "NP-part" as reference frame
As to be seen, its showing the correct names for the reference frame choosen in the dialog, but always the same values.
The modification in the pp had no effect, because they would use always the same values for calulation, using the values from the temporary file "PostViereck_20kg.py".
So, from my point of view, it is not a problem of the pp, because the pp uses the temporary file to generate the nc file. It might be a problem one step before, with the generation of the temporary file. In this step somehow it is alwas forwarding the values of "NP-part".
09-13-2024, 12:47 PM (This post was last modified: 09-13-2024, 12:49 PM by Sergei.)
As I mentioned before, the curve reference frame is always used, regardless of the selected reference frame in the Curve Follow project.
In addition, the coordinates for motion commands are generated relative to this curve reference frame.
As far as I know, there is no way to change this behavior with any settings.
But you can customize the output of the postprocessor as you prefer.
I would note the following postprocessor methods and functions that you can modify to do this (specifically related to your question):
pose_2_str
setFrame
MoveL, MoveC
Also, you can do something like this to get the frame selected in CFP and use it in the postprocessor:
Code:
def setFrame(self, pose, frame_id=None, frame_name=None):
"""Change the robot reference frame"""
from robodk import robolink
RDK = robolink.Robolink()
Dear Sergei, thank you for the information. I could manage to modify the post processor for a correct output for X and Y values by wild coding in Python. I'm a bloody beginner in phyton and not familiar with pp development. I'm the robot user and need a way to program and test the robot for our researches. But unfortunatly the Z value in the output file (nc) is still not what I need.
To explain it better: If the reference frame of the part "NP-part" has a Z value of 500 and the reference frame of the robot (in the height of axis 2) "NP-20kg" has a Z value of 398.5, all relative to the base of the robot fixed on the ground, there should be an expected output for the Z values of 101.5 (500 - 398.5), but actually the output is always 500. So the program is running in the wrong height in Z and I have no idea how to manage this in phyton in the post processor. The only way I could find is to modify the Z values for the reference frame in the temporary file. But this is problematic, because it is a source for errors and not the way for good CAM programming to do a pre-post processing.
The Z 398.5 for the "NP-20kg" is needed for the transformation of the used TwinCAT control.
Dear Sergei, here some more information. You can find the projekt and a link to a screenvideo with the creation of the program: https://datashare.tu-dresden.de/s/XFzFSxXwY2dcQEp. There is also the program itself attached.
There is the problem with the Z value to be seen and also the strange behavior in the angle for Q1 in the following part:
As you can see, Q3 value jumps in N00008 from plus 180 to minuns 180 and back in the next movement. This behavior leads to the movement in the linked video: https://datashare.tu-dresden.de/s/dfgqa7GswCqiF42. At second 33 the robot trys to adapt the turning of Q3, the program has to be stopped to prevent damage.
When i change the Q1=180 to Q1=-180 in N00008, the program is running OK, only the Z value is still a problem. I can change the Z value by manipulating the temporary file "PostViereck_20kg.py" and compile it with the post processor, but this seems not a good way.
There are unfortunataley 2 main questions / problems unsolved:
1. Why is the Z value wrong while the values for X and Y are fine in the NC program?
2. Why is this jump for Q1 and how can i prevent this?