Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: Pedio on November 01, 2015, 02:39:28 PM

Title: Showing selected axis
Post by: Pedio on November 01, 2015, 02:39:28 PM
Is there a way I can show what axis is selected for Jogging on a button? I would like to put a background behind the active axis DRO box if it is the one selected for jogging.

Thanks,
Peter
Title: Re: Showing selected axis
Post by: DazTheGas on November 03, 2015, 04:53:50 AM
Is there a way I can show what axis is selected for Jogging on a button? I would like to put a background behind the active axis DRO box if it is the one selected for jogging.

Thanks,
Peter

Didnt spot this thread,

Can you post a bit more info? where is the signal coming from to say what axis you are on.

DazTheGas
Title: Re: Showing selected axis
Post by: Pedio on November 03, 2015, 08:17:05 AM
Is there a way I can show what axis is selected for Jogging on a button? I would like to put a background behind the active axis DRO box if it is the one selected for jogging.

Thanks,
Peter

Didnt spot this thread,

Can you post a bit more info? where is the signal coming from to say what axis you are on.

DazTheGas

Daz,

When I use my ShuttlePro pendant the center wheels will move one axis at a time. I have configured the three buttons to be the axis selection. For example if I select the X axis and then move the wheel on the ShuttlePro it will move the X axis. The problem (albeit small problem) is that later I don't remember which axis has been selected so I end up selecting an axis again before moving the wheel.

Since my screen is right beside the machine it would be nice if I could have an indication as to which axis is selected. I was thinking of a change of the color of a button or place a second button behind the axis DRO.

Thanks for any help.
Title: Re: Showing selected axis
Post by: DazTheGas on November 03, 2015, 08:25:04 AM
I dont know much about the shuttle setup, what tells mach4 the axis - is it through the shuttle config or mach inputs config?? (perhaps I buy one)

DazTheGas
Title: Re: Showing selected axis
Post by: Ya-Nvr-No on November 03, 2015, 11:23:34 AM
I opened and watched the log file and noticed a pattern.

So then wrote a function and put it at the bottom of the plc script to parse out the current Axis data, ugly but it does show how to strip out data from a log file.

There does not seem to be a "Lua mc.mc command / for that API call" but the log file shows the API. So not a great way to do it, as it is checking every line the log file creates. and only reports the single line with the updated axis selected (Note: it does have to jog to show up in the log)

but it is a good lesson for me in scripting and Lua, Thanks
Title: Re: Showing selected axis
Post by: DazTheGas on November 03, 2015, 01:38:28 PM
What about the profile or registry for the shuttle, does any of the profile change between button presses, ie

If mcprofilegetint  shuttlepro0 -> input1 == 1 then do something

DazTheGas
Title: Re: Showing selected axis
Post by: Ya-Nvr-No on November 03, 2015, 02:31:29 PM
I am told that if you use the mpgaxis choices in the shuttle pro setup that you can.  ???
and you will have to setup mpg in your screen set too, I did not have any luck, as I have/had mine all working for my mpg dials

Could not get jog or mpg too step for me (center dial does nothing, outer dial worked but would not change axis on button presses)
had to go back to the jog selection for the axis button selections to work for me.
inner and outer dial worked a few revisions ago just fine.  ::)

but this did confirm and display what button press i selected as long as i used the mpgaxis option

    local inst = mc.mcGetInstance(inst)
    local mpg, rc
    mpg, rc = mc.mcMpgGetAxis(inst, 1); -- in this case mpg1
    mc.mcCntlSetLastError(inst, 'mpg axis = '.. tostring(mpg));

maybe i need a higher number axis selection, as i am using 3 now for mpg's and there might be some conflict with my current ones.
Title: Re: Showing selected axis
Post by: DazTheGas on November 03, 2015, 02:42:35 PM
I've just ordered one so I can have a play, I do love my toys :-)

DazTheGas
Title: Re: Showing selected axis
Post by: Pedio on November 03, 2015, 03:12:44 PM
I am told that if you use the mpgaxis choices in the shuttle pro setup that you can.  ???
and you will have to setup mpg in your screen set too, I did not have any luck, as I have/had mine all working for my mpg dials

Could not get jog or mpg too step for me (center dial does nothing, outer dial worked but would not change axis on button presses)
had to go back to the jog selection for the axis button selections to work for me.
inner and outer dial worked a few revisions ago just fine.  ::)

but this did confirm and display what button press i selected as long as i used the mpgaxis option

    local inst = mc.mcGetInstance(inst)
    local mpg, rc
    mpg, rc = mc.mcMpgGetAxis(inst, 1); -- in this case mpg1
    mc.mcCntlSetLastError(inst, 'mpg axis = '.. tostring(mpg));

maybe i need a higher number axis selection, as i am using 3 now for mpg's and there might be some conflict with my current ones.

The center dial is set by the jog increment you set on your screen. Be careful - if you set it to a big increment you can move the machine a lot. Each small increment move of the wheel moves the machine by one jog increment. I keep mine set at .01.
Title: Re: Showing selected axis
Post by: dude1 on November 03, 2015, 03:13:25 PM
the vistacnc pendants are really good to daz they have 2 for M4
Title: Re: Showing selected axis
Post by: Pedio on November 03, 2015, 03:14:26 PM
I've just ordered one so I can have a play, I do love my toys :-)

DazTheGas
You will not regret it. It is a really good pendant. Very cost effective for what you can do.
Title: Re: Showing selected axis
Post by: Ya-Nvr-No on November 03, 2015, 03:37:50 PM
i see it updating fine, just don't seem to get the dro's and buttons to follow the logic
Title: Re: Showing selected axis
Post by: robertspark on November 03, 2015, 04:07:18 PM
Don't buy the ShuttleXpress... can't seem to get mine to work in M4 (despite loading the Contour driver)

Bit of a daft question.... what is the difference between the Contour Shuttle Pro http://ergo.contour-design.com/ergonomic-mouse/shuttlepro-v2

And the XHC Shuttle.... https://www.sinjoe.com/index.php?route=product/product&product_id=210

the reason why I ask is because the XHC Pendant (WHB04-L)runs off a dll called a "shuttlePro.dll" file.... hence was not sure if some clever Chinese had hacked / cloned the Contour Shuttle Pro driver (as far as M3 was concerned) and if the XHC Pendant will work in M4?

Thanks as always (sorry have a habit of going off topic... its not intended).

I like the VistaCNC offerings... but they are pricey in the UK by the time the shipping + TAX man has had his cut (+ customs clearance handling fee!)
http://www.vistacnc.com/
http://www.ebay.co.uk/sch/i.html?_odkw=vistaCNC&_osacat=0&_from=R40&_trksid=p2045573.m570.l1313.TR0.TRC0.H0.XvistaCNC+mach4.TRS0&_nkw=vistaCNC+mach4&_sacat=0


Rob
Title: Re: Showing selected axis
Post by: DazTheGas on November 03, 2015, 04:17:39 PM
V2 pro with next day del £65. The xhc doesn't say anything about mach4 though,

Short messages from me tonight, on the 1 finger iPad again.

DazTheGas
Title: Re: Showing selected axis
Post by: Ya-Nvr-No on November 03, 2015, 04:23:55 PM
Have to think that 2788 is not working with the shuttle pro, only shuttle pro jog setup and button selection seems to work.

Lot of changes in the shuttle pro setup options with the last versions.
Title: Re: Showing selected axis
Post by: robertspark on November 03, 2015, 04:27:05 PM
That wasn't bad Daz, I just went with a pro myself... but I kind of like the rotary encoder idea too....

Hence have thought about using an Arduino Micro and running a keyboard clone via USB and getting a few buttons to replicate an axis change arrangement, start stop stop etc, then feed a 4 wire rotary encoder back to two pins on the ESS.

https://www.arduino.cc/en/Reference/MouseKeyboard
http://www.aliexpress.com/item/1pcs-manual-pulse-generator-RGT600-001-100B-24C-24V-hand-encoder-handwheel-collector-NPN-output-24V/32380345797.html
(they do a 5V one too!!!   My bob is 24v)

but then I like the package of the contour shuttle (and have used the Xpress a lot in M3 with a long USB lead and the plasma to jog axis etc).

Not a fan of wireless esp with electrical noise and a plasma.

Rob
Title: Re: Showing selected axis
Post by: robertspark on November 03, 2015, 04:27:55 PM
Have to think that 2788 is not working with the shuttle pro, only shuttle pro jog setup and button selection seems to work.

Lot of changes in the shuttle pro setup options with the last versions.

M4 = 2 steps forward.... one back?
Title: Re: Showing selected axis
Post by: smurph on November 03, 2015, 07:48:51 PM
It works fine.  In 2788, the way MPGs are handled internally is different.  Now there is the concept of encoders that plugins can "export".  And there is a new tab on the Mach config labeled "MPG" of all things.  :)  In that tab, the user can associate a Mach MPG (12 to choose from) to an encoder from any device.  %max vel and %max accel are there as well as reversing the direction. 

For many of you, if you had script based setup of the MPGs, then that stuff will need to go away.

The shuttle plugin exports 1 encoder.  The center wheel.  Additional button functions were added to allow the MPG axis selection as well.  One thing to note is that MPGs are separate than regular jogs.  The MPG axis can be selected independently of the jog axis.  Currently, there is not a way to select both the MPG axis AND the jog axis with one button function.  Not sure how to handle that at the moment. 

My setup is as follows:

MPG#1 -> /Shuttle0/InnerWheelCount, 1 count per detent, accel% 25, velocity% 35, reversed.

The first 4 buttons in the top row of the shuttle pro are:
1.  MPG1 Select X
2.  MPG1 Select Y
3.  MPG1 Select Z
4.  MPG1 Select A

The MPG increment is the current jog increment by default. 

So all I do is press one of my 4 buttons to select the desired axis and start dialing away on the wheel.  And it works really well.  I wish the detents were a little more noticeable on the shuttle, but it is what it is...

MPG#0 is configured to another MPG, so that is why I used MPG#1 for the shuttle.

Steve
Title: Re: Showing selected axis
Post by: patton on November 03, 2015, 08:45:26 PM
I have an XHC pendant and the dll file is not the same as the contour dll..... and the XHC pendant does not work with Mach4 and who knows if it ever will.... I like how the pendant works on Mach3 because of the cnc style mpg they use as apposed to the one on the contour.... but not having a pendant has been one of the limitations for me and Mach4 so I picked up a used contour shuttlepro off ebay the other day for $20.... thought that was a pretty good deal.
Title: Re: Showing selected axis
Post by: dude1 on November 03, 2015, 11:09:23 PM
robertspark you can use a arduino to make a pendant you can do it through modbus or keyboard emulation sinces you can assign any key to do whatever you wont in M4. a better option is a tennsy 3.2 or LT they have native support for keyboards or mouse and the liburys for it run a lot faster than the Arduino one`s. I have one for my wheelchair mouse.
Title: Re: Showing selected axis
Post by: robertspark on November 04, 2015, 02:19:46 AM
Patton, thanks very much for the insight that has cleared up a number of questions I had on the XHC pendant as I've not seen much written about them from an actual user, and you did get a really good deal on a ShuttlePro.

Thanks very much Blockhead for the info, I'll definatly be having a look into both those options.

Rob
Title: Re: Showing selected axis
Post by: Pedio on November 04, 2015, 09:12:33 AM
My shuttlepro buttons are as followed:

Top row   X=0     Y=0    X=0    All=0
(these allow me to zero any axis from the pendant)

Second row  X    Y   Z   Move window
(the first three allow me to change the focus between the axis - the last button allows me to move the M4 window between the main computer and the touch screen by the CNC machine - the main computer is ~ 20 feet away from the table)

Button on left of wheels - Feedrate Minus

Button or right side of wheel - Feedrate Plus

Buttons below wheel on right - Go    and     Estop

Buttons below wheel on left - Jog rate increase   and    Jog rate decrease
(don't use these much - will probably change them for tool change or park head fot loading the table)

The wheels in the middle are preset
Outside wheel is for course moves - the farther over you turn the wheel the faster the selected axis moves. You move this wheel one way for one direction and the other way for the other direction.

The center wheel moves one increment at a time. It is set by the current Jog increment on the M4 screen. For example I leave mine at .01 and then you can spin the center knob and it will move the axis in a smooth manner in the direction you spin the knob (really cool to do touchoff or fine tuning of setting the 0,0,0 of the work piece.

One thing I found out when setting up the ShuttlePro is that you can use the ShuttlePro setup AND the M4 module at the same time. For example I had been doing previous testing to see if I could get keyboard inputs to work with the ShuttlePro. When I installed the M4 module I found I could move different Axis at the same time. For example the X and Y would both move. Just be careful about how you use the ShuttlePro interface. I used the ShuttlePro interface to configure my move window button and the M4 interface to program the rest of the buttons.

I mounted the ShuttlePro to my pendant on the machine using 2 sided tape. It is right beside my switch and POT for the spindle.

Very useful piece of equipment.
Title: Re: Showing selected axis
Post by: Ya-Nvr-No on November 04, 2015, 09:49:46 AM
Thanks Steve

yep there it is,  ;) I must have missed that in the release notes.  ::)
Title: Re: Showing selected axis
Post by: Pedio on November 04, 2015, 10:05:57 AM
I will check the version I use for the inner wheel programming. I am using one version older of M4. The lastest version crashes on startup for me.

Perhaps I can use the new version of the ShuttlePro module. I will check.
Title: Showing selected axis
Post by: andrew.adsit on November 06, 2015, 04:16:29 PM
Arduino Pro Micro have native USB support.


Sent from my iPhone using Tapatalk
Title: Re: Showing selected axis
Post by: dude1 on November 06, 2015, 04:51:51 PM
all 32u4 boards do, it just not that simple to use that`s why I use tennsy boards cheaper, faster, better code, and very small
Title: Re: Showing selected axis
Post by: DazTheGas on November 06, 2015, 05:33:59 PM
Just for Pedio, I've figured out your original question but will have to explain when I get home, not this one finger iPad on a typical Friday night.

Daz
Title: Re: Showing selected axis
Post by: DazTheGas on November 07, 2015, 08:22:54 AM
Right Pedio, Ive setup my shuttle as follows

In the mach configuration/MPGs - Ive got the innerwheel set to mpg1

In the shuttle plugin config I have assigned the axis keys to MPG1 Select X - MPG1 Select Y - MPG1 Select Z

In the PLC script is

Just change to what you need..

Code: [Select]
if mc.mcMpgGetAxis(inst,1) == 0 then
scr.SetProperty('droCurrentX', 'Bg Color', 'Red')
else
scr.SetProperty('droCurrentX', 'Bg Color', 'Black')
end

if mc.mcMpgGetAxis(inst,1) == 1 then
scr.SetProperty('droCurrentY', 'Bg Color', 'Red')
else
scr.SetProperty('droCurrentY', 'Bg Color', 'Black')
end

if mc.mcMpgGetAxis(inst,1) == 2 then
scr.SetProperty('droCurrentZ', 'Bg Color', 'Red')
else
scr.SetProperty('droCurrentZ', 'Bg Color', 'Black')
end

Got to admit, I do like this shuttle :-)

Daz
Title: Re: Showing selected axis
Post by: Pedio on November 09, 2015, 08:53:25 AM
Thanks Daz - The shuttlepro is pretty slick.
Title: Re: Showing selected axis
Post by: Pedio on November 09, 2015, 02:48:54 PM
Daz,

I don't seem to  have the MPG tab that Ya-Nvr-No shows in his post on this thread. Thoughts?
Title: Re: Showing selected axis
Post by: DazTheGas on November 09, 2015, 02:57:30 PM
Go to ftp and d/l development version

Daz
Title: Re: Showing selected axis
Post by: Pedio on November 09, 2015, 03:37:14 PM
Daz - I did a search for MPG on the site and did not find the wizard. Is there anywhere else I should be looking?

Thanks
Peter
Title: Re: Showing selected axis
Post by: Pedio on November 09, 2015, 03:39:56 PM
Found it ftp://machsupport.com/Mach4/DevlopmentVersions/

I did not know these existed.

Thanks,
Peter
Title: Re: Showing selected axis
Post by: Pedio on November 09, 2015, 04:34:53 PM
Daz,

I got everything downloaded and followed your instructions. I tried setting the shuttlepro buttons to MPG1 Select X - MPG1 Select Y - MPG1 Select Z but nothing moved. I set the buttons to Jog/MPG1 select X - etc and the axis moved. I don't get the DRO color change with this. I looked at the code but could not figure out where to change it. I have it toward the end of the PLC script.

I am on 2797 if this makes a difference.

Thanks,
Peter
Title: Re: Showing selected axis
Post by: DazTheGas on November 09, 2015, 05:16:00 PM
I will have a look tmoro but as far as I know the shuttle plugin has changed again since I did that code.

Daz
Title: Re: Showing selected axis
Post by: Pedio on November 19, 2015, 09:01:15 AM
Daz - did you get a chance to look at the DRO changing color when the axis is selected on the new version of M4.
Title: Re: Showing selected axis
Post by: DazTheGas on November 19, 2015, 09:53:33 AM
can u post what you have the button assigned to and what mpg in mach4 you have set and i will duplicate locally.


Daz