How to know from API that the robot is ready?


#1

Hello,

I have a Dobot Magician and I’m writing an c# application using the API.

How can I make sure that the robot is ready to accept commands after performing the Home positioning (when it beeps)?

I didnt find the right command for it the documentation.

Thank you in advance.

BR,
David


#2

The dobot has a command called GetQueuedCmdCurrentIndex which returns the index of the command that the dobot is currently executing. For example, if you tell the dobot to move the arm and the index is 46, calling GetQueuedCmdCurrentIndex while the arm is moving will return 46.

Every time you send the dobot a command, the index of the command will be an even number. If you call GetQueuedCmdCurrentIndex and you recieve an odd number, that means that the dobot has completed the command with the even index before the number. For example, if the returned current index is 47, the dobot has just completed the command with index 46 and is now waiting for the next command.

So, to answer your question: You can call SetHomeCmd, store the index that the command returns, and wait until GetQueuedCmdCurrentIndex returns the index from SetHomeCmd + 1, and then send the next command.

Also by the way, there are some errors in their API unfortunately. I tried using it and it didnt work out for me. I know that their function for controlling the conveyor belt is broken. You might want to try manually writing the commands to the serial port using the dobot communication protocol


#3

Thank you, it is a good idea.

I tried it, it worked fine, however in a slightly different way. During performing the current movement the GetQueuedCmdCurrentIndex() returned the actual command - 1.

So, after calling the SetHOMECmd() it returned 46. Then I called GetQueuedCmdCurrentIndex(), and I got 45 until it performed the movement, afterwards I got the 46 back.

Anyways, it is just for future reference, the idea worked great!

Thank you for you help!

Edit: Thanks for noting the problem with the API. So far it was working for me.


#4

Nice job! Sorry about the error in my previous post. I’m glad it worked for you!