Advanced Search

Search Results (Searched for: )

  • PCW
  • PCW's Avatar
11 Apr 2025 20:17 - 11 Apr 2025 20:27
Replied by PCW on topic 7i92 firmware issue

7i92 firmware issue

Category: Driver Boards

I'm not so much suggesting that the EEPROM is bad, but rather
that the EEPROM is empty. (never been programmed)
  • jochen91
  • jochen91
11 Apr 2025 20:16

Planning to Retrofit a Mazak Integrex200Y Mill-Turn Machine

Category: Advanced Configuration

So i worked the whole day with resources from the forum and ChatGPT to create this Kinematic. ChatGPT checked the math forwards and inverse and it seems to check out. I try to set up vismach asap and check it for myself.
component  xyzcb_tdr_kins "Switchable kinematics for 5 axis machine with rotary table C and B and virtual Y Axis";

description
"""

This is a switchable kinematics module for a 5-axis milling configuration
using 3 cartesian linear joints (XYZ) and 2 rotary table joints (CB).

The module contains two kinematic models:

type0 (default) is a trivial XYZCB configuration with joints 0..4 mapped to
axes XYZCB respectively.

type1 is a XYZCB configuration with tool center point (TCP) compensation.

Additionally a virtual Y Axis was added for a Mazak Integrex 200Y
""";

pin out s32 dummy=0"one pin needed to satisfy halcompile requirement";

license "GPL";
author "Jochen Rohm";
;;

#include "rtapi_math.h"
#include "kinematics.h"

static struct haldata {

  // Declare hal pin pointers used for XYZCB_tdr kinematics:
  hal_float_t *tool_offset_z;
  hal_float_t *x_offset;
  hal_float_t *z_offset;
  hal_float_t *x_rot_point;
  hal_float_t *y_rot_point;
  hal_float_t *z_rot_point;
  hal_float_t *angleXX;

  //Declare hal pin pointers used for switchable kinematics
  hal_bit_t   *kinstype_is_0;
  hal_bit_t   *kinstype_is_1;
} *haldata;

static int XYZCB_tdr_setup(void) {
#define HAL_PREFIX "xyzcb_tdr_kins"
    int res=0;
    // inherit comp_id from rtapi_main()
    if (comp_id < 0) goto error;
    // set unready to allow creation of pins
    if (hal_set_unready(comp_id)) goto error;

    haldata = hal_malloc(sizeof(struct haldata));
    if (!haldata) goto error;

    // hal pins required for XYZCB_tdr kinematics:
    res += hal_pin_float_newf(HAL_IN ,&(haldata->tool_offset_z) ,comp_id,"%s.tool-offset-z" ,HAL_PREFIX);
    res += hal_pin_float_newf(HAL_IN ,&(haldata->x_offset) ,comp_id,"%s.x-offset" ,HAL_PREFIX);
    res += hal_pin_float_newf(HAL_IN ,&(haldata->z_offset) ,comp_id,"%s.z-offset" ,HAL_PREFIX);
    res += hal_pin_float_newf(HAL_IN ,&haldata->x_rot_point ,comp_id,"%s.x-rot-point" ,HAL_PREFIX);
    res += hal_pin_float_newf(HAL_IN ,&haldata->y_rot_point ,comp_id,"%s.y-rot-point" ,HAL_PREFIX);
    res += hal_pin_float_newf(HAL_IN ,&haldata->z_rot_point ,comp_id,"%s.z-rot-point" ,HAL_PREFIX);

    // hal pins required for switchable kinematics:
    res += hal_pin_bit_new("kinstype.is-0", HAL_OUT, &(haldata->kinstype_is_0), comp_id);
    res += hal_pin_bit_new("kinstype.is-1", HAL_OUT, &(haldata->kinstype_is_1), comp_id);

    // define default kinematics at startup for switchable kinematics
    *haldata->kinstype_is_0 = 1; //default at startup -> identity kinematics
    *haldata->kinstype_is_1 = 0; //-> XYZCB TCP

    if (res) goto error;
    hal_ready(comp_id);
    rtapi_print("*** %s setup ok\n",__FILE__);
    return 0;
error:
    rtapi_print("\n!!! %s setup failed res=%d\n\n",__FILE__,res);
    return -1;
#undef HAL_PREFIX
}

EXPORT_SYMBOL(kinematicsType);
EXPORT_SYMBOL(kinematicsSwitchable);
EXPORT_SYMBOL(kinematicsSwitch);
EXPORT_SYMBOL(kinematicsInverse);
EXPORT_SYMBOL(kinematicsForward);

static hal_u32_t switchkins_type;

int kinematicsSwitchable() {return 1;}

int kinematicsSwitch(int new_switchkins_type)
{
    switchkins_type = new_switchkins_type;
    rtapi_print("kinematicsSwitch(): type=%d\n",switchkins_type);
    // create case structure for switchable kinematics
    switch (switchkins_type) {
        case 0: rtapi_print_msg(RTAPI_MSG_INFO,
                "kinematicsSwitch:TYPE0\n");
                *haldata->kinstype_is_0 = 1;
                *haldata->kinstype_is_1 = 0;
                break;
        case 1: rtapi_print_msg(RTAPI_MSG_INFO,
                "kinematicsSwitch:TYPE1\n");
                *haldata->kinstype_is_0 = 0;
                *haldata->kinstype_is_1 = 1;
                break;
       default: rtapi_print_msg(RTAPI_MSG_ERR,
                "kinematicsSwitch:BAD VALUE <%d>\n",
                switchkins_type);
                *haldata->kinstype_is_1 = 0;
                *haldata->kinstype_is_0 = 0;
                return -1; // FAIL
    }
    return 0; // ok
}

KINEMATICS_TYPE kinematicsType()
{
static bool is_setup=0;
    if (!is_setup)  XYZCB_tdr_setup();
    return KINEMATICS_BOTH; // set as required
           // Note: If kinematics are identity, using KINEMATICS_BOTH
           //       may be used in order to allow a gui to display
           //       joint values in preview prior to homing
} // kinematicsType()

int kinematicsForward(const double *j,
                      EmcPose * pos,
                      const KINEMATICS_FORWARD_FLAGS * fflags,
                      KINEMATICS_INVERSE_FLAGS * iflags)

{
    (void)fflags;
    (void)iflags;
    double x_rot_point = *(haldata->x_rot_point);
    double y_rot_point = *(haldata->y_rot_point);
    double z_rot_point = *(haldata->z_rot_point);

    double dz = *(haldata->z_offset);
    double dt = *(haldata->tool_offset_z);
    

    // substitutions as used in mathematical documentation
    // including degree -> radians angle conversion
    double       sc = sin(j[3]*TO_RAD);
    double       cc = cos(j[3]*TO_RAD);
    double       sb = sin(j[4]*TO_RAD);
    double       cb = cos(j[4]*TO_RAD);

    // used to be consistent with math in the documentation
    double       px = 0;
    double       py = 0;
    double       pz = 0;
    
    #define DEFAULT_ANGLE   (60.0)
    
    // define forward kinematic models using case structure for
    // for switchable kinematics
    switch (switchkins_type) {
        case 0: // ====================== IDENTITY kinematics FORWARD ====================
            double angle = *(haldata->angleXX) * PM_PI / 180.0;
            
            pos->tran.x =   j[0] + j[1] * cos(angle)
            pos->tran.y = - j[1] * sin(angle);
            pos->tran.z =   j[2];
            pos->c      =   j[3];
            pos->b      =   j[4];
            break;
        case 1: // ========================= TCP kinematics FORWARD ======================
            px          =    j[0] - x_rot_point + j[1] * cos(angle);
            py          = - (j[1] - y_rot_point) * sin(angle);
            pz          =    j[2] - z_rot_point - dt;

            pos->tran.x =   cb * (cc * px - sc * py) + sb * pz + x_rot_point;
            pos->tran.y =   sc * px + cc * py + y_rot_point;
            pos->tran.z =  -sb * (cc * px - sc * py) + cb * pz + z_rot_point + dz + dt;
            pos->c      = j[3];
            pos->b      = j[4];
            break;
    }
    // unused coordinates:
    pos->a = 0;
    pos->u = 0;
    pos->v = 0;
    pos->w = 0;

    return 0;
} // kinematicsForward()

int kinematicsInverse(const EmcPose * pos,
                      double *j,
                      const KINEMATICS_INVERSE_FLAGS * iflags,
                      KINEMATICS_FORWARD_FLAGS * fflags)
{
    (void)iflags;
    (void)fflags;
    double x_rot_point = *(haldata->x_rot_point);
    double y_rot_point = *(haldata->y_rot_point);
    double z_rot_point = *(haldata->z_rot_point);

    double dx = *(haldata->x_offset);
    double dz = *(haldata->z_offset);
    double dt = *(haldata->tool_offset_z);

    // substitutions as used in mathematical documentation
    // including degree -> radians angle conversion
    double       sc = sin(pos->c*TO_RAD);
    double       cc = cos(pos->c*TO_RAD);
    double       sb = sin(pos->b*TO_RAD);
    double       cb = cos(pos->b*TO_RAD);

    // used to be consistent with math in the documentation
    double       qx = 0;
    double       qy = 0;
    double       qz = 0;

    switch (switchkins_type) {
        case 0:// ====================== IDENTITY kinematics INVERSE =====================
            double angle = *(haldata->angleXX) * PM_PI / 180.0;
            
            j[0] =   pos->tran.x + pos->tran.y / tan(angle);
            j[1] = - pos->tran.y / sin(angle);
            j[2] =   pos->tran.z;
            j[3] =   pos->c;
            j[4] =   pos->b;
            break;
        case 1: // ========================= TCP kinematics INVERSE ======================
            qx   = pos->tran.x - x_rot_point - dx;
            qy   = pos->tran.y - y_rot_point;
            qz   = pos->tran.z - z_rot_point - dz - dt;

            // Hier integrieren wir die virtuelle Achse (pos->tran.y) wie im Identity-Fall:
            double qx_virtual = qx + qy / tan(angle);
            double qy_virtual = -qy / sin(angle);

            j[0] = cc * (cb * qx_virtual - sb * qz) + sc * qy_virtual + cb * dx - sb * dz + x_rot_point;
            j[1] = -sc * (cb * qx_virtual - sb * qz) + cc * qy_virtual + y_rot_point;
            j[2] = sb * qx_virtual + cb * qz + sb * dx + cb * dz + z_rot_point + dt;
            j[3] = pos->c;
            j[4] = pos->b;
            break;
    }

    return 0;
} // kinematicsInverse()
  • endian
  • endian's Avatar
11 Apr 2025 20:10
Replied by endian on topic Strange behaviour of custom component

Strange behaviour of custom component

Category: Advanced Configuration

Yes I have to start ... I have planty of ideas but I am aware little bit to code them over halcompile...

Yes defenetly I am interested even in all which should improve our skills ... can you provide me them please?

thanks...
  • pgf
  • pgf
11 Apr 2025 19:58

Running an external program from a HAL pin

Category: HAL

Thanks. Seems like that restriction is a little too restrictive sometimes. :-/

But surely there's some other, event driven, mechanism, which wouldn't involve polling the pin every second or more?
  • Aciera
  • Aciera's Avatar
11 Apr 2025 19:46
Replied by Aciera on topic Running an external program from a HAL pin

Running an external program from a HAL pin

Category: HAL

You cannot run an MDI_COMMAND when the controller is in estop. Try a python hal component that invokes your external program instead:
www.linuxcnc.org/docs/stable/html/hal/halmodule.html
  • Grotius
  • Grotius's Avatar
11 Apr 2025 19:41
Replied by Grotius on topic Strange behaviour of custom component

Strange behaviour of custom component

Category: Advanced Configuration

@Endian,

Ever thought about writing components in c code instead of halcompile code?
I bet writing in c will relax your code. You can also ask DeepSeek to write c code, then
compile it with cmake, and you are off.
I have old examples, if interested.

I don't see any memory allocation for multiple instances of the component at the moment.
If you like at threads.c you can see RTAPI... is used for setting up multiple threads.
  • endian
  • endian's Avatar
11 Apr 2025 19:09 - 11 Apr 2025 19:21
Replied by endian on topic Strange behaviour of custom component

Strange behaviour of custom component

Category: Advanced Configuration

Okay I got it... But how to customize them to not hard code them ... any ideas which will be readable after some time?

Thank you all...
  • jochen91
  • jochen91
11 Apr 2025 19:05
  • Hakan
  • Hakan
11 Apr 2025 18:40
Replied by Hakan on topic Strange behaviour of custom component

Strange behaviour of custom component

Category: Advanced Configuration

As Andy pointed out, those two variables are shared among all instances.
enum MODESWAP{WRITEMODE, WAITVELOMODE, INITIAL, WORKING, WAITINGFORENABLE, HOMING};
enum MODESWAP modeSwap;

enum HOMESTATE{HOMETRIGGER, HOMECONFIRM, HOMESEEKING};
enum HOMESTATE homeState;
It wasn't so easy to just "variable" before the lower lines so you might have to rework that a bit.
  • PCW
  • PCW's Avatar
11 Apr 2025 18:26
Replied by PCW on topic VHD Header Help

VHD Header Help

Category: Driver Boards

I included the pinout file if you want to use it as a starting point for a different configuration.

Note that having all muxed encoders is a little odd as non-muxed encoder show up as 2
encoders each, with only one being useable so the encoders are:

7I89 0..7
7i76 8 (9)
7I78 10 (11)

Aliased encoder in parens

I keep meaning to add the capability of supporting both encoder types
simultaneously to the driver, but there always seems to be something of
higher priority...
 
  • PCW
  • PCW's Avatar
11 Apr 2025 18:16

Mill setup troubles and questions (Speed display, at speed signal, coolant pump)

Category: General LinuxCNC Questions

If you want the coolant on al the time the spindle is on, add:

net spindle-enable => hm2_5i25.0.7i76.0.0.output-02

If you want the normal gcode controlled coolant, add:

net coolant-flood  => hm2_5i25.0.7i76.0.0.output-02

or

net coolant-mist   => hm2_5i25.0.7i76.0.0.output-02


As far as the spindle scaling goes, OUTPUT_SCALE must be 24000
If that does not work, the are errors elsewhere that must be fixed.
  • Fianna
  • Fianna's Avatar
11 Apr 2025 18:10
Replied by Fianna on topic VHD Header Help

VHD Header Help

Category: Driver Boards

What a legend, flashed and looking good now, thank you

I'll get on with the hal mods to get the encoder inputs "wired" up and see
  • pgf
  • pgf
11 Apr 2025 18:01 - 11 Apr 2025 19:36

Running an external program from a HAL pin

Category: HAL

[ Damn.  I edited the post to clarify some wording, and now the code blocks are broken.  I'm not going to try to fix them.  :-/  ]

I'd like to run an external program after an e-stop event.  I thought it was going to be easy.

I have the program (which goes into the background, so there's no delay) in M101.  M101 works when I invoke it via MDI.

I have a g-code snippet which invokes M101:
(subroutine which just runs my spindle off script)
o<my_spindle_off> sub
(MSG, my_spindle_off)
M101
o<my_spindle_off> endsub


That, in turn, is run via MDI_COMMAND, just like my homing and touch-off routines:

[code][HALUI]
MDI_COMMAND = o<reset_g54> call
MDI_COMMAND = o<auto_x_minus> call
MDI_COMMAND = o<auto_x_plus> call
MDI_COMMAND = o<auto_y_minus> call
MDI_COMMAND = o<auto_y_plus> call
MDI_COMMAND = o<auto_z_minus> call
MDI_COMMAND = o<home_x> call
MDI_COMMAND = o<home_y> call
MDI_COMMAND = o<home_z> call
MDI_COMMAND = o<reset_g54_rot> call
MDI_COMMAND = o<my_spindle_off> call


In custom.hal:

[code]loadrt estop_latch 
addf estop-latch.0 servo-thread 
net estop-loopout \
    iocontrol.0.emc-enable-in <= estop-latch.0.ok-out
net estop-loopin \
    iocontrol.0.user-enable-out => estop-latch.0.ok-in 
net estop-reset \
    iocontrol.0.user-request-enable => estop-latch.0.reset 
net remote-estop \
    estop-latch.0.fault-in <= hm2_7i96.0.gpio.003.in_not


And in custom_postgui.hal:

[code]net external-estop-off \
    estop-latch.0.fault-out => halui.mdi-command-10


With halshow, I can see net external-estop-off and pin estop-latch.0.fault-out change state when I go in and out of e-stop state, but my command never runs.  Ideas?

paul
[/code][/code][/code]
  • endian
  • endian's Avatar
11 Apr 2025 17:38 - 11 Apr 2025 18:11
Replied by endian on topic Strange behaviour of custom component

Strange behaviour of custom component

Category: Advanced Configuration

I edited the file to switches but no change at all...

I do not know what should be that reason of overflowing datas between components defineted by counts/names

only different component name is helping to split that computing stuff - but it is highly non-efective way to do that
  • spumco
  • spumco
11 Apr 2025 17:36
Replied by spumco on topic Rf45 clone glow up.

Rf45 clone glow up.

Category: Milling Machines

How's the rigidity of the harmonic drive? 

My 4th axis is based on a 32-size HD reducer, and I've not had any problems with stiffness.  It has a 6" faceplate and is on a 1-1/2 riser, so I can swing approximately 8" diameter parts or stock.  Note that the reducer is mounted in a steel frame/housing - not aluminum - to increase rigidity.

I've never machined 8"dia stock, but I have drilled 3"-4" off the rotary centerline.  1/2" drill in mild steel with no torsional deflection noted - at least not enough to cause the hole to be non-perpendicular or out-of-round.

I expect a 40-series reducer would be fine for a 6" or 8" rotary axis... and perhaps 5hp-10hp spindle class machine?  Like a Tormac 1100/1500, VF-2, or Fadal 3016... but not VF-6 unless you baby the rotary axis.  Probably be fine on any 30-taper machine.
Displaying 3631 - 3645 out of 26050 results.
Time to create page: 0.574 seconds
Powered by Kunena Forum