Pages

Friday, January 4, 2019

Bézier and Catmull-Rom Implementation Comparison

Having implemented functional Bézier and Catmull-Rom curves has been more revealing than expected.

Figure 1: 2D comparison of curves Figure 2: 3D comparison of curves

The two curves are compared above in 2D (figure 1) and 3D (figure 2). The Bézier curve is shown with spheres at its resolution points and the Catmull-Rom with cubes.



As Catmull-Rom curves interpolate each of their control points, I expected the curve to be positioned more precisely compared to Bézier curves which only interpolate the initial and final control point.
In practice however, Bézier curves which approximate their interior control points are advantageous for my solution as they not only more closely resemble a human foot movement during swing phase, but it requires far less calculation with regard to positioning the control points and their tangent angles than the Catmull-Rom implementation would require to produce a similar outcome.

The more complex control point positioning and angle calculations that would be necessary to overcome oscillations in the curve produced because of overfitting. Bézier curves do not suffer from this due to Bernstein polynomials (discussed further in my Bézier implementation blog) which ensure that the entire curve will exist within the convex hull of the control points.
As each segment of the Catmull-Rom curve will protrude from the control points convex hull there is a slight chance that the curve plotted over the Hermite segments will intersect with an obstacle that otherwise would be completely avoided and not interfere with the limb trajectory.

Being controlled globally is also more suited to my projects design. As each control point is used to define all sections of the whole cubic curve (due to the blending of the control points by the parametric function), it will prevent dramatic outliers which could arise from positioning locally, altering the tangent direction of the arc and creating an unnatural gait.
This issue would likely be made more prominent when the solution is expanded into a 3D IK solver.

These outcomes in addition to further reflection of research materials gathered, show Catmull-Rom splines are best suited to planning highly complex trajectories. They are frequently applied in robotics for obstacles avoidance as discussed by Wang et al. (2019), for UAV path planning - or by Pacheco et al. (2010), for motion control of a robot arm. In both the interpolation of each control point becomes hugely advantageous. The higher number of control points requires piecewise cubic curves, which will remove the oscillations caused by overfitting which are exhibited in Catmull-Rom curves.


Contrary to my initial expectations a Bézier curve suits my needs perfectly. Global control, and a curve guaranteed to fall within the control points polyhedron will allow for reliable trajectory intersection checks and subsequent straightforward adjustment of control points while maintaining a natural arc make them the better choice.

Continuing development 

Now that Bézier curves have proved to be the more appropriate implementation for my solution, I will update the functionality of my Bézier curve class to function as a pathway for the limb end effector, poll for obstacles along the plotted trajectory and adjust the trajectory to ensure an unobstructed pathway for the limb during swing phase.


References
Pacheco, R., Hounsell, M., Rosso, R. and Leal, A. (2010). Smooth trajectory tracking interpolation on a robot simulator. 2010 Latin American Robotics Symposium and Intelligent Robotics Meeting, [online] Available at: https://www.researchgate.net/publication/236634816_Smooth_Trajectory_Tracking_Interpolation_on_a_Robot_Simulator [Accessed 2 Jan. 2019].

Wang, X., Jiang, P., Li, D. and Sun, T. (2019). Curvature Continuous and Bounded Path Planning for Fixed-Wing UAVs. [online] Available at: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5620579/ [Accessed 3 Jan. 2019].