Hello Guest it is April 28, 2024, 06:51:43 AM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - mcardoso

Pages: « 1 2 3 4
31
Interesting question here...

I am writing a communications script (serial) to some servo drives. I want to abstract the communications so I can use a call like this anywhere in mach.

CurrentPosition = DriveCommunications (Position), where position is a parameter code to be read from the drive.

When DriveCommunications() is called, it assembles an ASCII string complete with a checksum and writes it over the serial port. It then analyzes the response, checks for errors, and returns the result.  The whole thing is a bit more complicated, but that's the just of it.

Once a transmission is sent to the drive, a brief delay (a couple milliseconds) must be enacted to allow the drive to respond before reading the serial buffer. I successfully added a delay using wxTimer for a different script, but that calls a new function which makes returning a value from DriveCommunications() impossible AFAIK. I could also just use a plain old delay, but I don't want to block other functions from executing during this time. I am hoping to get this to the point where I can stream data from the drives and not interfere with other Mach functions.

My question is, is there a way to break out of the middle of a function, but return to execute the remaining code after a short while?

32
Mach4 General Discussion / Working Script - Universal MPG pendant
« on: March 12, 2019, 08:58:44 PM »
I purchased a 4 axis universal (15 wire pigtail) pendant off of ebay for $50. I have been working with Andy at Warp9TD (Smoothstepper) to get it working with Mach 4.

I won't bother to recreate the instructions, Andy at Warp9TD did a great job here (https://warp9td.com/index.php/faq/faq-pendants-and-mpgs#WireAMultiWirePendant). The things that tripped me up were the counts per detent = 4, and I incorrectly mapped the MPG to ESS Encoder 0 instead of Encoder Aux 0. Once that last one was corrected it worked perfectly.

I haven't had a chance to use it in practice yet, but I expect it will be in my top 3 favorite changes to this machine. In the past I found edge finding to be a huge chore, this will save me so much time.

Following the instructions, I set the velocity and acceleration to 100%. This nearly shook the paint off of the walls when jogging in .01 steps due to the outrageous acceleration on my machine's servos. I found 10% acceleration was snappy but much smoother, I might even go less. There is a small but still noticeable delay (might only be a few dozen milliseconds) from the click of the MPG to motion on the axis. I don't find it annoying as it is only noticeable when moving single steps, but it is present. My step settings are .0001, .001, and .01 which corresponds to (very roughly) 1, 10, and 100ipm respectively when the wheel is spun at a quick clip

In the 3 axis mach profile, I will map the 4th axis on the pendant to the spindle. In my 4 axis profile, it will jog the rotary table.


33
Mach4 General Discussion / Notepad ++ Add M4 API
« on: March 11, 2019, 10:40:26 AM »
Hi All,

Is there any way to integrate the Mach 4 API calls into notepad++ so it recognizes the commands? Pretty much just for the autofill text.


34
Hi All,

I purchased my copy of Mach 4 today!  ;D

I am finishing up the rebuild on the machine and have run into a few issues. They all seem to be unrelated but I figured I would save some space and ask for help for all of them in the same place...

System Setup:
Motion Controller: Ethernet Smoothstepper
Computer: Allen Bradley VersaView 5400 PC, 4 core Intel Atom E3845 chipset @ 1.90GHz, 4.0Gb of memory and runs Win 10.
Computer #2: HP Omen laptop, Intel i7 6700HQ 3.5GHz, 32Gb memory, running Win 10
Mach 4 version: 4.2.0.3804
Warp 9 Tech ESS plugin version: 232 (1.0.1.232)

1) When exiting the "Configure" -> "Control" menu, two general purpose outputs energize for a brief moment (regardless of machine state). These are tied to my power drawbar solenoid and emits a loud exhaust noise (although the cylinder doesn't move since both sides end up pressurized). I have these outputs tied to a screen load script and a signal script, but neither should do anything unless an external pushbutton is pressed.

2) When approaching my limit switches, some of the time when the switch is triggered I get a message in Mach 4 that says something to the effect of "ESS: Motor 0++ Limit triggered" and all axes become disabled. This is fast and very repeatable in position even when jogging at a good clip. Other times I get a message (from Mach I think) that says something like "X++ limit Active". It reacts very slowly and does not disable the axes or stop jogging (it does allow me to crash the machine). If I let go of the jogging key and press it again, it won't let me start jogging saying something like "Can't jog towards X++ limit", but again it doesn't stop the machine motion.

This issue also manifests itself when using "Ref all Home". When things seem to be working right, my axes home until the switch triggers, then reverse until the encoder marker is found. This gives home values repeatable to the .0001 mark on the DRO. However when mach is only showing the "X home switch active" message, the axis drive past the switch and contact the end of machine travel. The switch is energized and visible in the mach diagnostic window, but does not register to stop the homing.

It seems to me that Mach only registers the limit/home signals as a courtesy and relies on the ESS to stop motion or home an axis. It seems like sometimes my ESS is not registering the limit or home event even though the input signal is being received and transmitted to mach. Bu that is just an uneducated theory based on my observations.

3) When I enter M03, M05, and S#### commands into the MDI, my Step/Dir servo spindle often emits loud clunks when starting or changing speeds. This occasionally generates a bus overvoltage fault on my servo drive indicating the motor was requested to make some kind of instantaneous deceleration.

This behavior is NOT seen when clicking the spindle CW button on the Spindle section of Mach. I have not yet tried running the same code segments from a gcode file.

4) When exiting the Configure -> Control menu, keyboard jogging is disabled even though the button remains illuminated. I have to toggle the button to reenable keyboard jogging.

Looking for any thoughts. All these issues might be user error, but I would like to find a resolution.

Thanks!

35
Mach4 General Discussion / Mach 4 Profile Settings Reset/Lost
« on: March 08, 2019, 09:14:36 AM »
Thought I would share an experience that I had.

I run Mach 4 on an industrial PC which powers down when the electrical cabinet is shut off. Last time I turned it on, I got some weird messages when opening Mach 4. Turns out that my custom profile I have been using got completely reset to defaults (ESS plugin disabled, all I/O deleted, screen set changed, etc.). I think that my practice of powering the PC off without performing a full Windows shutdown may have corrupted my Mach 4 profile (even though Mach 4 was closed and I had given it a minute or so to save its settings).

I have daily backups, so this is no big deal, but I thought I would post as a word of caution to others. I will now be shutting down Windows before powering off the PC and continuing to save backups before any script/screen/settings edit.

36
Finally broke the ice and made my first LUA script (I have several others that don't work right now). Thought I would share. If you see anything that could be made cleaner, please let me know.

Description of Operation: Power drawbar is a 2 position air cylinder connected to a 5 port, 4 way, 3 position, center exhausting valve. The operator interface is a momentary N.O. pushbutton. While the pushbutton is pressed and held, the drawbar is extended and the tool released. When the button is released, the cylinder retracts and once the cylinder is retracted all outputs turn off to depressurize the cylinder.

In the Mach 4 screen load LUA script, I added the following code:

Code: [Select]
--------------------------------------
-- PDB Timer Code --
--------------------------------------

PDBTimerPanel = wx.wxPanel (wx.Null, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize )
--This line creates a Window which has properties exposed to Win10. This window will not appear on screen, but the Windows event will be tied to it.

PDBTimer = wx.wxTimer(PDBTimerPanel)
--This line creates the actual timer 'PDBTimer' which will be referenced throughout the code
PDBTimerPanel:Connect(wx.wxEVT_TIMER,
function(event)
local PDBRetract, rc = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT2) -- Is mapped to ESS PDB Retract

mc.mcSignalSetState(PDBRetract, 0)
mc.mcCntlSetLastError(inst, "PDB Retracted")
PDBTimer:Stop()

end)

In the Signals LUA script, I added the following code:

Code: [Select]
---------------------------------------------------------------
-- Power Drawbar Pushbutton
---------------------------------------------------------------
if (sig == mc.ISIG_INPUT3) and (state == 1) then
local PDBExtend, rc = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT0)
mc.mcSignalSetState(PDBExtend, 1)
mc.mcCntlSetLastError(inst, "PDB Retracted")
end

if (sig == mc.ISIG_INPUT3) and (state == 0) then
local PDBExtend, rc = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT0)
local PDBRetract, rc = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT2)
mc.mcSignalSetState(PDBExtend, 0)
mc.mcSignalSetState(PDBRetract, 1)
PDBTimer:Start(500)
mc.mcCntlSetLastError(inst, "PDB Timer Started")
end

The basis for this code was DazTheGaz's Youtube video on wxTimer (Thank you!):

https://www.youtube.com/watch?v=nkCx2xdoPEw&feature=youtu.be


Future modifications will be to automatically retract the cylinder when Mach 4 loads, to save the position of the cylinder to a register, and to interlock spindle operation so the spindle cannot start while the drawbar is extended.

37
I just migrated from Mach 3 to Mach 4 and I am still running the demo version of the software. I understand the limitations of the demo timeout but I am fairly certain that the following issue is completely unrelated to the timeout. I wanted to ask here before I jump to conclusions and call it a bug.

System Setup:
Computer: Allen Bradley VersaView 5400 PC, 4 core Intel Atom E3845 chipset @ 1.90GHz, 4.0Gb of memory and runs Win 10.
Computer #2: HP Omen laptop, Intel i7 6700HQ 3.5GHz, 32Gb memory, running Win 10
Mach 4 version: 4.2.0.3804 Unlicensed
Warp 9 Tech ESS plugin version: 232 (1.0.1.232)

The issue I have run into over the weekend with Mach 4 is that it hangs after 3-5 minutes of running code. This is the demo version right now, but it is not the timeout (I have seen the timeout message and know what it looks like).  The machine will be running and BANG, all the servos stop dead but remain enabled. The software ESTOP does not shut them down (thankfully I also have a hardware ESTOP to kill drive power). The Mach 4 greys out and the cursor is the blue Win 10 waiting circle. I cannot click any on screen buttons and task manager lists the program as "not responding". This happens repeatably both running Artsoft sample GCode (roadrunner and outhouse) as well as a 2 hour long program I recently ran without issues on Mach 3. The program never recovers and has to be closed with task manager. The Smoothstepper remains waiting for Mach signals and won't reconnect when Mach opens leading to me having to power cycle the machine.

At first I thought that this was due to an underpowered computer. The VersaView 5400 computer that is on the machine runs on a 4 core Intel Atom E3845 chipset @ 1.90GHz. It has 4.0Gb of memory and runs Win 10. This is very much on the bottom edge of the system performance requirements for Mach 4 (especially the memory), but there are posts in MachSupport about people not having issues running mach on much less powerful computers without issues. During loading of Mach 4 the CPU is between 70-80%, at idle it is 30-40%, when loading a Gcode program 70-80% and while running the machine it holds quite steady at the mid 60's%. The memory utilization never got above 2.0Gb (50%). This all seems like the computer was doing just fine, but I was convinced that this computer just didn't have the guts to run Mach 4. Until...

To test the situation, I installed the same version of Mach 4 and ESS utilities onto my laptop (Intel i7 6700HQ 3.5GHz, 32Gb of memory, Win 10). I copied the configuration file from the CNC computer to my laptop and connected to the smoothstepper without issues. I ran the same test files and sure enough, Mach 4 crashed about 5 minutes into the code same as the other computer. I tried this several more times and had the same results. I then tried running the machine from Mach 3 on my laptop and it finished the 2 hour and 20 minute program with no issue whatsoever.

My experience is that once I start running code, within 5 minutes Mach 4 will crash and become unresponsive. This seems to not be related to the computer it is being run on, and so far doesn't seem like it is caused by an underpowered PC. I have gotten the demo timeout message while jogging the motors, but this is not what I'm used to seeing.

Any experience or thoughts would be greatly appreciated. My first impressions of Mach 4 were very good, but if I can't run my machine without the program crashing then I'll probably have to stay with Mach 3.

Edit: I remember testing mach 4 on this laptop a year ago without any other issues than the demo timeout. Is it possible that I am having issues with this specific build of Mach 4 or the ESS plugin?

38
Note: If this is a double post, I'm sorry. Something happened while uploading this the first time and I don't believe it actually posted.

Hi All,

I am nearing completion of a CNC mill upgrade using AB Ultra 3000 servo drives and migrating from Mach 3 to Mach 4. I have a number of thing I hope to accomplish and I am asking for resources or advice on where to find information on them. See the attached image of the control panel.

1) Basic Mach 4 configuration: I feel pretty good on setting up the Smoothstepper and configuring basic I/O. I have a working test setup in Mach 3 so matching settings shouldn't be too terrible.

2) Basic Servo enable logic: I would like to add buttons to the screen to separately enable the motion axes and servo spindle using digital outputs. I have watched as much as I could on the screen editor and feel pretty solid on this, however I haven't yet gotten to the point where I feel comfortable using LUA to set outputs using on screen buttons. I knew Mach 3 VBS very well, but this is a whole new adventure! Any links to sample code would be greatly appreciated.

3) Basic power drawbar control: I have a pushbutton on the machine which I will need to link to a pair of outputs for drawbar release and clamp. I'm assuming this will be a very similar script to #2 except it adds a timer.

4)I have 3 separate "ESTOP" type inputs (normal system ESTOP, excessive cabinet temperature, DC supply or contactor failure). I'd like them all to stop the machine, but have custom messages for each type of input.

5) Pendant interface: I have a MPG which I'd like to set up as my primary method of jogging the machine. I have no clue if this is native functionality to Mach 4 or if scripting is required for each function. Advice or examples would be wonderful here.

6) RS485 ASCII to drives: Here is where I think things will get complicated   ;) . I am controlling all of the servo axes using step/direction or quaderature outputs from the Smoothstepper. That will get just about everything working by itself, however the Ultra 3000 drives I am using have an amazing feature set that is available through serial communication. I have tested these features and find they work very very well. For anyone interested, here is a link to the manual that shows all the settings and data available over serial (https://literature.rockwellautomation.com/idc/groups/literature/documents/rm/2098-rm003_-en-p.pdf).

In order to access this data, I will need a LUA script to write ASCII data over my computer's embedded serial port. I have seen a small handful of people posting about trying to use LUARS232 package/module, however never anything definitively successful. I am hoping to work with everyone on this wonderful forum to get this working. If I can, here are some of the things I will be able to do:
  • Absolute homing using encoder position data stored in the drive. I may never need to home to a switch again!
  • Real time motor load monitoring
  • Drive diagnostics like temperature, amperage, voltage, etc.
  • Reading fault codes and displaying them in a user readable format in Mach
  • A ton more that I haven't yet thought of!

I will be so grateful for anyone who has experience with any of these things to share their knowledge. I will continue to post updates on this build as I go along, as well as answer any questions there might be. My day job is designing industrial control systems, so I have a ton of electrical panel, PLC, and software experience (just not with Mach 4... yet).

Thanks,

-Mike

39
Hello all,

I am preparing to switch to Mach 4 upon completion of a machine rebuild and I am trying learn the extents of the capabilities of the LUA scripting included with Mach 4. I have a few questions which I'll list below:

1) Where can I find an inclusive list of the LUA functions included within Mach 4? I know LUA is a general purpose language, but I'm looking for something akin to the Mach 3 macro programmers reference which the Mach specific instructions and constructs are enumerated.

2) I'd like to formulate ASCII serial strings to communicate with 3rd party servo drives. This would be for diagnostic information, not motion control. Is LUA capable of communicating through a hardware RS232 serial port? What about USB?

3) What is the update rate of the LUA main script? I know there are screen load and unload scripts, but I understand there to be one that runs fairly continuously. Will this hamper machine performance, or is it only executed with the remaining computational power after motion control?

4) Are there any good examples of LUA scripts which others have written that can be referenced to help create my own?

Thanks in advance for any information you can provide. These are the questions which I couldn't find answers to so far, but if I missed them, a link to the page would be very much appreciated.


Pages: « 1 2 3 4