Python actual_position instruction accuracy
- cnc_rocket
- Offline
- New Member
Less
More
- Posts: 5
- Thank you received: 0
19 Feb 2023 19:21 #264824
by cnc_rocket
Python actual_position instruction accuracy was created by cnc_rocket
Hi there
Here is the following that I want to do:
- While my cnc is moving, I want to have a python script that spits out the position of my cnc combined with a current timestamp.
- And I want this to happen as fast as possible.
So I came up with the following idea:
I take a timestamp before I fetch the actual_position and one after, then I take the average of both.
I was wondering how accurate this is.
Could anybody give me a bit more detail in how the s.actual_position attribute works?
Here is the following that I want to do:
- While my cnc is moving, I want to have a python script that spits out the position of my cnc combined with a current timestamp.
- And I want this to happen as fast as possible.
So I came up with the following idea:
stamp1 = time.time()
cords = s.actual_position
stamp2 = time.time()
stamp = (stamp1 + stamp2)/2
I take a timestamp before I fetch the actual_position and one after, then I take the average of both.
I was wondering how accurate this is.
Could anybody give me a bit more detail in how the s.actual_position attribute works?
Please Log in or Create an account to join the conversation.
21 Feb 2023 13:13 #264955
by andypugh
Replied by andypugh on topic Python actual_position instruction accuracy
Why do you want this? Have you considered HALScope to capture the data?
Please Log in or Create an account to join the conversation.
- cnc_rocket
- Offline
- New Member
Less
More
- Posts: 5
- Thank you received: 0
21 Feb 2023 15:02 #264959
by cnc_rocket
Replied by cnc_rocket on topic Python actual_position instruction accuracy
Thank you for your answer.
So, I have a laser sensor connected to my mill machine.
This laser sensor measures the distance to the underling surface.
I have a program where I can read out the sensor's value, with his timestamp.
Based on this timestamp, I want to match my CNC's position.
So I thought to write a python script that would spit out the CNC position and timestamp.
I didn't consider HALScope, and I don't know how I would extract that information and read that information into python.
So, I have a laser sensor connected to my mill machine.
This laser sensor measures the distance to the underling surface.
I have a program where I can read out the sensor's value, with his timestamp.
Based on this timestamp, I want to match my CNC's position.
So I thought to write a python script that would spit out the CNC position and timestamp.
I didn't consider HALScope, and I don't know how I would extract that information and read that information into python.
Please Log in or Create an account to join the conversation.
21 Feb 2023 15:58 #264963
by andypugh
Replied by andypugh on topic Python actual_position instruction accuracy
Generally I would avoid Python (or anything else userspace) for this sort of thing.
How does the sensor value get into the system? Can it be sampled in a realtime component and passed on to a HAL pin?
How does the sensor value get into the system? Can it be sampled in a realtime component and passed on to a HAL pin?
Please Log in or Create an account to join the conversation.
- cnc_rocket
- Offline
- New Member
Less
More
- Posts: 5
- Thank you received: 0
21 Feb 2023 17:03 #264967
by cnc_rocket
Replied by cnc_rocket on topic Python actual_position instruction accuracy
No, the sensor is connected with an Ethernet cable.
The sensor sends UDP packages to the computer.
And in a packet, the time difference with the previous packet is specified.
The sensor sends UDP packages to the computer.
And in a packet, the time difference with the previous packet is specified.
Please Log in or Create an account to join the conversation.
Time to create page: 0.076 seconds