task: main loop took 5.019013 seconds

More
05 Sep 2025 12:57 #334493 by hellvetica
task: main loop took 5.019013 seconds was created by hellvetica
Hi, I'm making a robot arm using linuxcnc.
I have a python interface that i'm playing with. I send the robot commands by setting the axis.L.eoffset-counts pins and the robot moves as expected.
I have a function that polls the robot for its position and waits until it reaches the desired position before sending the next point.
The position is read using the python interface 
s = linuxcnc.stat()
s.poll()
print(s.actual_position)

but every now and then, the robot reaches its position and waits there for another few seconds before the function exits. I realized that the position feedback gets stuck at some value, and my console prints
task: main loop took 5.019013 seconds

I also tried reading the position through the halui.axis.L.pos-relative but the same issue happens.
I assume this is because the internal emcStatus buffer doesn't get updated for those 5 seconds of the main loop.

Why does the loop take so long? How can I debug that?

Please Log in or Create an account to join the conversation.

More
05 Sep 2025 16:14 #334501 by langdons
Replied by langdons on topic task: main loop took 5.019013 seconds
What exactly happens in that loop?

Please Log in or Create an account to join the conversation.

More
08 Sep 2025 11:34 #334615 by hellvetica
Replied by hellvetica on topic task: main loop took 5.019013 seconds
I don't know, it's the linuxcnc's output.
I just move the robot around when it happens.

However, I realized that every now and then one of my motors goes over its negative soft limit. I increased the soft limit and the issue seems to have stopped happening.
I still don't understand why that would cause the main loop to freeze for 5s.

Please Log in or Create an account to join the conversation.

More
08 Sep 2025 13:57 #334624 by langdons
Replied by langdons on topic task: main loop took 5.019013 seconds
Python is buggy.

Motors shouldn't exceed their soft limit.

That's weird.

Please Log in or Create an account to join the conversation.

More
09 Sep 2025 09:34 #334678 by hellvetica
Replied by hellvetica on topic task: main loop took 5.019013 seconds
I'm controlling them with external offsets. Would that be the reason?

Please Log in or Create an account to join the conversation.

Time to create page: 0.157 seconds
Powered by Kunena Forum