Here is how to switch between kinematics
+ You need to combine the kinematics you will use into one (new) c-file. Basically a copy and paste exercise.
+ The code for the two kinematics are separated by a switch
Code:
if (TCPmode) {
xyzac kinematics code
} else {
trivkins kinematics code
}
+ The variable TCPmode (arbitrary name) has to be added to
variables in the new kinematics file. It is then accessed by
Code:
int TCPmode = *(haldata->TCPmode);
It also need to be prepared in rtapi_app_main, there should already be some offset parameters. Just copy how it is done for them.
+ To set the value of TCPmode, make two macros say M100 and M101 with the lines
Code:
halcmd setp newkinematics.TCPmode 1 # (or 0)
if the new kinematics is called "newkinematics".
+ Put "newkinematics in the KINEMATICS line in the ini file.
To switch between kinematics you need to go to a position where the coordinates are the same for both kinematics, typically (0,0,0,0). Then run the M100/M101 macro and you are now using the other kinematics. If not at (0,0,0,0) there will immeditaly be a following error, and that is what they where dealing with in the last few pages of the link above.
I'll attach such a kinematics file. It is called trivkins, because there are some functions that require the name "trivkins" such as mpg jogging. It was some months ago I used this. It worked, but I wasn't happy with jogging and positioning movements and eventually went back to trivkins. Use at own risk; I will not come and repair your machine if using this.
File Attachment:
File Name:
trivkins.c
File Size:6.76 KB