I am unable to send more than one command at a time. When I send several in quick succession they execute concurrently. I imagine I could use use the query command to wait until the move is finished but I don’t know how to read the response. Any ideas?
serial_port a filestream wrapped around /dev/ttyS1 that allows characters to be sent to the arm. “if(next_byte == ‘;’)” is just something I added so I could specify carriage returns in my input file. I think the commands are supposed to execute concurrently if they are received soon enough, but I want to know of a way to execute them serially. Thanks.
send the commands in groups, and put a Txxxx at the end. When you send the command it will make sure all servos start and stop the move in the amount of time in micro seconds that is in the T command.
#0P2000#1p2000#3p2000 t5000
Now pause for the same amount of time as in the T command. As soon as your pause is done it’s ready to send the new position.
You can also send the Q command. It will return a . if the move is finished and a + if the move is not finished. You will have to ask the programmers for help with receiving the Q response.
I will try that and I think it will work for my immediate concerns, but I think the Q solution is better and would still appreciate help with that. Thanks Robot dude for your consistent and useful advice.
The suggestion to send the commands together with a time parameter (don’t forget the CR) is good. Also use a delay to insure that the move is complete.
to accomplish this better, get terminated strings from your “file”, add on a CR if still needed, and send those to the SSC32, rather then a char at a time.
I played with the ‘Q’ solution, but I don’t like spinning in a loop, wasting processor time. I’d rather start a timer, and just periodically check it while continuing to run background tasks.