# swerve math quiz

**Given:

• 4-wheel Unicorn swerve robot

• wheels located at corners of the rectangle shown in attached Figure 2

• robot is rotating clockwise around center of rotation (red dot) at omega radians/sec as shown in attached Figures 1 and 2

Problem:

Find the steering angle and tangential speed of each of the 4 wheels in terms of omega, a, b, c, and d.

*

Aware

What differentiates a unicorn swerve drive from a standard swerve drive?

it can honk as it’s swerving past a defender?

Because it’s magical, duh.

Define “standard” swerve…

Unicorn is “4-wheel independent-steering and independent-driven drivetrain, with unlimited rotation of the wheels and sensors, and no gaps in the sensor feedback?” http://www.chiefdelphi.com/forums/showpost.php?p=992407&postcount=9 Oh, and it was so named by none other than JVN!

You might also call it an idealized swerve drive. A more common approach is coaxial swerve, where each side rotates together, and has a limited range of rotation (usually no more than 360 degrees). Another approach might be to have all 4 swerve modules rotate together.

In a fit of boredom, I once defined 27 different types of swerve configurations

My definition of a standard swerve drive are four independently controlled modules, such that each can have its own velocity vectors (i.e., independent direction AND magnitude). Anything less than that is not a swerve (or so I’ve gathered from CD searching and speaking with mentors) – my understanding is that a crab drive is a derivative of a swerve drive where the vectors must all be parallel (and most always have the same velocity magnitude too, though this is not a mechanical limitation).

Gotcha. A true, pure swerve.

I’m a little confused here – I don’t really understand what you’re trying to convey with your examples, unless you’re just mentioning common implementations of what are commonly referred to as swerve drives.

Assuming you’re using continuous potentiometers or some other sort of continuous sensor solution and have independent direction and magnitude control of each module, how is a coaxial swerve drive like 118’s Revolution design NOT a unicorn swerve drive?

Per Nate Laverdure’s paper (page 2, available here), wouldn’t the proper term for what you describe in quote 2 be a crab drive? That’s most certainly not a unicorn swerve drive.

EDIT: Nate beat me to his paper.

He’s saying that one’s definition of “standard” is couched in their social context and their personal experience. These names-- even “crab drive”-- are all invented, and they mean different things to different people.

I was simply listing common implementations that student’s/teams call swerve, even though there may be more accurate terms. To me, swerve is a general concept of physically changing the direction the wheels point in order to implement an omni-directional drive system. Unicorn, crab, and coaxial could be considered to be three subsets or implementations of a swerve drive system.

I believe ‘coaxial’ simply refers to how the drive motor transmits its rotation to the wheel. On a coaxial module the wheel is driven by a shaft that is coaxial with the rotation axis of the module. This allows you to mount your drive motor away from the module and have unlimited rotation.

Based on this definition you could create either a unicorn drive or a crab drive with coaxial modules.

Lets say a, b, c, and d are in meters (because I personally like meters).

Corner 1 has a speed of ω√(b²+c²) in meters per second and angle of arctan(c/b)+π/2 in radians.
Corner 2 has a speed of ω√(a²+c²) in meters per second and angle of arctan(c/a)+π/2 in radians.
Corner 3 has a speed of ω√(a²+d²) in meters per second and angle of arctan(d/a)+π/2 in radians.
Corner 4 has a speed of ω√(b²+d²) in meters per second and angle of arctan(d/b)+π/2 in radians.

Work: (Yes I’m lazy)

For the sake of simplicity, we’ll call “n” the line segment that ends at any corner of the robot and the point of rotation. Create a right triangle with n as its hypotenuse. We can call the angle in the right triangle closest to the robot, the arctangent of the opposite leg divided by the adjacent leg. Then we add pi/2 radians to find the angle of the ray perpendicular to n.

Finding the rotational speed, we first create a circle with its center at the point of rotation and n as its radius. With the right triangle from the last paragraph, n can be found with the Pythagorean Theorem, where n is the square root of the sum of the squares of the two legs. Because n is the radius of the triangle, and we want the speed of the robot in ω radians per second, we can multiply ω by the radius to get the tangential speed.

nice start. speeds are correct but angles are wrong.

do you want a hint about the angles, or would you prefer to work it yourself?

Would you use the reciprocal rule for arctan to simplify it?

Then,
Corner 1 has an angle of -arctan(b/c) in radians.
Corner 2 has an angle of -arctan(a/c) in radians.
Corner 3 has an angle of -arctan(a/d) in radians.
Corner 4 has an angle of -arctan(b/c) in radians.

Still no joy.

Here is my attempt at the angles, I’m not sure if it’s fully simplified. I assumed the zero angle to be when the wheel is pointing upward, and that it has an angular range of -pi to pi.

Corner 1: 2arctan(-cot(ωt/2+arctan(b/c)))
Corner 2: 2
arctan(-cot(ωt/2+arctan(a/c)))
Corner 3: 2arctan(-cot(ωt/2+arctan(a/d)))
Corner 4: 2
arctan(-cot(ωt/2+arctan(b/d)))

I’m headed out the door to work, so no time to do the math. One clue though, is that once you’ve found an answer that will work, there are 15 others that will also work. Each wheel can be rotated in azimuth by pi (180 degrees) and the spin rate can be inverted, producing the same physical result. That’s four independent binary decisions, for 16 results.

G2

For the sake of simplicity then, let me make the problem statement more explicit: I am looking for the solution where all the wheel speeds are positive, i.e. none of the spin rates are inverted. In post#12, Cyan has the correct solution for wheel speeds.

The corresponding formulas for the wheel steering angles for that set of positive wheel speeds can be derived and expressed quite simply if the right trig function is used.

The wheel steering angles should all be 0 when the wheel is steered to the “straight forward” (with respect to the robot) direction. The angle range should be +/- pi radians, where positive angles are steering to the right (clockwise as viewed from above) and negative angles are steering to the left (counterclockwise as viewed from above).

What is “t” ??

Also: only the wheel speeds are a function of ω, not the steering angles.

How are angles measured by? for ex, is 0 in standard forward facing configuration, or is 0 supposed to be zero on the unit circle?

Also any bonus points for including time into the calculation to give the angle at any given second after 0?

EDIT: ignore the first part of this post, forgot to read the whole thread xD