Strange behavior fro claw assembly

I noticed something odd when I tried to loop a claw so it would just open and close (eventually I want to have it just open when the ultrasonic sensor detects something in front of it and close a second or so later). Anyhow, when I tried a loop using the setServo command it loops, but the claw opens less and less each time – the first time it opens fully, then after three iterations a little less, and so on until it hardly opens at all. I added a motor command line and that seemed to solve it, but it seems a kludgy workaround and I wondered if it was a misuse of the setServo command on a VEX 393 motor, which is what VEX is using on the claw assemblies. In any case, this is the code I used

#pragma config(Motor,  port1,           claw2,         tmotorVex393_HBridge, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

task main()
{repeat(forever)
{setServo();
wait(1);
setServo(port1, -127);
wait(1);
setServo();
setServo(port1, 127);
}}

I’m assuming the problematic code is the code you posted
the 393 motors don’t measure distance traveled, meaning that they will try to run for a set time regardless of whether or not they can actually move. It probably takes more than 1 second to open the claw, and your motor begins to close the claw after 1 second, meaning that the claw is closing before it is fully open which results in it opening less and less.

3 Likes

Yes the code I posted is the problematic code; this means that I need to adjust wait times with the motor[ port X] command and probably not use the setServo command at all, yes?

Yes, most likely
See if that fixes the issue