View Single Post
  #4   Spotlight this post!  
Unread 20-10-2013, 22:54
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,043
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Auton Programming with Encoders and Gyros

Quote:
Originally Posted by MichaelBick View Post
We are running a 6wd
I think with a skid-steer drivetrain your best bet would be a combination of driving in straight line segments plus rotating-in-place. You'd want to figure out where your center of rotation is and factor that into the calculations.

So for example...

Given:

a) The center of rotation of your robot is located at field coordinates (0,0), and

b) The robot is oriented at an angle A0 degrees clockwise from the +Y axis of the field coordinate system, where the +Y axis is straight downfield (away from the driver station), and

c) When autonomous starts, you want to drive to field coordinates (X1,Y1) and then to (X2,Y2), and

d) When you get to (X2,Y2) you want to orient the robot to angle A2

Proceed as follows:

1) When autonomous starts, set the gyro reading to A0, then

2) Rotate-in-place until the gyro angle equals (180/pi)*atan2(-X1,-Y1)+180 degrees, then

3) Drive straight a distance sqrt(X12+Y12), then

4) Rotate-in-place until the gyro angle equals (180/pi)*atan2(-(X2-X1),-(Y2-Y1))+180 degrees, then

5) Drive straight a distance sqrt((X2-X1)2+(Y2-Y1)2), then

6) Rotate-in-place until the gyro angle equals A2 degrees



Reply With Quote