setServoTarget stops working

The setServoTarget command is not working consistently for us. When we start the program it works fine, but after what seems to be a random period of time it stops working. When the command stops working, it stops for all motors. Other motor commands continue to work, but not setServoTarget. Any insight on what might be causing this?
Below is a code snipit. Basically we are getting input from the joystick and using setServoTarget to open or close the claw and raise or lower the arm. The display shows the desired position as well as the current position. When we first start the program the robot responds to the joystick commands and the display is updated as expected. Then after anywhere from a few seconds to a couple minutes later the robot stops responding to the setServoTarget commands. The brain is receiving the requests because the display is showing changes to the desired position. Other joystick commands also continue to work - the drivetrain still moves. All motors stop responding to the setServoTarget commands at exactly the same time.
Thanks for any help,
Jerry

(using Robot C v4.26 or 4.27)

if(getJoystickValue(BtnRDown))
fSetClawPos = 0; // Close Claw
if(getJoystickValue(BtnRUp))
fSetClawPos = -250; // Open Claw
if(getJoystickValue(BtnLDown))
fSetArmPos = 0; // Lower Claw
if(getJoystickValue(BtnLUp))
fSetArmPos = -450; // Raise Claw

setServoTarget(clawMotor,fSetClawPos);
setServoTarget(rightLiftMotor,fSetArmPos);
setServoTarget(leftLiftMotor,fSetArmPos);

displayTextLine(1, “Clw s=%d a=%d”, fSetClawPos, getServoEncoder(clawMotor));
displayTextLine(2, “RLft s=%d r=%d”, fSetArmPos, getServoEncoder(rightLiftMotor));
displayTextLine(3, “LLft s=%d l=%d”, fSetArmPos, getServoEncoder(leftLiftMotor));

Hey jrp62,

Thanks for your message… we’ve tried to test your code in our labs (adding in the appropriate items like variable definitions and motor/sensor configuration) and I can’t seem to be able to duplicate the issue.

A little bit of background - setServoTarget and setMotorTarget are actually very similar commands - setServoTarget will simply always set the speed of the VEX IQ motor to the maximum rate, whereas setMotorTarget will allow you adjust the speed from a 0-100 scale. Both commands will “hold position” after moving to the target location, so you’ll still get the “servo” benefit of it using its mechanical power to stay at a specific target value. Another debugging technique you could use is to replace the setServoTarget with setMotorTarget (and add in the speed parameter) to see if it’s a specific issue with setServoTarget that we haven’t caught in testing.

I understand if you have competition code that you may not want to share fully on the forums - but I’d love a chance to take a look at your whole program to help diagnose what the issue is. Can you please send the code in as an attachment to our support[at]robotc[dot]net address and I’ll be able to investigate it from there?

Thanks!