Hello Guest it is April 27, 2024, 12:03:28 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.


Messages - awh216

Pages: 1
1
Mach4 General Discussion / Re: Running a Lua script in the background
« on: August 17, 2016, 01:16:09 PM »
Thanks to some external help, I was pointed to the PLC script under Operator -> Edit Screen, Screen Tree Manager, wxMach (head of tree, could be differently named), Events tab, plc script

The script runs continually in the background so I just added my code to the bottom and I was set.

2
I've just updated the plugin version and integra firmware to the most recent. The axis is also unmapped. I'll pay attention to the bug over the course of the week to see if it's been fixed.

3
Mach4 General Discussion / Running a Lua script in the background
« on: August 12, 2016, 10:24:55 AM »
Hello all,

We want our feed rate to be controlled by a Python script we have running in a separate process. To do this, we hoped to be able to run a Lua script in the background of Mach 4 with a while True loop that would read UDP packets and send that value to the feed rate adjuster. Does anyone know if this is possible? I'm still fairly new to Lua altogether. Is there a better way to go about this?

Thanks  :)

4
Mach 4.2.0.2914. We've recently been experiencing an issue where we receive the following error message, "Motor 0 Pulse Count Error caught on buffer verify -18513.000000 -0.000000", with varying numbers. This disables Mach4 and stops our GCode from proceeding. We aren't even using Motor 0 and it's unchecked in Configure -> Mach -> Motors. This only seems to happen if we haven't been running anything for a couple of hours (i.e. the start of the day) and then it seems to go away. Any advice?

(This was reposted from under Mach4 general advice. I was recommended to post here instead)

5
We're using a HiCON Integra motion controller (with the corresponding plugin). It happens when we're running GCode; the specific code is as follows:

G91 (Relative)
F5
M24
G4 P2

(Layer 1)
M25
G1 Y-2
M26
G0 Z1

(End)
M27

The MCodes all call lua functions that send specific messages using UDP sockets to a seperate Python script. More specifically, M24 checks that a periphery machine is ready and M25 turns the machine on. We recognize the error when it occurs because rather than check the machine (M24), wait two seconds (G4 P2), then turn it on (M25), it checks the machine (M24), skips the pause (G4 P2), turns the machine on straightaway (M25), and then disables Mach4.

The error does not happen consistently. It seems to happen only once per day; typically during the first run of the day. It is alarming that it would just "skip" the pause and turn on the machine without a waiting period. In some applications that require a waiting period, this could be dangerous.

6
Mach 4.2.0.2914. We've recently been experiencing an issue where we receive the following error message, "Motor 0 Pulse Count Error caught on buffer verify -18513.000000 -0.000000", with varying numbers. This disables Mach4 and stops our GCode from proceeding. We aren't even using Motor 0 and it's unchecked in Configure -> Mach -> Motors. Any advice?

7
That fixed the problem. Updating to the latest version includes the LuaSocket library as well as a few others. Thank you for for the advice smurph  :)

8
Which 'modules' directory are you referring to? In my install directory the only 'modules ' dir I have is in ' C:\Mach4Hobby\Profiles\Profile_Main\Modules.  All that's contained there is MillModule.lua which doesn't seem to be sockets related.  I'm running Mach 4 Hobby v4.0.1.2472 if that helps.  Would the sockets module come with the new update or does Hobby simply not come with it?

Pedio: Yep :), strapped a MIG welder nozzle onto a 3D gantry controlled by a Hicon Integra.  GCode moves it and M-Codes turn on and off the welder; at least that's the idea.  I'll see if I can get permission from my research advisors to post pictures, but they typically like to keep the finer details under wraps.

9
Thank you for your response.

I'm still very new to Mach4 and Lua in general. When you say "the LUA sockets module is in the Modules directory" what do you mean by that? To actually get a copy of luasocket I've avoided building it manually by using LuaRocks on my installed version of Lua (seperate from Mach4).  Is this the correct way to go about installing it to begin with?  Which lua files should be in the modules directory?

10
Hello Everyone,

I'm a grad student working on a 3D printing research project for my university.  The machine uses a 3D gantry controlled by GCode run from Mach4 in combination with a welder (for additive use) controlled by by a separate Python interface.  The problem I face is coming up with a way to communicate between the GCode, using M commands, and the Python script.  Ideally, we'd be able to call an M command, M23 for example, which would communicate with the welder script that the welder needs to be turned on.  The script would then be able to return a success value of some sort to indicate that the GCode should proceed. I decided that the use of sockets would allow two-way communication and be relatively hassle free.

However, I am not sure how to implement this in Mach4.  If this were normal Lua, I'd use the LuaSocket library, but I feel as though it won't be as simple as that.  I'm now thinking that developing my own plugin would be a better path for me.  Is this feasible to do within the bounds of a plugin? If so, how would I gain access to the SDK?  I assume I'd have to contact ArtSoft somehow and sign an NDA, but would this be through a help ticket or are there other means of contact?

I'd appreciate any advice or questions on the matter.

-Alex

Pages: 1