We have been experiencing issues with setting the position of servos on our robot , specifically on the HiTech 785 servos. Through various testing we were able to solve this issue.
By first extending the range in the core device discovery software, then adjusting the positions in the program, we were able to extend and retract one servo. Then, when we added the second servo and tried to adjust its position, both servos went haywire. We could not set any positions, and we had to reset the servos and re-do their positions for it to work properly. At the next meeting, we attempted to solve the issue of the servos on the same controller. First, we tried setting the servo ranges separately, and then using them simultaneously. This worked in teleop, where we were able to control both servos at the same time, something we were unable to do previously. During initialization, we set both servos to their “retracted” positions, to make sure they were within the sizing cube, then during teleop, we moved the servos based on button commands. However, in autonomous, this initialization did not seem to work. For some reason, the servo on one side of the robot moved out during initialization, something we still needed to figure out.
We suspected that one of our color sensors had gone bad and was causing our issues on the other side of the robot. One thing we tried to do was to replace the bad color sensor with the new one and test it to make sure that it was reading values. To do this, we traced the connectors back and utilized the Core Device Discovery Module to remap the 0x3C and 0x3E addresses. An issue that we encountered was that only one of the addresses (either 0x3C or 0x3E) would show up along with the Range sensor at a given point. This issue was easily resolved when we discovered that one of the connectors had been plugged incorrectly. To test whether or not the color sensors on both sides of the robot were working, we set it in sensor telemetry and used a flashlight to reflect the light off into the sensor. Our testing was optimal because we conducted multiple trials on redFront, redBack, blueFront, blueBack , which are all color sensor labels we had given, to make sure no error values of 255 were being read. This way, we were able to ensure maximum validity.
Eventually, we were able to figure out what was going on. We had reversed the direction of one servo in the teleop initialization, but failed to do so in autonomous initialization. So, the servo would move out to the opposite position of what we intended it to be, which was exactly what happened. I wrote a simple autonomous program today to extend one servo, retract it, extend the other servo, and retract that. It did not seem to work at first, but when I put in “sleep” commands for three seconds in between, the servo had enough time to reach its intended position. Now, we think we have solved the servo issue after running this program for reliability ten times, working with 100% consistency.