- Posts: 16
- Thank you received: 0
5 axis kinematics setup
I m trying to set the 5 axis kinematics looking at the xyzac kins c source code
struct haldata {
hal_float_t *z_offset;
hal_float_t *y_offset;
hal_float_t *tool_offset;
} *haldata;
int kinematicsForward(const double *joints,
EmcPose * pos,
const KINEMATICS_FORWARD_FLAGS * fflags,
KINEMATICS_INVERSE_FLAGS * iflags)
{
double dy = *(haldata->y_offset);
double dz = *(haldata->z_offset);
double dt = *(haldata->tool_offset);
double a_rad = joints[JA]*TO_RAD;
double c_rad = joints[JC]*TO_RAD;
dz = dz + dt;
pos->tran.x = + cos(c_rad) * (joints[JX] )
+ sin(c_rad) * cos(a_rad) * (joints[JY] - dy)
+ sin(c_rad) * sin(a_rad) * (joints[JZ] - dz)
+ sin(c_rad) * dy;
pos->tran.y = - sin(c_rad) * (joints[JX] )
+ cos(c_rad) * cos(a_rad) * (joints[JY] - dy)
+ cos(c_rad) * sin(a_rad) * (joints[JZ] - dz)
+ cos(c_rad) * dy;
pos->tran.z = + 0
- sin(a_rad) * (joints[JY] - dy)
+ cos(a_rad) * (joints[JZ] - dz)
+ dz;
pos->a = joints[JA];
pos->c = joints[JC];
pos->b = 0;
pos->w = 0;
pos->u = 0;
pos->v = 0;
return 0;
}
where dy is the distance from a axis rotation center to c axis rotation center
and dz is the height from c table to a axis rotation center as explained on linuxcnc.org/docs/ja/html/motion/5-axis-kinematics.html
Is tool offset the tool diameter?
now how/where do i declare the offsets values? units for the offsets?
thanks in advance!
Please Log in to join the conversation.
The offsets appear to come from HAL pins, are any created by the kins module?
Please Log in to join the conversation.
if((res = hal_pin_float_new("xyzac-trt-kins.y-offset",
HAL_IO, &(haldata->y_offset), comp_id)) < 0) goto error;
if((res = hal_pin_float_new("xyzac-trt-kins.z-offset",
HAL_IO, &(haldata->z_offset), comp_id)) < 0) goto error;
if((res = hal_pin_float_new("xyzac-trt-kins.tool-offset",
HAL_IN, &(haldata->tool_offset), comp_id)) < 0) goto error;
to the hal file:
net :tool-offset motion.tooloffset.z xyzac-trt-kins.tool-offset
setp xyzac-trt-kins.y-offset 0
setp xyzac-trt-kins.z-offset 20
Obviously i compiled the module with sudo halcompile --install xyzackins.c (my guess is that it turned out fine as i tested installing
another kinematics module for a 3 axis mill with axis deviation and it worked)
Still when i try to run lcnc i get this:
Debug file information:
.
./my-mill22.hal:4: module 'xyzackins1' not loaded
3847
PID TTY STAT TIME COMMAND
Stopping realtime threads
Unloading hal components
/usr/bin/linuxcnc_module_helper: Invalid usage with args: remove xyzac-trt-kins
Usage: /usr/bin/linuxcnc_module_helper insert /path/to/module.ext [param1=value1 ...]
where module is one of:
rtai_math
rtai_sem
rtai_shm
rtai_fifos
rtai_up
rtai_lxrt
rtai_hal
rtai_sched
rtai_smi
rtai
rt_mem_mgr
adeos
the path starts with one of:
/lib/modules
/usr/realtime-3.4-9-rtai-686-pae
and the extension is one of:
.ko
or the module is in the directory /usr/realtime-3.4-9-rtai-686-pae/modules/linuxcnc
OR
/usr/bin/linuxcnc_module_helper remove module
where module is one of the modules listed above.
<commandline>:0: exit value: 1
<commandline>:0: rmmod failed, returned -1
<commandline>:0: unloadrt failed
Error: Module hal_lib is in use by: xyzackins1
Error: Module rtapi is in use by: hal_lib
Error: Module rtai_sched is in use by: rtapi
Error: Module rtai_hal is in use by: rtapi rtai_sched
the xyzackins.ko (compiled file) is locaded at usr/realtimexxx/modules/linuxcnc with trivkins.ko and all other modules.
"invalid usage with args" don t understand what seems to be the problem here. Thanks everyone ill keep updating as this post may be helpful to fresh boarders.
Please Log in to join the conversation.
agsarg wrote: Hi andy thanks for your reply that was the right question so i started looking and found this (think this info it s great to start undertanding the kins source file and hal implementation) github.com/LinuxCNC/linuxcnc/blob/master...-axis-kinematics.txt which basically has all the info for implementing the module.
That file creates this (more legible) documentation section:
linuxcnc.org/docs/devel/html/motion/5-axis-kinematics.html
And there is also this:
linuxcnc.org/docs/2.7/html/motion/kinematics.html
/usr/bin/linuxcnc_module_helper: Invalid usage with args: remove xyzac-trt-kins
.
What does the "loadrt xyzackins-trt" line in the HAL look like, and what does your kinematics file look like?
(It sounds like you are trying to pass command-line parameters to you kins module and it is not expecting them.)
Please Log in to join the conversation.
"loadrt trivkins" for "loadrt xyzackins1" as that s the name of the source code i compiled (xyzackins1.c)
even tried adding in the ini file
[KINS]
KINEMATICS = xyzackins1 but the msg error is the same (tried rebooting and replacing the kinematics mod to trivkins
and it worked just fine even removing this part from the ini works fine.
and my kinematics file is the exact one from here github.com/LinuxCNC/linuxcnc/blob/master...ics/xyzac-trt-kins.c
i used the pins as written "xyzac-trt-kins.tool-offset" "xyzac-trt-kins.z-offset" "xyzac-trt-kins.y-offset"
to wire up the hal file
net :tool-offset motion.tooloffset.z xyzac-trt-kins.tool-offset
setp xyzac-trt-kins.y-offset 0
setp xyzac-trt-kins.z-offset 20
being the pin "motion.tooloffset.z" an out pin from motion controller
Please Log in to join the conversation.
Which version of LinuxCNC are you using? (I am wondering why you needed to compile a kins module that is a standard part of LinuxCNC)
Please Log in to join the conversation.
Please Log in to join the conversation.
Was that a typo, or is that the problem?
Please Log in to join the conversation.
Please Log in to join the conversation.
So, it isn't complaining about command line arguments, sorry about that.
It seems to be a hint that "more info follows" and it might actually be complaining that the kins module can't be removed.
So, then the question has to be why it is trying.
Just as an experiment (I would do this myself, but I am not at a LinuxCNC machine) try the following in a terminal window.
halrun
loadrt trivkins
exit
and then
halrun
loadrt xyza-trtkins
exit
and see if there is a difference in the output.
Please Log in to join the conversation.
