Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A non-blocking movement command is still blocking my code
I am running my code in simulation mode. I want to move the robot arm without blocking so I can get the position of the TCP as the arm is moving. I am moving the robot arm using the moveJ command. To check if the MoveJ command is still blocking, I added print time commands . Here is my code:
for movement in movements:
print("Start: " +str(time.time()))
robot.MoveJ(movement, blocking=False)
print("Stop:  " +str(time.time()))

I can tell the code is still blocking because there is a 1.3 second delay between the start and stop print statements. Why is the code still blocking? Does it always block in simulate mode? Do I need to use a library like "asyncio" to make it non-blocking?
I was able to get it working by using

async def non_blocking(loop, executor):
   await asyncio.wait(
        loop.run_in_executor(executor, getPosition),
           loop.run_in_executor(executor, moveRobot),

Users browsing this thread:
1 Guest(s)