View Single Post
  #5   Spotlight this post!  
Unread 17-01-2013, 20:52
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: 180 turn on button press in labview

If you have encoders on your left and right wheels, the difference in values between the two tells you something about the direction your robot is facing. The conversion between encoder counts and robot heading is a function of the wheel circumference and the distance between left and right wheels.

What you will need to do is something like this:
  • Continuously compute the robot heading from the encoder values.
  • While the buttons aren't pressed, drive normally, but continuously save the current heading + 180 degrees as a target value.
  • While the buttons are pressed, turn in whatever direction will make your current heading approach the target.

You'll probably find that the robot overshoots the target and starts oscillating back and forth. That's when you should start learning how to use PID control.
Reply With Quote