Clear Command Queue


I am driving the Dobot through the provided DLLs in the C programming language. In a Demo I developed, I send multiple commands to it, with the queue flag. Then I wait the command to finish by monitoring the queue index, like:

 uint64_t queuedCmdIndex = 0;
	int ret;
	PTPCmd ptp_x;
	ptp_x.x = x;
	ptp_x.y = y;
	ptp_x.z = z;
	ptp_x.ptpMode = PTPMOVLXYZMode;
	do {
		ret = SetPTPCmd(&ptp_x,true,&queuedCmdIndex);
		if(ret == DobotCommunicate_NoError)
			std::cout << "Set pose to: x=" << ptp_x.x << " y=" << ptp_x.y << " z=" << ptp_x.z << "; index= " << queuedCmdIndex << std::endl;
			std::cout << "Failed to set Pose" << std::endl;
	} while(1);
	std::cout << "Waiting completing command..." << std::endl;
	do {
        uint64_t currentIndex;
        int result = GetQueuedCmdCurrentIndex(&currentIndex);
        if (result == DobotCommunicate_NoError &&
            currentIndex >= queuedCmdIndex) {
				std::cout << "Current index: " << currentIndex << std::endl;
    } while (1);

What I notice, is that sometimes the command gets processed (so the queue index is updated and the program exits the second while(1) , but the movement is not performed, even if in the previous execution of the program it did (with the same points set). Other times instead, the queue index gets not increased and so my program is stuck at “Waiting completing command…” , like the message was not even delivered.
My idea was to clear the queue at every beginning of the program by giving the command: SetQueuedCmdClear() , but what I noticed is that the index remains the same and thus increase at every program call.
What is the proper way to clear the queue? Also, which could be the reason why sometimes commands get ignored and sometimes not? (I repeat, the Points to which I move the Dobot are always the same).

Thanks in advance.


Hi @carlobenussi91,

Were you able to figure out the proper way to clear the queue? Beyond just calling SetQueuedCmdClear(). Thanks.

Best regards,


I am having the exact same problem, clear command (SetQueuedCmdClear) is not clearing queue at all. The only way to clear queue is to turn off/on Dobot. After restart queue is empty.

Is this the bug in Dobot dll API?


Can try with immediate instructions