A non-blocking movement command is still blocking my code- Printable Version +- RoboDK Forum (//www.sinclairbody.com/forum) +-- Forum: RoboDK (EN) (//www.sinclairbody.com/forum/Forum-RoboDK-EN) +--- Forum: RoboDK API (//www.sinclairbody.com/forum/Forum-RoboDK-API) +--- Thread: A non-blocking movement command is still blocking my code (/Thread-A-non-blocking-movement-command-is-still-blocking-my-code) |
A non-blocking movement command is still blocking my code-petsven-06-27-2022 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:
Code:
for movement in movements:
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? RE: A non-blocking movement command is still blocking my code-petsven-07-06-2022 I was able to get it working by using async.io:
Code:
async def non_blocking(loop, executor):
RE: A non-blocking movement command is still blocking my code-Maarten-08-29-2022 I run into the same issue: 我有两个机器人(R1和R2)统计ion and from the API I want to fire non-blocking move commands to either of them. In its simplest form:
Code:
R1.MoveJ(R1_T1,False) #1 Joint move first robot R1 to target R1_T1
Despite the option blocking=False, the two consecutive move commands #1 and #2 to R1 effectively introduce blocking behavior, since command #2 won't be executed until command # 1 is finished. Execution of command #3 and #4 to R2 are therefore also blocked until command #1 is finished. The behavior I want is for R1 to consecutively execute its commands #1 and #2, without blocking R2 to start consecutively executing command #3 and #4, independent of each other's busy status. Any suggestions how to implement async.io in this case, or any other ways? Best regards, Maarten RE: A non-blocking movement command is still blocking my code-Albert-09-09-2022 Each movement for the same robot is not executed unless the previous move is complete. To do what you are planning to accomplish it would be better if you intercalate the movements for each robot:
Code:
R1.MoveJ(R1_T1,False) #1 Move first robot R1 to target R1_T1
RE: A non-blocking movement command is still blocking my code-Maarten-09-12-2022 Hi Albert, shuffling the commands does not solve the issue. In the order you propose:
I'd like be able to provide commands to R1 and R2, and have them execute the commands consecutively regardless of the other robot's status. Also, I would need a generic solution, which works for any number of commands and any time duration of a move command. While the order of consecutive commands to an individual robot is inherent when a new command is queued, the combined order of consecutive commands for both robots will be unknown in advance. But since both robots should operate independently, the combined order should be irrelevant: each robot simply executes its own list of consecutive commands independently. RE: A non-blocking movement command is still blocking my code-Albert-09-12-2022 I understand that the last movement command won't execute unless 1 and 2 are complete in the example we discussed. This is a good point. To solve this problem you should run each group of robot movements for the same robot on a separate thread. A separate script would also work (it ends up being a separate thread). The example MoveRobot script of the "Synchronize 3 Robots with a Screen" example does exactly that (it moves each robot on a separate thread). RE: A non-blocking movement command is still blocking my code-Maarten-09-14-2022 Thanks for your help Albert, but I find the "Synchronize 3 Robots with a Screen" example quite complex to understand for the supposedly simple thing I'm trying to achieve. I attached a stripped down station with two robots, three joint targets for each, and a python script from which I intend to make the robots perform a series of movements along their targets, both running at the same time (no synchronization is needed). I'm probably not using the threading correctly. Could you have a look at the script to make it work as intended? RE: A non-blocking movement command is still blocking my code-Maarten-09-21-2022 Hi Albert, can you spot the issue in the station I uploaded last week? The behavior when running the program is quite unexpected: sometimes the robots do start their move sequence as a thread, sometimes they don't. |