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));