Hello Guest it is March 29, 2024, 07:22:01 AM

Author Topic: Random Fixture Offsets  (Read 4097 times)

0 Members and 1 Guest are viewing this topic.

Random Fixture Offsets
« on: May 24, 2016, 09:08:24 PM »
So I set out to make a zero all button and came up with this code....

local inst = mc.mcGetInstance()
rc = mc.mcAxisSetPos(inst,0,0)
rc = mc.mcAxisSetPos(inst,0,1)
rc = mc.mcAxisSetPos(inst,0,2)
rc = mc.mcAxisSetPos(inst,0,3)

What happens is after I make sure that everything is zero and machine is referenced (IE: current pos and machine coord = 0), I run this code and it sets a work offset on X at -3.000 and does not affect Y, Z or A at all.  If I repeat without making sure machine coord is at zero, it will set random numbers as offsets for all axes. 

Anyone seen anything like this?  I don't ever use offsets.  When I run mc.mcAxisSetPos(inst,0,0) it should set current position on X to zero.  Why does it always set X current pos to 3.000 and also set a fixture offset on X to -3.000?  Strange part is that this seems to work on my M4 PC at work, which is licensed, but not here at home, which is in demo mode.

What I want to do is create a button to set current position on all axes to zero, then another button the set machine zero to the same point.

Thanks
Re: Random Fixture Offsets
« Reply #1 on: May 24, 2016, 09:49:28 PM »
Errrr.  It helps to put the function parameters in the correct order.  Still would like to find a way to set machine zero to current position...or zero...with a button press.  mc.mcAxisSetMachinePos(inst,0,0) doesn't do it.

If I hit Reference All, it 0's out the machine coordinates without moving an axis. IE: references in place, but I don't have motors connected either.  Axes are enables so DRO's will move, but mo motors or motion controller connected.  Seems like there should be a function to set machine zero to current position.

Offline Chaoticone

*
  • *
  •  5,624 5,624
  • Precision Chaos
    • View Profile
Re: Random Fixture Offsets
« Reply #2 on: May 24, 2016, 09:52:00 PM »
If your at machine 0 and you set work coords to 3 the work offset would have to be -3.

3 + -3 = 0

Your setting the X pos 4 times.

Code: [Select]
rc = mc.mcAxisSetPos(inst,0,0) --Sets X to 0
rc = mc.mcAxisSetPos(inst,0,1) --Sets X to 1
rc = mc.mcAxisSetPos(inst,0,2) --Sets X to 2
rc = mc.mcAxisSetPos(inst,0,3) --Sets X to 3
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!

Offline Chaoticone

*
  • *
  •  5,624 5,624
  • Precision Chaos
    • View Profile
Re: Random Fixture Offsets
« Reply #3 on: May 24, 2016, 09:56:26 PM »
Make sure you have motors and axis enabled and configured... even if in simulation mode.

mc.mcAxisSetMachinePos() should set machine position.
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!
Re: Random Fixture Offsets
« Reply #4 on: May 24, 2016, 10:41:02 PM »
Motors are enabled and configured.  rc = mc.mcAxisSetPos(inst,0,0) zeros the X current position.  rc = mc.mcAxisSetMachinePos(inst,0,0) does nothing at all.  Here is the code.  The message box was just so I could see if the code was executing.

local inst = mc.mcGetInstance()
wx.wxMessageBox(tostring(inst))
rc = mc.mcAxisSetMachinePos(inst, 0, 0)
rc = mc.mcAxisSetMachinePos(inst, 1, 0)
rc = mc.mcAxisSetMachinePos(inst, 2, 0)
rc = mc.mcAxisSetMachinePos(inst, 3, 0)

Offline Chaoticone

*
  • *
  •  5,624 5,624
  • Precision Chaos
    • View Profile
Re: Random Fixture Offsets
« Reply #5 on: May 25, 2016, 09:59:11 AM »
Quote
rc = mc.mcAxisSetMachinePos(inst,0,0) does nothing at all.

I think your right. Did some quick testing this morning and it doesn't seem to be working here either.

What version are you running and are you using any motion device plugins? If so, which one?
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!
Re: Random Fixture Offsets
« Reply #6 on: May 25, 2016, 10:19:48 AM »
If I hit Reference All, it 0's out the machine coordinates without moving an axis. IE: references in place, but I don't have motors connected either.  Axes are enables so DRO's will move, but mo motors or motion controller connected.  Seems like there should be a function to set machine zero to current position.
If the simulator is your motion device, that is how it performs a 'home": it simply pauses for 1 second and then sets the axis position to zero.

If you are using a real motion device and do a "reference all axes (home)" and nothing moves (or the DROs don't indicate any motion since you have no motors connected), it sounds like either no home switches are configured, or you have the "Home in Place" column checked in the "Homing/Soft Limits" tab of the configuration dialog.

As far as setting each axis to zero, use the mcMotionSetPos() function.  That not only sets the DRO to zero but (more importantly) tells the motion planner that the axis is at zero.  Otherwise, as you've seen, Mach updates the offsets so that "DRO + offset" equals the motion planner's idea of the position.

Bob

Offline DazTheGas

*
  •  778 778
  • DazTheGas
    • View Profile
Re: Random Fixture Offsets
« Reply #7 on: May 25, 2016, 02:59:58 PM »
The mc.mcAxisSetMachinePos function has`nt worked for a very long time, I tried to use it for the ESS homeing offset bug, unfortunately the mcMotionSetPos function is a core function with no bindings to wxlua.

Another way of doing it would be to use mc.mcMotorSetHomePos(inst, 0, 0) - BEWARE this command works by MOTOR number not by AXIS number, it will do the work of both mcAxisSetMachinePos and mcAxisSetPos all at same time.

If you have a slaved motor on an axis then you must use the function on this too.

DazTheGas
New For 2022 - Instagram: dazthegas
Re: Random Fixture Offsets
« Reply #8 on: May 25, 2016, 03:19:07 PM »
Oops - sorry about that.  I just looked at our plug-in code and didn't check to see if the function was available in Lua.

Bob

Offline DazTheGas

*
  •  778 778
  • DazTheGas
    • View Profile
Re: Random Fixture Offsets
« Reply #9 on: May 25, 2016, 03:46:08 PM »
Oops - sorry about that.  I just looked at our plug-in code and didn't check to see if the function was available in Lua.

Easy done, ive spent 3 days trying to get toolpathcreate to work in wxlua to find theres no bindings  ::)

DazTheGas
New For 2022 - Instagram: dazthegas