Axis letters vs joint numbers - does the order matter?

More
19 Dec 2023 15:03 #288587 by spumco


TLDR:
Do I need to change the order of some/all the axis/joint numbers in INI?  If so, to what?

Does a switchable userkins need a default configuration (i.e. when in cartesian mode)?  If so, where is that defined?


Longer version:
Does the order of axes letters & joint numbers in INI matter?  I installed a user kinematics module and during initial testing got a confusing error.

Specifically, commanding G0 C90 resulted in a "Joint 2 limits would be exceeded" error... but I've defined C-axis as Joint 3. What gives?  

Now I'm wondering if I need to change the order of axes/joint in my INI file.  Here's a summary of what I've got, both in INI and physically:

Physical components:
  • X-axis
    • Traditional axis, nothing strange
  • Z-axis
    • Traditional axis, nothing strange
  • V-axis
    • Separate slide mounted to lathe headstock.  Used for parting tool, much like some Hardinge chuckers.
    • I could define this as an extra_joint, but I want CSS while parting and I think I need it defined as an axis to get this feature.
  • C-axis (main spindle)
    • Servo spindle motor, both spindle and c-axis mode
    • using caxis.comp to switch between modes
  • C-axis (sub-spindle, not yet implemented)
    • ​​​​​​​hoping to duplicate the main spindle dual-mode here as well
My INI summary:
  • [DISPLAY]
    • GEOMETRY = not defined
  • [TRAJ]
    • COORDINATES = XZVC
  • [KINS]
    • KINEMATICS = polar_userkins
  • [AXIS X]
    • [JOINT 0]
  • [AXIS Z]
    • [JOINT 1]
  • [AXIS V]
    • [JOINT 2]
  • [AXIS C]
    • [JOINT 3]

I don't really understand the userkins.comp file, having borrowed it from NoJo.  Nor do I understand where to define the 'default' KINS arrangement when polar interp mode is off.

 
Attachments:

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

More
19 Dec 2023 15:16 #288588 by andypugh
The mapping of axes to joints is defined in the kinematics file (possibly as a parameter passed to the kinematics file as it is loaded)

The position in the INI is not relevant. Your INI could be

Axis X
Joint0
AxisY
Joint1

Or
Axis X
Axis Y
Axis Z

Joint0
Joint1
Joint2

Or even, of you wanted,

Joint3
Joint1
Joint0
Axis C
Joint2
Axis X
Axis Z
Axis Y

The components search the INI for the information that they require when they require it.

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

More
19 Dec 2023 16:03 #288591 by spumco
I don't see any parameters being referenced in the kinematics file (i.e. INI references).

The kinematics file has this in it:
KINEMATICS_TYPE kinematicsType()
{
    static bool is_setup=0;
    if (!is_setup) polar_userkins_setup();
    return KINEMATICS_IDENTITY;

And a little later on:
if (switchkins_type == 1) 
    {
        // G12.1 mode : do polar to cartesian conversion
        angle_rad = j[2] * M_PI / 180.0;    
        radius = j[0] - tool_offset;
        pos->tran.x = (radius * cos(angle_rad)) + tool_offset;
        pos->c = -(radius * sin(angle_rad));  // ref comment in inverse kinematics        
    }
    else
    {
        pos->tran.x = j[0];

        // on an exit from polar, am adjusting the pos->C and j[2] values so that the max distance back to zero
        // will be between 0 and 360deg. As in polar mode, we may have clocked up several revolutions of C, which 
        // means if did not do this setp, would unwind all these positions. The method is derived from what the 
        // caxis component does on a transition from spindle to caxis mode. Note that the j[2] value is updated 
        // in the caxis component as cannot write associated net pin here as that pin is written to in caxis.
        if (prev_switchkins_type_fwd != switchkins_type)  
        {
           offset = round(*haldata->spindle_revs);
           pos->c = (*haldata->spindle_revs - offset) * 360;                     
        }
        else        
            pos->c = j[2];
    }
    prev_switchkins_type_fwd = switchkins_type;
         
    pos->tran.z = j[1];
    pos->b = j[3];   
    
    // unused coordinates:
    pos->tran.y = 0;
    pos->a = 0;
    pos->u = 0;
    pos->v = 0;
    pos->w = 0;

    return 0;

Does that mean kinematics file is using the default as described in KINS man page when switchkins_type = 0?

And maybe NoJo's kinematics file needs to be edited for my particular configuration?

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

More
19 Dec 2023 17:36 #288604 by Aciera
For example, this means 'Axis X = Joint 0'
pos->tran.x = j[0]

This one 'Axis C = Joint 2'
pos->c = j[2];

And so on.

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

More
19 Dec 2023 17:43 #288605 by Aciera
So this would be the setup from the kinematic:

Joint 0 > axis X
Joint 1 > Axis Z
Joint 2 > Axis C
Joint 3 > Axis B
The following user(s) said Thank You: spumco

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

More
19 Dec 2023 18:09 #288606 by spumco
That makes so much more sense now.

Assuming I'll have to edit the comp and re-do halcompile, right?

Or rename my joints/axes to match the comp?

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

More
19 Dec 2023 23:45 #288626 by Aciera

Assuming I'll have to edit the comp and re-do halcompile, right?

Or rename my joints/axes to match the comp?

Yes
The following user(s) said Thank You: spumco

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

More
05 Jan 2024 04:01 #289826 by spumco
Back on this after the holidays, but still having issues.

I've edited my INI & HAL files to match the polar_userkins.comp scheme.  i.e. C-axis is now joint 2, and all the hal connections have been changed to joint.2.xxx pin names.

HOME_USE_INDEX = 1 for joint 2 in INI
  • On startup, no immediate errors.
  • Can start the spindle with M3/M4 and stop it with M5.
  • When spindle is started, caxis.pid-enable turns off in halshow (as I believe is intended in caxis.comp)
  • As soon as spindle is off, caxis.pid-enable turns on (again, as intended - I think)
  • Attempt to home C-axis/joint 2 - spindle rotates at an appropriate speed (~60rpm), but gets an ferror after a couple of rotations
    • joint.2.index-enable & pid.c0.index-enable do NOT get set when homing starts
    • note - INI ferror set to 1000 for testing
    • Machine turns off
  • Upon re-enable it immeidately continues to attempt homing
    • Must trigger encoder.04.reset to 'clear' everything
  • If I manually set the encoder index-enable (sets)
    • encoder.04.index-enable, joint.2.index-enable, and pid.c0.index-enable all turn on
  • When it starts homing the index-enable(s) all go off when the index signal passes, but this doesn't appear to register with the homing process and it continues rotating until the ferror.
I feel like this is something simple... a bad HAL connection and the index signal isn't connected to something properly.

Maybe someone could look over my HAL file(s) and see if there's something obvious?  03SPINDLE_MAIN.hal has both the spindle and C-axis/joint stuff in it.  Using the same comps as posted earlier.

Thx
Attachments:

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

Time to create page: 0.082 seconds
Powered by Kunena Forum