AL5A Robotic Arm servo Control using Matlab

Hi everyone.

I’m controlling an AL5a robotic arm using the SSC32 servo controller. The arm is moved after a snapshot is taken from a camera in order to detect an object and grasp it. I’m trying to improve/refine the way it grasps the objects since sometimes they are grasped but other times they are not due to the gripper which starts closing (thus hitting the objects while going down) as soon as the commands for the base, shoulder, elbow etc are given. I need a way to make the the gripper to start closing as soon as all other servos finished their move!!
I read something which might help from SSC-32 Ver 2.0 Manual where it states the following:

"Query Movement Status:
Q
This will return a “.” if the previous move is complete, or a “+” if it is still in progress.
There will be a delay of 50uS to 5mS before the response is sent. "

My Matlab program involves something like the folllowing to control the gripper:

if ((gripper_opening >=0) && (gripper_opening <=30))
gripper_asc = 1850 - (gripper_opening*43.33333) + 350 %+200 was set to ensure gripper is grasping the object (i.e.not just touching it)
gripper_asc = round(gripper_asc)
fprintf(obj, ‘#4P%dT5000\n’, gripper_asc)

end

However I don’t have any clue how to make the query movement status to check the status of the other servos using Matlab :confused:
Can somebody please help me out there?

Regards
Kenneth