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
Thanks tfriez, I’m not able to reply to the post in the other forum, so I’m switching back to this one. I haven’t had a chance to try out the setMotorTarget command yet, but I did have some interesting observations. Could the issue be related to the motor temperature?
Yesterday when we started practicing the issue was occurring so frequently that we could not get as far as the driver hand off. My first thought was that it must be something that this particular driver was doing; some combination of buttons being pressed, or their order, or the timing. Switching the drivers seemed to improve the problem. Switching to a third driver the problem rarely occured. Later we switched back to the original first driver, but by then we could no longer reproduce the problem.
Prior to practice the robot had been out in a car in below freezing temperatures for a couple hours. Is it possible that as the motors warmed up, but problem went away?
The following program can reproduce the problem. We tried substituting setServoTarget with setMotorTarget and the issue persisted. In addition, the motors seemed to move slower when setMotorTarget was used, even if speed was set at 100. I tested the following program on 4 different pairs of brains, controllers, and motors. It was easier to reproduce the problem on this year’s hardware. The issue is more likely to occur when the robot battery is low. Motor temperature didn’t seem to be a factor, what I noticed before was probably a low or cold battery.
Yeah - I’m pretty stumped to why the motors would be cutting out. Luckily, there’s some status variables we can monitor with the motors using ROBOTC. I’ve thrown together a test program that runs as a separate task (so it won’t interfere with your main code) and will output data to the global variables debugger window.
Just add your program to “task main” and keep the “startTask” command at the top. Then, while your program is running - keep an eye on the Global Debugger window and see if any of the variables (Specifically current limit / motor temp) switch to reporting as “true”.
Keeping the battery above 80% charged seems to resolve this issue. I haven’t had a chance to test the motor monitor thread, and probably won’t need to unless the issue returns.
FYI for other teams - check the battery voltage by going into the “System Information” screen on the brain, rather than just looking at the battery icon. The battery icon looks full even when the battery is only at 70%.