Kinematics modification

More
14 Dec 2015 12:54 #66954 by andypugh
Replied by andypugh on topic Kinematics modification

I'm not sure this is related to this problem, but when I do homing of B axis in joint mode in preview window this axis rotates in opposite direction as it is on machine. After switching to world mode, preview rotates correctly.


Did you change both the forward and inverse kins?

Your current kins looks the same as the original 5axiskins to me. What did you change?

Please Log in or Create an account to join the conversation.

More
14 Dec 2015 14:37 #66958 by tommy
Replied by tommy on topic Kinematics modification

Did you change both the forward and inverse kins?

Your current kins looks the same as the original 5axiskins to me. What did you change?


That was the catch! I forgot to change operators in kinematicsForward section!

My kinematics is almost same as original, except I have two parallel motors to drive Y axis (gantry).

There is one more thing related to Preview or DRO. If I apply G54 (or touch off) to Y axis, it correctly zeros Y axis but U axis still shows absolute position all the time. So is there a way that also U axis (second motor/axis to drive gantry) would show relative position in this case?

Please Log in or Create an account to join the conversation.

More
14 Dec 2015 14:43 - 14 Dec 2015 14:43 #66959 by andypugh
Replied by andypugh on topic Kinematics modification

There is one more thing related to Preview or DRO. If I apply G54 (or touch off) to Y axis, it correctly zeros Y axis but U axis still shows absolute position all the time. So is there a way that also U axis (second motor/axis to drive gantry) would show relative position in this case?


You don't have a U axis.

You have a Y axis, and you have a Joint-4, but you don't have a U axis.

What is your [TRAJ] COORDINATES INI-file entry?
Last edit: 14 Dec 2015 14:43 by andypugh.

Please Log in or Create an account to join the conversation.

More
14 Dec 2015 15:49 #66967 by tommy
Replied by tommy on topic Kinematics modification

You don't have a U axis.

You have a Y axis, and you have a Joint-4, but you don't have a U axis.

What is your [TRAJ] COORDINATES INI-file entry?


COORDINATES = X Y Z B C U W

In my case Joint_1 is Y and Joint_6 U (second gantry axis). For this reason in kinematics is added: joints[6] = pos->tran.y + r.y; but only in kinematicsInverse section.

Here is my current kinematics:
/********************************************************************
* Description: my5axiskins.c
*   Trivial kinematics for 3 axis Cartesian machine
*
*   Derived from a work by Fred Proctor & Will Shackleford
*
* Author:
* License: GPL Version 2
* System: Linux
*    
* Copyright (c) 2007 Chris Radek
*
* Last change:
********************************************************************/

#include "kinematics.h"		/* these decls */
#include "posemath.h"
#include "hal.h"
#include "rtapi_math.h"

#define d2r(d) ((d)*PM_PI/180.0)
#define r2d(r) ((r)*180.0/PM_PI)

struct haldata {
    hal_float_t *tool_length;
    hal_float_t *pivot_length;
} *haldata;

static PmCartesian s2r(double r, double t, double p) {
    PmCartesian c;
    t = d2r(t), p = d2r(p);

    c.x = r * sin(p) * cos(t);
    c.y = r * sin(p) * sin(t);
    c.z = r * cos(p);

    return c;
}

int kinematicsForward(const double *joints,
		      EmcPose * pos,
		      const KINEMATICS_FORWARD_FLAGS * fflags,
		      KINEMATICS_INVERSE_FLAGS * iflags)
{
    PmCartesian r = s2r(*(haldata->pivot_length) + joints[8], joints[5], 180.0 - joints[4]);

    pos->tran.x = joints[0] - r.x;
    pos->tran.y = joints[1] - r.y;
    pos->tran.z = joints[2] + *(haldata->pivot_length) + r.z;
    pos->a = joints[3];
    pos->b = joints[4];
    pos->c = joints[5];
    pos->u = joints[6];
    pos->v = joints[7];
    pos->w = joints[8];

    return 0;
}

int kinematicsInverse(const EmcPose * pos,
		      double *joints,
		      const KINEMATICS_INVERSE_FLAGS * iflags,
		      KINEMATICS_FORWARD_FLAGS * fflags)
{

    PmCartesian r = s2r(*(haldata->pivot_length) + pos->w, pos->c, 180.0 - pos->b);

    joints[0] = pos->tran.x + r.x;
    joints[1] = pos->tran.y + r.y;
    joints[2] = pos->tran.z - *(haldata->pivot_length) - r.z;
    joints[3] = pos->a;
    joints[4] = pos->b;
    joints[5] = pos->c;
    joints[6] = pos->tran.y + r.y;
    joints[7] = pos->v;
    joints[8] = pos->w;

    return 0;
}

/* implemented for these kinematics as giving joints preference */
int kinematicsHome(EmcPose * world,
		   double *joint,
		   KINEMATICS_FORWARD_FLAGS * fflags,
		   KINEMATICS_INVERSE_FLAGS * iflags)
{
    *fflags = 0;
    *iflags = 0;

    return kinematicsForward(joint, world, fflags, iflags);
}

KINEMATICS_TYPE kinematicsType()
{
    return KINEMATICS_BOTH;
}

#include "rtapi.h"		/* RTAPI realtime OS API */
#include "rtapi_app.h"		/* RTAPI realtime module decls */
#include "hal.h"

EXPORT_SYMBOL(kinematicsType);
EXPORT_SYMBOL(kinematicsForward);
EXPORT_SYMBOL(kinematicsInverse);
MODULE_LICENSE("GPL");

int comp_id;
int rtapi_app_main(void) {
    int result;
    comp_id = hal_init("my5axiskins");
    if(comp_id < 0) return comp_id;

    haldata = hal_malloc(sizeof(struct haldata));

    result = hal_pin_float_new("my5axiskins.tooloffset.z", HAL_IN, &(haldata->tool_length), comp_id);
    if(result < 0) goto error;
    result = hal_pin_float_new("my5axiskins.pivot-length", HAL_IO, &(haldata->pivot_length), comp_id);
    if(result < 0) goto error;

    *(haldata->pivot_length) = 161.0;

    hal_ready(comp_id);
    return 0;

error:
    hal_exit(comp_id);
    return result;
}

void rtapi_app_exit(void) { hal_exit(comp_id); }

Please Log in or Create an account to join the conversation.

More
14 Dec 2015 15:52 #66968 by andypugh
Replied by andypugh on topic Kinematics modification

COORDINATES = X Y Z B C U W


COORDINATES should only contain axes which are valid for use in G-code.

In your case I don't think this includes U and W.

Please Log in or Create an account to join the conversation.

More
14 Dec 2015 16:16 #66970 by tommy
Replied by tommy on topic Kinematics modification

COORDINATES should only contain axes which are valid for use in G-code.

In your case I don't think this includes U and W.


W is handy as it shows current tool length compensation used.

As we are mentioning W axis used for tool length compensation, I don't quite understand why is always needed to run G0W0 right after applying G43H1, number in preview for W axis doesn't change but machine makes move in positive Z direction for this amount (taken from W for current tool), and after this rotation point is at tool tip, as it should be. Could be this also related to kinematics?
As far as I know on commercial machines there is only G43Hx (x=tool number) needed to apply to activate tool length compensation.

Please Log in or Create an account to join the conversation.

Time to create page: 0.146 seconds
Powered by Kunena Forum