Feeding Gcode from a streaming server (with buffer)
07 Mar 2021 09:43 - 07 Mar 2021 11:04 #201268
by PlasPak
Feeding Gcode from a streaming server (with buffer) was created by PlasPak
Hi All, I'm trying to feed Gcode to LinuxCNC via a streaming server (using a Python Script).
I got it working but I get a bunch of errors that one doesn't get when loading the Gcdoe the traditional way. So far, the same error happens regardless if the file is local or from the web.
Here's a test: vimeo.com/520316807
Is anyone interested in testing the code and giving us feedback?
I got it working but I get a bunch of errors that one doesn't get when loading the Gcdoe the traditional way. So far, the same error happens regardless if the file is local or from the web.
Here's a test: vimeo.com/520316807
Is anyone interested in testing the code and giving us feedback?
Last edit: 07 Mar 2021 11:04 by PlasPak.
Please Log in or Create an account to join the conversation.
07 Mar 2021 19:10 #201330
by andypugh
Replied by andypugh on topic Feeding Gcode from a streaming server (with buffer)
DNC used to be used in the days of very limited controller memory.
What is the reason for using it here?
What is the reason for using it here?
Please Log in or Create an account to join the conversation.
- tommylight
- Away
- Moderator
Less
More
- Posts: 18733
- Thank you received: 6298
07 Mar 2021 21:05 #201357
by tommylight
Replied by tommylight on topic Feeding Gcode from a streaming server (with buffer)
The only reason for that i can think of is if that gcode needs to be generated by some other sensor/s, and even then using external offsets might be a better solution.
Please Log in or Create an account to join the conversation.
08 Mar 2021 09:21 #201402
by PlasPak
Replied by PlasPak on topic Feeding Gcode from a streaming server (with buffer)
Here's the Python script:
(and the test Gcode attached)
(and the test Gcode attached)
import boto3
import importlib
import os
import sys
import linuxcnc
MODES = {
linuxcnc.MODE_MANUAL: 'MANUAL',
linuxcnc.MODE_AUTO : 'AUTO',
linuxcnc.MODE_MDI : 'MDI'
}
s=linuxcnc.stat()
c=linuxcnc.command()
def print_mode():
s.poll()
print "Current MODE: ", MODES[s.task_mode]
sqs_client = boto3.client(
'sqs',
region_name='eu-central-1',
aws_access_key_id='AKIAS5AWEKP2OBREGAQW',
aws_secret_access_key='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'
)
s3_client = boto3.client(
's3',
aws_access_key_id='AKIAS5AWEKP2OBREGAQW',
aws_secret_access_key='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'
)
print("Retrieving orders...\n")
response = sqs_client.receive_message(
QueueUrl='https://sqs.eu-central-1.amazonaws.com/199762400244/devmssn',
AttributeNames=[
'All',
],
MessageAttributeNames=[
'All',
],
MaxNumberOfMessages=10,
VisibilityTimeout=5,
WaitTimeSeconds=20,
)
def ok_for_mdi():
c.mode(linuxcnc.MODE_MDI)
s.poll()
return not s.estop and s.enabled and (s.homed.count(1) == s.axes) and (s.interp_state == linuxcnc.INTERP_IDLE)
for message in response['Messages']:
print("Order ID:"+message['MessageAttributes']['Order']['StringValue']+"\n")
print("GCODE file name: "+message['Body']+"\n")
s3_client.download_file('devmssn', 'orders/'+message['MessageAttributes']['Order']['StringValue']+'/'+message['Body'], message['Body'])
print("GCODE downloaded...\n")
f = open(message['Body'], "r")
while 1:
gcode_line=f.readline()
#print(gcode_line)
if gcode_line == '':
break
if ok_for_mdi():
c.mdi(gcode_line)
c.wait_complete()
r=sqs_client.delete_message(
QueueUrl='https://sqs.eu-central-1.amazonaws.com/199762400244/devmssn',
ReceiptHandle=message['ReceiptHandle']
)
The following user(s) said Thank You: tommylight
Please Log in or Create an account to join the conversation.
08 Mar 2021 15:31 #201437
by andypugh
Replied by andypugh on topic Feeding Gcode from a streaming server (with buffer)
So, what is the error?
Please Log in or Create an account to join the conversation.
22 Sep 2021 10:38 - 22 Sep 2021 10:38 #221333
by udoS
Replied by udoS on topic Feeding Gcode from a streaming server (with buffer)
@andypugh
is this topic still open ?
I'm reading position value of parts with opencv.
Where to send this values into Lcnc to go and pic the part.
I can get the value into hal but then where do I connect them.
best rgds. udo
is this topic still open ?
I'm reading position value of parts with opencv.
Where to send this values into Lcnc to go and pic the part.
I can get the value into hal but then where do I connect them.
best rgds. udo
Last edit: 22 Sep 2021 10:38 by udoS.
Please Log in or Create an account to join the conversation.
Time to create page: 0.257 seconds