Quote:
Originally Posted by kiettyyyy
Hey all,
After competing at two regionals and watching numerous matches online, many teams are able to complete smooth turns based on some sensor such as a gyro or encoder while having some amount of momentum in the forward direction.
Does any body have sample code or could some what guide me in the right direction of performing a smooth turn, accurately(goes from point a to point b consistantly)?
Thanks in advance for the help!
|
2073 was able to make the U-turn at the end of the home stretch every time. Our robot was calibrated to make a U-turn with a diameter of 13.5 feet. If you'll notice, that is the width of the lane from the center divider to the outside wall. So, the robot would start out in one of three "lanes" in our home stretch and end up in the same lane on the opposing alliance side of the field.
Here is how we did it.
1) We used a trial and error method to determine exactly what fixed PWM values for the left and right drive wheels it would take to get the robot to make a U-Turn and end up 13.5 feet from where it started.
2) We figured out exactly how many counts our GTS would need to reach to go from the starting position until it reached the far end of the lane divider.
3) We commanded the robot to drive straight, again using fixed PWM values for right and left, until we reached the count value determined in step #2.
4) Once the count value was reached, the robot would then apply the "U-Turn" PWM values until our gyro output said we had turned 180 degrees.
5) Once we were facing 180 degrees from where we started, we then applied the straight driving values again.
All in all, it worked quite well. We even scored 3 lines and two balls with this simple process.
Honestly, we had planned to use our sensors better, but other issues prevented us from using them fully. Maybe by the time CalGames comes around we can have it working better.