Quickly Pull Data from Duet3 6HC
We are trying to pull analog data from our I/O pins as quickly as possible. We are currently doing that with the machine/status HTTP request in a Python script. The script pulls the full machine status, isolates our important sensors, and then saves that data.
Is there a faster way to do this? Potentially a method that would not require an HTTP request? We are currently running our Python script from a raspberry pi that is connected to the duet.
Thanks for your help.
What data are you pulling?
We are just trying to pull the analog readings from our I/O sensors. We have them setup for a linear scale.
MintyTrebor last edited by
@btmclain If you are running your pi/duet in DSF mode then you can use the dsfapi and subscribe to selected variables/keys in the object model. The api will push these values to a websockt/unix socket when they change, this would negate the need for constant request/response type calls (although you do have to acknowledge each push as 'received' before it pushes the next update).
A year or so ago I wrote an MQTT python script which interfaced with the dsfapi and subscribed to object model keys - its depreciated now but the principles are still valid I believe. You can have look at it here https://github.com/MintyTrebor/MQTT4DSF/blob/main/MQTT4DSF_DSFEvents.py.
I am not aware of a quicker method, although it possibly may be quicker with serial requests via usb directly to the duet board??
Thanks for the reply. I will play around with it!