Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: Brian Barker on December 18, 2020, 03:40:03 PM

Title: X Box here we come!
Post by: Brian Barker on December 18, 2020, 03:40:03 PM
Hi all,
Daz The Gaz sent me the base that he started 4 years ago for the Xbox 360 plugin. I have spent the past week adding lots of goodies to the plugin. I am not done but it is starting to work the way I would like it to. The major change is that you can configure it like we do with the Shuttle Pro. You simply go into config and press a button or joystick. A dialog will popup with the options you have for settings. This makes it very quick to setup! I think this is the feature that most will like but here are some other highlights:
Diagnostics window for the XBox
Buttons can be mapped as inputs (this makes it so you can call functions in the signal script in the screen)
Exponential rates have been added to the analog sticks (this really helps with precision on the slow moves)
Reverse Jogging for each axis
Added a lockout toggle so you can disable the controller
Custom Gcode strings can be run like the Shuttle

TO DO:
BIG one for me is to make it so you can use the analog sticks as a mouse on the screen :)  I want to make it so you don't need a mouse at the machine if you have this. (I think it can be done I just have not started)
Need to make an input that shows the X Box locked state (so you can have an indicator on the screen to show if it is locked)
Jogging at feedrate (or limited to a % of Max) sometimes rapid is not needed, I don't know when that would EVER be but..
I know I must have a few more but I just wanted you to have something to use while your home for X-MAS

Here is where you can find the Plugin:
ftp://ftp.machsupport.com/Mach4/Plugins/mcXbox/

Enjoy and if you can think of other features I will see what I can do.

Special THANK YOU to Daz and have a happy holiday
Brian

 
Title: Re: X Box here we come!
Post by: jbuehn on December 18, 2020, 08:44:21 PM
Looking forward to trying this out!
Title: Re: X Box here we come!
Post by: Brian Barker on December 19, 2020, 07:18:41 AM
Great, test it out and tell me what you think. I need feedback so I can have the features you all want/need.

Thanks
Brian
Title: Re: X Box here we come!
Post by: Brian Barker on December 21, 2020, 11:09:05 AM
Quick update! I have it so you can command the mouse to move with the X box controller and you can do Left and right mouse button presses. This thing is sort of cool. I was able to select and load a Gcode file without ever touching my KB or mouse. I need to test more of the functions and add the locks, but we are making progress!
Title: Re: X Box here we come!
Post by: rhtuttle on December 21, 2020, 05:42:15 PM
Downloaded and moved both files to plugins directory.  started Mach4 and went to config plugins.  mcXbox does not show.  Do you have to have a controller plugged in for it to show?  did I miss something?

TIA
RT
Title: Re: X Box here we come!
Post by: rhtuttle on December 21, 2020, 05:57:33 PM
Took the one from my Mach3 mill and installed it on my Mach4 mill machine.  control panel says working properly.  Still does not show in config->plugins
Title: Re: X Box here we come!
Post by: jbuehn on December 21, 2020, 06:38:49 PM
Worked ok for me to enable the XBox plugin without a controller connected.
Title: Re: X Box here we come!
Post by: rhtuttle on December 21, 2020, 06:42:18 PM
What Mach4 build are you using?
Anything else besides putting the 2 files in the plugins directory?
Title: Re: X Box here we come!
Post by: jbuehn on December 21, 2020, 06:49:25 PM
I'm on 4517 right now.

Just copied mcXBox.m4pw and mcXBox.sig to C:\Mach4Hobby\Plugins\
Title: Re: X Box here we come!
Post by: rhtuttle on December 21, 2020, 06:57:13 PM
Ok, thanks. I'll try re-downloading and installing again.  Then move to the newer build if that doesn't work.
Title: Re: X Box here we come!
Post by: rhtuttle on December 21, 2020, 07:58:45 PM
Installed latest Mach4 version on my development computer.  Plugged the xbox controller in.  It works.  downloaded the 2 files and put them in the plugins directory.  No Joy.  Rebooted and loaded Mach4. Still no joy.  Don't know what else to try.  Win10 HP envy x360. Pokey57cnc.

RT
Title: Re: X Box here we come!
Post by: Brian Barker on December 21, 2020, 08:38:42 PM
New plugin uploaded has all the goodies . I think this one is really close to release!
Title: Re: X Box here we come!
Post by: rhtuttle on December 22, 2020, 11:45:04 AM
Still can't figure out why it doesn't show in the Config->Plugins
Latest Dev release and latest mcXbox download.  Would really appreciate any help.

TIA

RT
Title: Re: X Box here we come!
Post by: Brian Barker on December 22, 2020, 11:50:58 AM
step 1 Please remove the mcX360_LUA files from the plugins directory
Step 2 Open Mach4 and enable the mcXbox plugin under Config -> Plugins
Step 3 restart
step 4 Config
Step 5 Enjoy Xbox and all it's majesty
Title: Re: X Box here we come!
Post by: Brian Barker on December 22, 2020, 12:01:12 PM
Small update made... The Feedrate overrides would go past the bounds. I fixed that and uploaded Rev2.1.1 same download
Title: Re: X Box here we come!
Post by: rhtuttle on December 22, 2020, 12:16:52 PM
Brian,  I thought you were onto the problem with removing Daz's plugin.  Deleted those files as well as pokeys and pmdx.  No luck.  Rebooted and fired up M4.  Same result

Thanks for trying

RT
Title: Re: X Box here we come!
Post by: Brian Barker on December 22, 2020, 12:41:35 PM
I think your missing step2 :) Old versions of Mach4 would magically enable the plugins. That is gone now :(
Title: Re: X Box here we come!
Post by: Brian Barker on December 22, 2020, 01:37:16 PM
My version of step 2 is not so great... It should be as follows :
Step 2 Config-> Control  Plugin tab, and enable the plugin

Sorry about that!
Title: Re: X Box here we come!
Post by: rhtuttle on December 22, 2020, 03:36:08 PM
Had a few minutes to play around with this on my mill.  Super useful! Thank you!

ok, you asked.... and we will respond  ;)

Is there a way to toggle between step and continuous jogging with the joysticks?
Can you cycle through the jog increments?

What do the jog/MPG# and MPG# do?
The mouse control is cool but can you set it up so that if mouse is enabled the joysticks move the mouse and when not they have other function?

RT
Title: Re: X Box here we come!
Post by: Brian Barker on December 23, 2020, 06:23:00 AM
I never added a way to do incremental jogging. I don’t really know how that should be done to tell you the truth. That is why I added the massive amount of exponential to the jog values.

I think your asking to have two mappings. One while in mouse mode and the other then it is in mach4 ? That could be done but the setup becomes a little complex. I really like the tap a key and set it and I don’t want to get away from that.

I am willing to make some changes, you have any good ideas how that could be done and make it easy to setup and not complex to operate?

The MPG stuff is leftover from the shuttle pro, may need to be taken out
Title: Re: X Box here we come!
Post by: rhtuttle on December 23, 2020, 09:14:43 AM
Easy and not complex....hmm.  Oh, that's easy (easy for me to say >:D)

I would envision adding 3 mode radio buttons to you key selection dialog, Continuous Jog, incremental Jog and Mouse Mode.
now each key has a table of 3 actions that can be stored depending on which radio button is active.  In your code when a key is active you check to see if mouse mode is active else if incremental else continuous. 

With regards to incremental jog, when a jog key is pressed a state is set and action taken until that key value goes back to 0 when the state is reset while set the action is not repeated.

Just a suggestion,

RT
Title: Re: X Box here we come!
Post by: Brian Barker on December 23, 2020, 09:28:50 AM
The real issue I have with this is that I have no way to display what "mode" the buttons are in. For example you think it is in mouse mode you pick it up and move the joystick and jam the tool into the side of the part because it was in analog mode. I really don't want the user to have to add anything to the screen to make this work. So a radio button is sort of out for me :( . See my issue? Or maybe I am over thinking this and simply need to code it.
Title: Re: X Box here we come!
Post by: rhtuttle on December 23, 2020, 10:07:15 AM
I guess it would be useful to have others weigh in.  In Lee's old Mach3 plugin it was always an issue whether you were in continuous or incremental mode if you used the same buttons/joystick.  The incremental is the most useful for me.  I will use it as is, nice piece of work.

RT
Title: Re: X Box here we come!
Post by: Brian Barker on December 23, 2020, 10:22:20 AM
I could make it so you hold down a button and it will do INC moves with the joystick ... for example hold down the right joystick and move side to side will cause INC moves in any jog that is being done. That would not change the mapping of the entire controller.

Clear as mud or am I rambling geek speak again??
Title: Re: X Box here we come!
Post by: rhtuttle on December 23, 2020, 10:41:35 AM
I have used the left joy for x and y and right for z on my  mill.  I question whether holding down the right JS and moving it would jump back to continuous as you released it.  Would have to try and see how that worked. I would rather be in constant mode unless I held one of the triggers for continuous.  Just me.

RT
Title: Re: X Box here we come!
Post by: Brian Barker on December 23, 2020, 10:46:08 AM
I have been using the right and left throttles for the Z up and down. But that is me and I am not normal.
Title: Re: X Box here we come!
Post by: rhtuttle on December 23, 2020, 01:56:31 PM
One more item to consider.  If any of the controls are pressed when in the locked mode activate the rumble.
Title: Re: X Box here we come!
Post by: Brian Barker on December 23, 2020, 02:11:29 PM
Ahh.... I was thinking about using it to help hit the part into the vice... your idea is better...
Title: Re: X Box here we come!
Post by: rhtuttle on December 24, 2020, 07:21:06 PM
Brian,  Please check the latest release.  The joy sticks map both left and right the same as well as the JS up and down.  At least for me.  Also the descriptor strings for half of the choices are revered instead of reversed.
Oh, BTW, Merry Christmas!

RT
Title: Re: X Box here we come!
Post by: Brian Barker on December 24, 2020, 08:58:23 PM
You will need to remap, I “organized” the selections. Sorry I forgot to mention that . And Merry Christmas to everyone .
Title: Re: X Box here we come!
Post by: rhtuttle on January 23, 2021, 10:48:04 AM
Have been using the plugin a lot recently and totally love it!  The exponential on the thumb stick works great, until my little twitch comes in to play.  Would still like to have incremental moves available.  I could assign the thumbpad buttons for that and keep the sticks for continuous on my lathe.
Thanks for what I have already!

RT
Title: Re: X Box here we come!
Post by: Brian Barker on January 23, 2021, 11:00:53 AM
Great, I have a few OEM’s testing it as well and they seem to really like it as well. My issue with the incremental mode is how to make it happen. I am sort of thinking that we can have a default mode with an override button. So you could default to incremental and override to continuous or feed velocity. I like this idea because it is sort of a deadman switch... thoughts ? I could code that in later today I think.
Title: Re: X Box here we come!
Post by: rhtuttle on January 23, 2021, 11:06:30 AM
Works for me!  Rumble off?

Thaks,

RT
Title: Re: X Box here we come!
Post by: Brian Barker on January 23, 2021, 12:16:42 PM
I could do a soft rumble to tell you that it is in continuous mode
Title: Re: X Box here we come!
Post by: rhtuttle on January 24, 2021, 02:00:33 PM
Sorry, I was referring to my previous post of using the rumble whenever a key is pressed and the 360 is in the disabled mode to remind them to turn it back on rather continuing to press buttons until they remembered they turned it off.  Not that I have ever done that.

RT
Title: Re: X Box here we come!
Post by: Brian Barker on January 24, 2021, 03:46:53 PM
I did add some outputs that you could setup as LED’s in the screen designer if you like. My son and I where playing with the the analog gauges and the joysticks of the Xbox controller. That is lots of fun :)
Title: Re: X Box here we come!
Post by: Brian Barker on February 01, 2021, 09:31:19 AM
Hello all,
I have added a new INC mode and I hope you will like it. I have added a mode that  you can use to swap the controller in and out of inc mode. Try it out and see if you can figure it out. Also you can change the inc amount in the registers for the Xbox controller.

I almost forgot! I was goofing around with Mach4 and the Xbox and I got Mach4 connected to my son's train layout and I can move locomotives with the Xbox controller! This thing is VERY flexible! see what you can do and have some fun!

Thanks
Brian

Update : Attachment removed and is now in installs after version 4690 of Hobby
Title: Re: X Box here we come!
Post by: rhtuttle on February 01, 2021, 10:41:58 AM
Okay, now your just showing off 8)

Very nice.  Love the momentary switch.  Set mine to incremental and then used the right shoulder button to go to continuous.
Was able to edit the register for the slow jog distance and assigned one of the thumb pad keys to run user gcode2.  All work great!
Thank you very much for taking the time to do this.

RT
Title: Re: X Box here we come!
Post by: Brian Barker on February 01, 2021, 10:57:36 AM
RT,
I had a great time doing this and making the Mouse move on the screen was the one that I really wanted to do. I think as a mouse in a shop environment this is a cool solution. The jogging and all that is a bonus!

BTW you can use the registers on the screen to see and set the Inc distance and change them with sliders. I shocks me the amount of work you can do to the screen without any scripting!


Lets see if others pipe up on how they like it, I may be sticking a fork in this and moving onto the next thing.

Thanks
Brian
Title: Re: X Box here we come!
Post by: TrudnyRaptor on February 04, 2021, 05:13:39 PM
Hey, I wanted to buy a wireless controller for the Mach 4 myself. Wireless seems perfect, but only if it doesn't work with the software.
Title: Re: X Box here we come!
Post by: Brian Barker on February 04, 2021, 05:30:34 PM
The wireless Xbox controller will work :)
Title: Re: X Box here we come!
Post by: Brian Barker on February 05, 2021, 08:31:25 AM
Update... The Xbox controller plugin is part of the hobby installer as of version 4690. So no need to go looking and installing ;)
Title: Re: X Box here we come!
Post by: smurph on February 06, 2021, 03:36:56 AM
I think he meant to say 4609.

Steve
Title: Re: X Box here we come!
Post by: rhtuttle on February 06, 2021, 11:12:56 AM
Two things.  First, sometimes the joystick doesn't fully return to zero when released and the movement continues to creep at an extremely slow rate until you hit the cycle off.
Second, I never use two directions at the same time and would prefer to disable that type of movement.  Joysticks can be pretty fussy about minor off directions.

HTH
RT
Title: Re: X Box here we come!
Post by: rhtuttle on February 06, 2021, 03:06:35 PM
Downloaded and installed 4609 on my lathe computer.  I have a separate screen and profile so not overwritten. pmdx411.
 
Lost all input pin assignments >:(.

xbox incremental only moves positive.
Triggered continuous does as expected.
Lathe X axis incremental moves double the jog distance.

RT
Title: Re: X Box here we come!
Post by: Brian Barker on February 17, 2021, 01:51:25 PM
What! I have not changed any of the code in the Xbox.. Unless it is because I changed the numbering ... But I have not changed it in some time :(

Lets get you fixed ... sorry about that!
Title: Re: X Box here we come!
Post by: rhtuttle on February 19, 2021, 10:56:56 AM
Been testing 4612 on my laptop using simulation device. 

I select left joystick left as X rapid revered. Int/Cont Jog is grayed out. Next left joystick right, select X rapid, Int/Cont now enabled, check.
do the same for Y and right joystick for Z. Select other functions for buttons including right shoulder for X BOX Inc/Cont Momentary.

Take left joystick left and xdro increases by increment. left joystick right and xdro increases by increment.  Same action for Y and Z, positive movement only.  Hold the right shoulder button and move the joysticks and each move continuously in the expected direction.

Go back in to configure and it does not retain settings for joystick but does for buttons.

Title: Re: X Box here we come!
Post by: rhtuttle on February 19, 2021, 11:03:30 AM
I believe you have to set the minimum higher for any joystick movement.  When you use them for micro movement and release they do not always release all of the way to zero.  So rather than 0 to 100 (or254) 0 to 10 ignore, and start your scale from 11 to 100(254).

Same with diagonal movement.  Try to move slowly left and if you aren't exact in the left you may get some up or down movement included.  Either that or lock out diagonal, optional.

Title: Re: X Box here we come!
Post by: Brian Barker on February 19, 2021, 12:00:41 PM
We will be working on the Xbox more. I have shared the code with a few of the guys on here so I think we may have a few people helping :) . It will get much better!
Title: Re: X Box here we come!
Post by: rhtuttle on February 19, 2021, 12:34:51 PM
It also disables keyboard jogging in the X Axis.  Y and Z are still keyboard functional.  I'll go to lunch now and let you guys be ;^)
Title: Re: X Box here we come!
Post by: rhtuttle on February 19, 2021, 02:53:47 PM
Not sure if this is by design or not but using the controller 'cycle start' starts the loaded gcode file even if the mdi is focused.
Title: Re: X Box here we come!
Post by: lenne0815 on February 24, 2021, 02:29:06 AM
Hey Brian,

I was absolutely delighted to find the Plugin auto installed with the latest Mach4 version, it instantly almost got me back up to mach3 usability levels, I only had some minor issues with it:

Is it possible to use the analog triggers as a jog rate modifier ? I had it set up that way in mach3 - A fully tilted Joystick only jogged about 10% max jog rate but when you gradually pulled the analog trigger it speed up to full jogging speed.
This enables more granular movement approaching the work piece and also works as a "safety" of sorts as dropping the controller on a joystick never results in a full tilt jogging move.

I set up the increment modifier button, and it worked great but i think you can reduce the rumble by a lot, its a welcome reminder but it doesn't need to fling the controller out of one's hand ;)

This is a quote from you "Also you can change the inc amount in the registers for the Xbox controller." How do i do that ?

And one more point; there doesn't seem to be any official documentation on the Plugin, it's almost impossible to google as well such a important feature to many hobby users should jump right into view if Xbox / mach4 is searched for.

Anyhow, thank you so much for your work, I've been sorely disappointed by mach4 so far for my simple router and the Plugin does a lot to alleviate that.
Title: Re: X Box here we come!
Post by: rhtuttle on March 05, 2021, 12:40:29 PM
Is anyone working on this to correct the errors I posted above?  I have now tried it on 3 different configurations, Sim, pmdx411 and PoKeys75cnc and have the same behavior on each machine.  I also ran 4612 and it did not pick up the settings from the profile.

RT
Title: Re: X Box here we come!
Post by: GOOMBA on March 05, 2021, 01:20:47 PM
Rhtuttle,
We're not currently working on the plugin this week.
However I'll put it on the schedule early next week and go over the stuff you mentioned.
It won't be forgotten, Brian wrote the code and wears a lot of hats around here so it's hard to focus on just one subject for a extended period of time :)
I'll make sure we look into it!
Title: Re: X Box here we come!
Post by: rhtuttle on March 17, 2021, 12:36:38 PM
I get Motion Underrun from pmdx 411 any time I use the joystick at a very slow speed
Title: Re: X Box here we come!
Post by: rhtuttle on April 20, 2021, 04:56:59 PM
Anyone working on this?  Super useful when it works!
Title: Re: X Box here we come!
Post by: subnoize on October 30, 2021, 01:15:39 PM
I tried to go to the FTP site and it asked me for my credentials and I entered my login for machsupport.com but it came back with denied. What are the credentials needed to download this plugin? Is this a private beta or something?
Title: Re: X Box here we come!
Post by: subnoize on October 30, 2021, 04:15:32 PM
Nevermind! It's already installed in Mach4. Cool!