Feeding Gcode from a streaming server (with buffer)

More
5 years 7 months ago #201268 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?

Please Log in to join the conversation.

More
5 years 7 months ago #201330 by andypugh
DNC used to be used in the days of very limited controller memory.
What is the reason for using it here?

Please Log in to join the conversation.

More
5 years 7 months ago #201357 by tommylight
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 to join the conversation.

More
5 years 7 months ago #201402 by PlasPak
Here's the Python script:
(and the test Gcode attached)
Code:
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'] )

Attachment not found


Attachment not found

Please Log in to join the conversation.

More
5 years 7 months ago #201437 by andypugh
So, what is the error?

Please Log in to join the conversation.

More
5 years 1 month ago #221333 by udoS
@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
 

Please Log in to join the conversation.

Time to create page: 0.148 seconds
Powered by Kunena Forum