Just got my SSC-32, and love it, but can’t quite figure out the syntax needed to cancel a movement that’s in progress.
The documentation states the following under the heading ‘Servo Move or Group Move’:
" = Cancel the current command, ASCII 27."
I’ve tried to send various combinations to the controller (channel + escape + carriage return, and channel + escape, etc…) in an attempt to cause the servo movment to stop (after a contact is closed, for instance), but - the servo continues the movment per the pulsewidth passed to the controller.
Try using “#”, DEC channel, 27, 13] for the serout command to send the ASCII 27 (Escape) code. Remember, you must end each command to the SSC-32 with an ASCII 13 (Carriage Return) character or the SSC-32 won’t do anything.
Wow - thanks for the quick reply! I’m unfortunately not quite getting it yet, though.
As a simple test, I created two buttons in VB Express; one to start the movement, another to cancel it. My cancel code below unfortunately doesn’t appear to stop the movement; it continues per the pulse width sent to it before the cancel command.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'start movement
ArmSerialPort.Write("#2 P1407 S400" + Chr(13))
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
'cancel the movement
ArmSerialPort.Write("#2" + Chr(27) + Chr(13))
The documentation is a little unclear on this. is for bailing out on a command that is being transmitted, without causing any servos to move. It’s for the case where you type “#7P1500” and then realize that you really wanted to move servo 6, not servo 7. If you send before sending , everything you have sent so far will be ignored.
Unfortunately there is no clean way to stop a group move in process. When parsing a group move, the SSC-32 converts the group move command into a number of individual moves (after calculating the required speed for each servo based on the T and S commands). By the time the movement begins, the SSC-32 is no longer tracking the group command, but is doing a collection of individual moves.
The “unclean” way to stop a move in progress is to stop each servo individually. You would do this by reading the servo position using the QP command, and then sending a command to move the servo to that position. Since the servo is already at that position, this will effectively stop the servo. Do this for each servo involved in the group move.
if using digital servos couldn’t you also just tell it to set the output to a hard 0, which would appear to be a loss of signal and so the servo would hold it’s last position?