Quote:
Originally Posted by Tom Line
If I put the speed to 1 (full) and the rotation to 1 (full) I get a wheel speed of 2+. I was assuming the full-scale wheel speed was from -1 to 1. Is that not the case?
|
Yes, the wheel speed is -1 to 1. However, the spreadsheet/equations do not account for this at all in that implementation. Our code had a thing like this in it:
Code:
// only need to scale if speed > 1
if (highest_speed > 1.0 )
{
// scale each speed by the highest speed
for (int i = 0; i < 4; i++)
speeds[i] /= highest_speed;
}
It would just have made the spreadsheet more complicated to implement it that way, so I left it out.
Quote:
Originally Posted by Tom Line
In addition, when I put in Speed 1, Angle 0, Rotation 1, I get a picture where the two left wheels are 90 degrees from the supposed angle of travel shown in the overall motion. That would seem to me to be physically impossible, as it appears you are trying to literally drag those two wheels sideways.
|
Yes, I think that is how it ends up working, and it is a bit counterintuitive. Generally speaking, I don't think we used high values of rotation and high values of speed particularly often.
Keep in mind that you *cannot* travel in a straight line AND rotate at the same time without some external thing helping you compensate (for instance, a gyro), because you will always be having to adjust things relative to the robot. This is probably where part of the confusion comes from. However, with a gyro and a PID controller, you can make it go in a straight line and rotate at the same time without too much effort.
On the same website, we have our 2009 code posted which has a SwerveDrive.cpp with an implementation of this stuff there. We ended up finding an annoying bug in our implementation though (it had to do with the way that we calculated the shortest path for our servos).. but, I never updated the site with the code. Or maybe I did, I don't recall. But its a useful starting point in any case.