|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools |
Rating:
|
Display Modes |
|
#1
|
||||
|
||||
|
Driving Straight
One of my off season projects it to try and get are robot to drive straight. I know you can do this with a gyro but i was wondering if there was any other methods people have used.
|
|
#2
|
|||||
|
|||||
|
Re: Driving Straight
We have used encoders to measure the distance traveled on each side of the drive train and compensate if one got too far ahead of the other.
|
|
#3
|
||||
|
||||
|
Re: Driving Straight
Quote:
I would only use distance from an encoder in autonomous, when you need to travel to a specific point as part of your routine. |
|
#4
|
||||
|
||||
|
Re: Driving Straight
I was trying the encoder and PID method over the weekend. I was not sure if i should have a PID controller for both sides or have a slave masters configuration. Which have you used
|
|
#5
|
|||||
|
|||||
|
Re: Driving Straight
Quote:
|
|
#6
|
|||||
|
|||||
|
Re: Driving Straight
Ours uses a slave/master. We correct the one sides speed depending on the differences in the distances using a PID loop.
|
|
#7
|
||||
|
||||
|
Re: Driving Straight
With the slave and master configuration how do you deal with turning? Would you mind drawing a flowchart?
|
|
#8
|
|||||
|
|||||
|
Re: Driving Straight
Are you just trying to drive straight or are you trying to find a way to very precisely control both sides of the drive train (assuming a skid steer)?
|
|
#9
|
|||
|
|||
|
Re: Driving Straight
Drive straight in what portion of the game? It is much easier in autonomous since you know what path the robot will be taking and can plan acordingly. Not so during teleop. Regarding the softaare side, a gyro would be your best bet, as it was designed to measure the heading of the robot. During auto, you can get away with just an encoder on each side of the drivetrain and work towards mathing speeds.
If you do not have any sensors, you can try applying a proportionally different power value to each side (e.g. after you get the final motor values from the joysticks,run the left motors at 80% and the right ones at 100%). You could try to figure out the function that each side of the drivetrain is following (speed of wheels based on motor value) and compensate that way. The function method would be the more complicated form of a simple power scaling factor, but an underlying issue exists. Since you are trying to compensate for a mechanical problem in software, without a closed loop system (sensor and PID), the robot will only drive straight as long as the drive train does not change (including gear bindings or re-greaseing). You could get it "close enough", but it would be suseptable to the quality of repairs, the weather that day, and the mechanical sub-team. That doesn't sound fun does it. |
|
#10
|
||||||
|
||||||
|
Re: Driving Straight
You can use the encoders to emulate a gyro for driving straight. Here is some psuedo-code for how to do it:
Code:
heading = 57.3*(leftEncDist - rightEncDist) / trackWidth;
if (abs(driverTurnCmd) < turnDeadZone)
{
if (headingCaptured == FALSE)
{
desiredHeading = heading;
headingCaptured = TRUE;
}
turnCmdPID = PID(heading, desiredHeading);
arcadeDrive(driverThrottleCmd, turnCmdPID);
}
else
{
headingCaptured = FALSE;
arcadeDrive(driverThrottleCmd, driverTurnCmd);
}
Last edited by Chris Hibner : 06-16-2014 at 10:17 AM. |
|
#11
|
||||
|
||||
|
Re: Driving Straight
Quote:
|
|
#12
|
||||
|
||||
|
Re: Driving Straight
This discussion reminded me of something I posted a couple of years ago. For any students interested in some math: http://www.chiefdelphi.com/forums/sh...5&postcount=26 |
|
#13
|
|||
|
|||
|
Re: Driving Straight
Quote:
|
|
#14
|
||||||
|
||||||
|
Re: Driving Straight
Does 2177 do this? My impression is that very few teams do, because it's hard to tune. If you do, it would be a great whitepaper.
|
|
#15
|
|||||
|
|||||
|
Re: Driving Straight
This is why we haven't done it. We get a much better signal counting distance than we do speed and it is much easier to tune the PID controller since it doesn't need to be as precise.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|