In this paper, we explore the use of quintic splines for more sophisticated robot pathing in FTC. Traditionally, FTC robot autonomous motion consists of a series of linear movements (including holonomic drive strafing) and point turns. Although these simple path primitives generally suffice, they are not time-optimal under reasonable kinematic constraints, especially for nonholonomic (e.g., tank/differential) drivetrains. That is, the fastest route between two poses in general is not two point turns and a line.1 To address this, we propose the use of quintic splines to achieve quick, smooth motion on the field.
In the first part of the paper, we will describe the problem in depth and give motivation for splines. In the second half, we explore some of the mathematics behind quintic splines (and parametric curves more generally) including interpolation, reparametrization, and heading computation.
In FTC, it’s standard to have a sequence a poses that you want the
robot to follow in autonomous (although pre-planned motions can also be
utilized in TeleOp). For example, in the Relic Recovery game, a common
movement task may be moving from one pose on the balancing stone to
another in front of the cryptobox. This is traditionally handled with a
series of straight lines and turns that are executed with 1D position
PID controllers and potentially motor-based velocity PID (e.g.,
RUN_USING_ENCODER
).
For many game tasks and teams, this is a perfectly viable approach. However, in scenarios where speed is desirable (such as the effectively unlimited scoring potential in Relic Recovery autonomous), conventional methods tend to become less effective. Higher speeds usually lead to greater wheel accelerations and slippage, hindering odometry. Additionally, the feedback controllers may have more chaotic transient behavior or decreased steady-state performance.
In this case, motion profiling can be used to achieve higher speeds without sacrificing accuracy by observing the robot’s physical constraints (e.g., maximum velocity, acceleration).2. However, this is only part of the solution; in fact, motion profiling amplifies the discontinuities between the elements of a conventional pose-to-pose path. Each transition between rotation and translations demands a full deceleration-acceleration cycle.
To eliminate this unnecessary pause, we seek to combine the rotation and translation into a single smooth curve. Although many curves suffice, splines are typically employed for this purpose. For simplicity, this paper only considers polynomial splines3. Quintic splines in particular were selected for their balance between continuity and curvature although the methods described can be easily extended to polynomials of arbitrary odd degree.
Before constructing paths, it is imperative to define a consistent
coordinate system. With this coordinate frame, points on the field can
be uniquely described. This allows for the specification of robot poses
which consist of the position and a heading direction. This heading is
typically encoded as angle from the
To fully understand the following mathematics, it helps to grasp a
little vector calculus (don’t be scared — only basic knowledge of
single-variable calculus is required). Recall that a Euclidean vector
Aside from vector addition and scalar multiplication, two additional
operations are commonly defined between Euclidean vectors. First, the
dot product is defined as the scalar sum of the element-wise products of
two vectors:
Two-dimensional curves can be represented as graphs of
one-dimensional functions (
Parametric curves can be represented as a vector of single-variable
functions:
A parametric curve is said to be
Quintic splines consist of a series of segments assembled together
into a single piecewise curve. Each of the segments is a parametric
curve with a quintic polynomial for each component. The ith segment of a
two-dimensional quintic spline of
Now that we’ve interpolated the spline segments, we have to join
together all of the spline segments into a single piecewise function of
a unified variable. To accomplish this, we’re going to reparametrize
To shift from
By computing
Now, all of the spline segments and various other parametric curves
are combined into a single curve
Let
The discussion in the previous sections has been limited to the translational components of the path. This, of course, must be accompanied by some sort of angular motion. For holonomic drives, the heading can be controlled completely independently. In this case, heading can be treated as a third independent path component that can be specified by an arbitrary parametric curve.
However, for nonholonomic drives, the heading is constrained to the
direction of travel. For parametric curves, this direction is given by
the vector
This paper discussed the motivation for splines in FTC and some mathematics for generating basic quintic splines. The author hopes this will help further the proliferation of advanced motion planning techniques in FTC.
The keen reader will realize that this is not necessarily the case for holonomic drives. All pose-to-pose movements can be executed with a combination of strafing and rotating. Nevertheless, splines can still be of use. For one, traveling along the tangent can reduce dead reckoning odometrical errors accrued from translating on the lateral axis (especially for mecanum drives). Additionally, splines can help navigate around obstacles in situations where piecewise linear paths would normally be required.↩︎
For a good introduction to motion profiling, see the canonical talk by mentors from FRC teams 254 and 971: https://www.youtube.com/watch?v=8319J1BEHwM↩︎
http://www.ryanjuckett.com/programming/biarc-interpolation/ is a great introduction to biarc splines.↩︎
This is generally the best choice for splines in the context of path planning although other schemes are occasionally employed. For instance, one can instead force the third and fourth derivatives to equal zero.↩︎
This derivation depends heavily on the BAC-CAB identity: