PP2 & Metric machine configuration

More
30 Jul 2019 19:53 #140974 by davidimurray
My journey of getting my Pathpilot parallel port lathe up and running is moving on. Hit an intriguing stumbling point today.

My original lathe config under Linuxcnc is in metric. I've transferred all my HAL settings over and the machine is moving in all axis. The strange issue I've come across is that the DRO's are all out by a factor of 25.4. A dig around and I found this thread - forum.linuxcnc.org/pathpilot/31531-metri...stem-bug-in-pathpilo - that described exactly my issue.

So I edited the tormach_lathe_ui.py file as describe and no change. It seems I can set whatever value I want as the scaling and nothing changes. I've been digging through the python file but cannot see where the actual scaling factor is used. Interestingly, it is picking up the unit setting from the ini file, I've proved this by putting a G20 in the startup code and pathpilot is automatically detecting the metric configuration and changing the mode to G21 as PP starts.

Any help would be much appreciated.

Cheers

Dave

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

More
31 Jul 2019 22:12 #141054 by smgvbest
You have to remember PP is written for Tormach Machines which exclusively use inch ballscrews so in many places in the ui code this assumption is made. you'll have to fix them all

this is what i see on a cursory look at just the mill ui. really should check all python files, a grep could help there
is see reference in
ui_common.py as well

in the mill ui
these are places to check for where tormach may be correcting for the assumption the machine is in inches
some of these are snippets, i put ... at the end of each block if it is
def get_linear_scale(self):
        """Return the scale factor for all linear axes based on current G20/G21 mode"""
        return 25.4 if self.g21 else 1.0
def on_touch_z_button_release_event(self, widget, data=None):
        btn.ImageButton.unshift_button(widget)

        valid, dro_val, error_msg = self.conversational.validate_z_touch_val(self.dro_list['touch_z_dro'])
        if not valid:
            self.error_handler.write(error_msg, ALARM_LEVEL_LOW)
            return
        ind = 2
        # the G10 command wants values in mm if G21, but actual_postion and g5x_offsets are in machine units (in.)
        # so we take the sup value and turn it into machine units, then send the offset command in g20/21 units
        supplemental_offset = dro_val / self.get_axis_scale(ind)
        tool_number = self.status.tool_in_spindle
        ...
def get_current_gcode_states(self, param):
        outstr = '\n<span color="#003aff">'
        g20 = 'inches'
        active_gcodes = self.active_gcodes()
        for gc in active_gcodes:
            if gc in 'G54G55G56G57G58G59': outstr += '<b>'+gc+'</b>'+' - current work offset\n'; continue
            if gc == 'G20'               : outstr += '<b>'+gc+'</b>'+' - machine in <b>inch</b> units\n'; continue
            if gc == 'G21'               : outstr += '<b>'+gc+'</b>'+' - machine in <b>metric</b> units\n'; g20 = 'mm'; continue
            if gc == 'G90'               : outstr += '<b>'+gc+'</b>'+' - distance mode <b>absolute</b>\n'; continue
            ...
def update_gui_unit_state(self):
        is_metric = self.status.gcodes[linuxcnc.G_CODE_UNITS] == 210
        if self.g21 == is_metric:
            return

        self.g21 = is_metric

        # swap button art on jog step sizes
        self.clear_jog_LEDs()
        self.set_jog_LEDs()
        # store off in redis for startup in same mode next time.
        self.redis.hset('machine_prefs', 'g21', self.g21)
        if self.g21:
            self.dro_long_format = "%3.3f"
...
class Tormach_Mill_Gremlin(gremlinbase.Tormach_Gremlin_Base):
    def __init__(self, ui, width, height):
        gremlinbase.Tormach_Gremlin_Base.__init__(self, ui, width, height)

        self.ui_view = 'p'
        self.g21 = self.status.gcodes[linuxcnc.G_CODE_UNITS] == 210
        if self.g21:
            self.grid_size = (10.0/25.4)
        else:
            self.grid_size = 0.5
        self.connect("button_press_event", self.on_gremlin_double_click)
def set_grid_size_small(self, widget):
        size = (5/25.4) if self.ui.g21 else .1
        self.set_grid_size(size)
        self.ui.gremlin_options.update_grid_size('small')

    def set_grid_size_med(self, widget):
        size = (10/25.4) if self.ui.g21 else .5
        self.set_grid_size(size)
        self.ui.gremlin_options.update_grid_size('med')

    def set_grid_size_large(self, widget):
        size = (25/25.4) if self.ui.g21 else 1.0
        self.set_grid_size(size)
        self.ui.gremlin_options.update_grid_size('large')

you'll probably want to review all of these if you want to change the units in the ini file instead of the method used by tormach which assumes the machine is in inches

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

More
04 Aug 2019 11:10 #141321 by davidimurray
Thanks for those suggestions. I haven't been able to get in the workshop for yet to have a look again.

Think I might take the lazy route and change may configuration from mm to inches ;)

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

More
08 Aug 2019 06:41 #141655 by dinkata
everything in inches
[AXIS_0]
TYPE = LINEAR
MAX_VELOCITY = 1.0
MAX_ACCELERATION = 15.0

MAX_JOG_VELOCITY_UPS = 1.0
MIN_JOG_VELOCITY_UPS = 0.008333

# 20% higher
STEPGEN_MAX_VEL = 1.2

# 2.5x
STEPGEN_MAXACCEL = 37.5

SCALE = 16933.333
# time in nanoseconds
DIRSETUP = 10000
DIRHOLD = 10000
STEPLEN = 8000
STEPSPACE  = 5000

FERROR = 0.050
MIN_FERROR = 0.010

MIN_LIMIT = -10.000
MAX_LIMIT = 0.000001
HOME_OFFSET = 0.025
HOME_SEARCH_VEL = 0.750
HOME_LATCH_VEL = -0.050
HOME_IGNORE_LIMITS = YES
HOME_SEQUENCE = 0
change only G20 => G21 here
[RS274NGC]
PARAMETER_FILE = ~/lathe_data/emc.var
RS274NGC_STARTUP_CODE = G7 G18 G20 G90 G64

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

More
11 Sep 2019 06:35 #144790 by rafferty
I used the same approach, everything in inches and G21 in the RS274NGC_STARTUP_CODE line.

No problems with PP1 but since updating to PP2 I've not done much but it appeared OK.

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

More
11 Sep 2019 14:03 #144822 by pl7i92
Just a Guess it is only the mashine Config
if you change the VIEW to mm and all Gcode files got G21
it will work as on all mashines bevor
there is also a startup code but on PP i woudent trust that
use G21 for every File

if you get a postprocessor of your choice get G21 to all Toolchanges even at block mode
so you are at the safe siode on RUN
it may look different on the manuell base
but it shoudt work as G21 is in nominal

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

Moderators: cncbasher
Time to create page: 0.091 seconds
Powered by Kunena Forum