![]() |
West Coast Drive Code
My team, 2582, is switching to the West Coast drive this year. As the team's head programmer, I'm looking for information on the drive code itself. Can anyone help me learn the code?
|
Re: West Coast Drive Code
In terms of software, WCD is no different than any other skid steer setup. Differing velocities of the wheels against the ground on either side of the robot create a torque about the center of the robot which causes it to turn.
So, a naive approach to how to control a WCD robot is something like this. In fact if you boot up a robot in WPILib using a single joystick and arcade drive, this is exactly what you will get. Code:
// Throttle is how fast we want to be moving foward or backward.Code:
// 0 throttle, .5 turnCode:
double skim(double v) {One approach to fix this is to amp up turn so you can turn harder while going fast Code:
turn = turn * 1.5;Code:
turn = turn * (another_gain * fabs(throttle));Code:
if (!turnButton)Another way to solve this would be only apply the throttle dependent turning when throttle has reached a certain threshold. This can get a little weird at the transition point, though. Code:
if (throttle > .5) |
Re: West Coast Drive Code
|
Re: West Coast Drive Code
Here's pseudocode and sample contour maps for a 2-parameter tunable Arcade algorithm. One parameter adjusts the strength of the turn at max throttle, the other adjusts the strength of the turn at zero throttle. The left and right wheel speeds are smoothly interpolated for partial throttle so that the wheel speeds stay in the range -1 to +1 without the need for clipping. Please note: The tunable algorithm attachment is near the bottom of the list1: http://www.chiefdelphi.com/media/papers/2661 1As of 8/17/2012, that is. As new attachments are added, they are put at the bottom of the list. AFAIK, vBulletin provides no way to rearrange the attachments into a more sensible order |
Re: West Coast Drive Code
@Tom
How does one determine the "gain?" Trial and error, algorithms, etc? Would something like this be correct? Code:
// Xbox Controller |
Re: West Coast Drive Code
Quote:
Quote:
I have pseudocode that takes that a step further and does throttle-dependent nonlinear interpolation of the wheel speeds, but that seems like overkill. However if there's any interest I'll post that too. Quote:
|
Re: West Coast Drive Code
Quote:
@Rapture If you want to go the trial & error route: The simplest way for the driver to determine what gain is best suited for the specific style of driving would be to use a throttle or button setup to adjust it on the fly. That way you don't have to re-compile and re-upload code to make adjustments. Or, better yet, the gain could be adjustable from the driver's station. |
Re: West Coast Drive Code
OK I can take a hint. Here's a plain-English explanation for arcade linear interpolation: http://www.chiefdelphi.com/media/papers/download/3495 |
Re: West Coast Drive Code
Quote:
For the most part, we tune our turning around 100% throttle. Any time spent out of 100% throttle while traversing the field is time wasted. Any time that requires less than 100% throttle is usually a straight line approach. @Ether Nice! We will definitely need to try that out. |
Re: West Coast Drive Code
Thanks to everyone who offered advice; this will really help me understand the west coast drive code. Is this all compatible with the Wind River C++ coding program?
|
Re: West Coast Drive Code
I've read through this several times. I believe I understand it, but it only seems to be useful in the case where you are using one joystick as the throttle and the other to turn.
Wouldn't using a two joystick setup where you only use the y-axis on both not have the problem all this coding is trying to correct? You can turn at high speeds by feathering one joystick, and turn at lows speeds by slamming the joysticks in opposite directions. Or am I missing a benefit in the throttle/turn joystick setup? |
Re: West Coast Drive Code
Quote:
Quote:
|
Re: West Coast Drive Code
Quote:
cheers arun |
Re: West Coast Drive Code
Quote:
1for those interested, the derivation is explained here |
Re: West Coast Drive Code
Great, quick question -
would setting a = 0.25; b = 0.40; be similar to setting: a=0 b=1 and passing the joystick inputs through a cubic? |
| All times are GMT -5. The time now is 10:19 AM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi