Announcement

Collapse
No announcement yet.

Encoders in Autonomous?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Encoders in Autonomous?

    This program works for the first part of autonomous, which is going forward. However, when it gets to the next step (which is to turn), the motors just buzz. Why is that? Heres a link to the download for the aia of the project. http://www.mediafire.com/download/io...1ifo/TIMED.aia

  • #2
    Originally posted by FTC10083 View Post
    This program works for the first part of autonomous, which is going forward. However, when it gets to the next step (which is to turn), the motors just buzz. Why is that? Heres a link to the download for the aia of the project. http://www.mediafire.com/download/io...1ifo/TIMED.aia
    The reason that it's not working is that the first step tells the motor encoders to go to a value that is 3.5 x 1440, and in the second move your WHILE statement states while the current position is LESS than 2x1440, so it falls right out of that loop without doing anything because the current value is 3.5x1440 which is definitely not LESS than 2x1440. :-)

    I'm also not sure that setting the direction with a "Text" value actually works. What I've done is call the "Set <Motor>.Direction" and then use the "<Motor>.DIRECTION_FORWARD" and "<Motor>.DIRECTION_REVERSE" blocks (they're right underneath the "Set <Motor>.Direction" block in the block selector). Also, the encoders might stop the motor LESS than the specified value, so you might want to change your WHILE conditionals to be something like a procedure called "MoveComplete" which has a conditional something like this:

    IF (absolute(left_drive.CurrentPosition-leftEncoderTarget) <= 5) AND (absolute(right_drive.CurrentPosition-rightEncoderTarget) <= 5)

    Because it might stop the motor just before or just after the actual target you set, and if your WHILE loop is expecting it to always be MORE than what you set, you'll never exit your while loop and the motors will buzz and whine because they're holding it steady. When we use this (<= 5 either before or after our target) we've never had it just sit and buzz anymore.

    I hope this helps!

    -- Gordon.

    Comment

    Working...
    X