Welcome, Guest. Please login or register.
Did you miss your activation email?
December 02, 2008, 06:10:38 AM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  Brains Development
| | |-+  Suffering From Brain Damage....
Pages: 1   Go Down
Print
Author Topic: Suffering From Brain Damage....  (Read 232 times)
0 Members and 1 Guest are viewing this topic.
HimyKabibble
Active Member

Online Online

Posts: 258



View Profile
« on: August 18, 2008, 07:54:45 PM »

Today I built myself the worlds cheapest pendant, using an old video game controller.  I had no trouble getting most of the buttons to do what I wanted, but a few are giving me fits. 

I have been able to set two buttons to increase/decrease jog %, using the "Inc Jog %" and "Dec Jog %" "button presses", but this doesn't really do quite what I want.  I'd really like to have a single button that acts as a toggle between step and continuous jog modes, and two other buttons that move up or down a lpre-defined ist of jog rates or step sizes, depending on the mode the first button has set the jog mode to.  I tried doing a simple toggle of jog rate between 10% and 100%, but the problem is it continuously toggles back and forth between 10% and 100% for as long as the button is pressed.  How do I get it to generate only a single "button press" event to Mach for each press of the pendant button?

Regards,
Ray L.
Logged
Chaoticone
South Carolina, US
Administrator
*
Online Online

Posts: 2,809


Precision Chaos



View Profile WWW
« Reply #1 on: August 18, 2008, 09:48:30 PM »

Ray, How are you setting the gamepad up? In keygrabber?

Brett
Logged

Grin If you could see the things I have in my head, you would be laughing too. Grin
www.precisionchaos1.com
My guard dog is not what you need to worry about!
HimyKabibble
Active Member

Online Online

Posts: 258



View Profile
« Reply #2 on: August 18, 2008, 10:07:15 PM »

Brett,
    No, it's plumbed to a parallel port.  I had an old Microsoft PC game controller that has a "joypad" and 11 switches - all digital.  I stripped the chip and discretes off the board, and just wired all the switches to my second parallel port (I have a few switches left over....), and configured them all to OEM "triggers".  The functionality is all implemented in brains.  The joypad obviously serves as a jog controller (jog X left/right, jog Y left/right).  I setup some of the other switches as E-stop, Program Run, Zero All Axes, Inc. Jog % and Dec. Jog %. 

Regards,
Ray L.
Logged
HimyKabibble
Active Member

Online Online

Posts: 258



View Profile
« Reply #3 on: August 18, 2008, 11:39:19 PM »

OK, *maybe* I've answered my own question, but I'm not at the machine, so can't test it right now.  Here's an approach I think should work:

;; If OEM4 button is pressed, and current Jog % is below 30%, then set V0 to 30%
V0 = (~OEMInput4 && (Jog%DRO < 30)) * 30
;; If OEM4 button is pressed, and current Jog % is between 30% and 50%, then set V0 to 50%
V0 = (~OEMInput4 && (Jog%DRO >= 30) && (Jog%DRO < 50)) * 50
;; If OEM4 button is pressed, and current Jog % is between 50% and 75%, then set V0 to 75%
V0 = (~OEMInput4 && (Jog%DRO >= 50) && (Jog%DRO < 75)) * 75
;; If OEM4 button is pressed, and current Jog % is between 75% and 100%, then set V0 to 100%
V0 = (~OEMInput4 && (Jog%DRO >= 50) && (Jog%DRO < 75)) * 100
;; If OEM4 button is pressed, and current Jog % is 100, then set V0 to 10%
V0 = (~OEMInput4 && (Jog%DRO = 100)) * 10

;; If OEM4 button is *not* being pressed, copy V0 to Jog % DRO
Jog%DRO = OEMInput4 * V0

I hope this makes sense.  Is there a better way to do this?

I don't suppose the format of the brain files is documented?  I'd love to write a Perl parser that would take a text-based brain description (similar to the above) and output a binary brain file.

Regards,
Ray L.
Logged
HimyKabibble
Active Member

Online Online

Posts: 258



View Profile
« Reply #4 on: August 19, 2008, 01:53:41 PM »

OK, so that was a total disaster.  Locked the machine up solid, again.  I think I'm starting to understand how these things work, and it seems rather limiting, if I'm right.  Each "lobe" get evaluated any time *any* input changes.  If the result of the evaluation is true, then that is passed on to the next lobe.  What's got me stumped is how to effect changes that cause, directly or indirectly, an input to the brain that initiated the change.  This causes a loop, which locks up Mach3.  Also, I'd like to know how, if possible, to pass through a value, from a DRO etc., which is enabled by a logic condition.  For example, what I'm really trying to do here is look at the current value of Jog%DRO, decide what I want the new value to be, and set that.  But, doing that creates a loop, as Jog%DRO is both an input and an output to/from the same brain.  I've yet to find a way to make this work.  I suspect the "latch" lobe may help here, but I can't figure out what it does, or how to use it.  Seems like it could be used to "hold" an input value, to prevent it from changing while the brain is active, so the brain won't see the updated value it just wrote to the output/DRO/whatever.
Brains would be a helluva lot more useful if there were some documention that explains how they really work.  Having to figure it out by experimentation is very frustrating, and time-consuming.

Regards,
Ray L.
Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
*
Online Online

Posts: 770


Briceville, TN, USA



View Profile WWW
« Reply #5 on: August 30, 2008, 04:28:12 PM »

Ray,

  Use TWO brains, one that is your input condition brain, in your case you %jogDRO, and write that to a user dro, or set a logic condition LED.

BTW: It would help GREATLY if you would explain exactly what and how you want to do the brain and why.............

In the second Brain, pull in the user dro value, and work your formula or formula(s), in single or multiple rungs depending on what you want to do.

scott
Logged

All things Mach3, Screens, Wizards, Plugins, Brians, complete control solutions for complex machines, Macros, ATC's, any kind of CNC machine build, retrofit or repair.
HimyKabibble
Active Member

Online Online

Posts: 258



View Profile
« Reply #6 on: September 01, 2008, 09:52:29 AM »

Ray,

 Use TWO brains, one that is your input condition brain, in your case you %jogDRO, and write that to a user dro, or set a logic condition LED.

BTW: It would help GREATLY if you would explain exactly what and how you want to do the brain and why.............

In the second Brain, pull in the user dro value, and work your formula or formula(s), in single or multiple rungs depending on what you want to do.

scott

Scott,

    I tried doing basically what you suggested, but using a variable rather than a user DRO.  Does that matter?  I basically set it up so a falling edge on a pendant button (button pressed) would trigger a brain that looked at the current setting of a parameter, such as jog %, and set a variable to the desired new value.  Another brain watched for a rising edge on the same pendant button (button released), and set jog % to the value in the variable.  This still resulted in a loop that locked the machine up solid.
    "BTW: It would help GREATLY if you would explain exactly what and how you want to do the brain and why............." - I believe I did that in great detail in my first post in this thread....

Regards,
Ray L.
Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
*
Online Online

Posts: 770


Briceville, TN, USA



View Profile WWW
« Reply #7 on: September 01, 2008, 10:36:40 AM »

post up your brains here and I will look at them........
Logged

All things Mach3, Screens, Wizards, Plugins, Brians, complete control solutions for complex machines, Macros, ATC's, any kind of CNC machine build, retrofit or repair.
HimyKabibble
Active Member

Online Online

Posts: 258



View Profile
« Reply #8 on: September 01, 2008, 05:26:04 PM »

post up your brains here and I will look at them........

Well, I'd have to recreate them.  I didn't save the ones that didn't work.

Regards,
Ray L.
Logged
Pages: 1   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!