Chapter 27: Disturbance Rejection and Reference Tracking Design

Lesson 4: Command Shaping and Reference Profiling (Linear Approach)

This lesson studies command shaping and reference profiling as linear tools for improving tracking performance of feedback systems without degrading disturbance rejection. We formalize prefilters in the Laplace domain, derive design formulas for model matching in second-order systems, construct smooth polynomial reference trajectories, and provide multi-language implementations suitable for robotics and motion-control applications.

1. Conceptual Overview of Command Shaping

In previous lessons you have seen that for a fixed feedback loop the closed-loop transfer function from reference input \( r(t) \) to output \( y(t) \) determines overshoot, settling time, and noise sensitivity. Command shaping addresses tracking performance not by changing the controller \( C(s) \), but by modifying the reference signal before it enters the loop.

Consider an LTI closed-loop from an internal reference signal \( r_c(t) \) (the controller input) to the output:

\[ y(t) = (h * r_c)(t) = \int_0^{\infty} h(\sigma)\,r_c(t-\sigma)\,\mathrm{d}\sigma, \]

where \( h(t) \) is the impulse response and \( * \) denotes convolution. If we insert a shaping filter with impulse response \( f(t) \) in front of the loop, \( r_c(t) = (f * r)(t) \), then

\[ y(t) = (h * f * r)(t) = ((h * f) * r)(t). \]

The output is thus the response of a new equivalent system with impulse response \( h_{\text{eq}}(t) = (h * f)(t) \) to the original reference \( r(t) \). We can design \( f(t) \) (or equivalently \( F(s) \)) to:

  • Reduce overshoot and oscillations for step or ramp commands.
  • Limit commanded velocity and acceleration to stay within actuator limits.
  • Avoid exciting lightly damped resonances (important in robotics and flexible mechanisms).

In frequency-domain terms, if the original closed-loop transfer function from internal reference \( r_c \) is \( T_0(s) \), and the command shaper has \( F(s) \), then from the external reference \( r \) to the output we obtain

\[ T_r(s) = \frac{Y(s)}{R(s)} = F(s)\,T_0(s). \]

The key idea of this lesson is: by appropriately choosing \( F(s) \) or directly shaping \( r(t) \), we can achieve desired reference-tracking dynamics while leaving the disturbance-rejection properties of the feedback loop largely unchanged.

flowchart TD
  R["External reference r(t)"] --> S1["Design command shaper F(s) or trajectory"]
  S1 --> S2["Shaped command r_c(t)"]
  S2 --> S3["Closed-loop system (controller + plant)"]
  S3 --> Y["Output y(t) with improved tracking"]
  S3 --> DNOTE["Disturbance rejection unchanged \n(same feedback loop)"]
        

2. Closed-Loop Structure with Linear Prefilter

We adopt the standard single-input single-output negative feedback loop with controller \( C(s) \), plant \( G(s) \), and unity feedback for simplicity. A command-shaping prefilter \( F(s) \) acts on the external reference \( R(s) \).

flowchart TD
  R["R(s)"] --> F["F(s) (command shaper)"]
  F --> SUM["+ (tracking error)"]
  SUM --> C["C(s) (controller)"]
  C --> G["G(s) (plant)"]
  G --> Y["Y(s)"]
  Y --> FB["Feedback H(s)=1"]
  FB --> SUM
  D["D(s) (disturbance at plant input)"] --> G
        

Let the internal reference be \( R_c(s) = F(s)R(s) \). The closed-loop transfer function from \( R_c \) to \( Y \) is

\[ T_0(s) = \frac{Y(s)}{R_c(s)} = \frac{C(s)G(s)}{1 + C(s)G(s)}. \]

Therefore the transfer function from the external reference to the output is

\[ T_r(s) = \frac{Y(s)}{R(s)} = F(s)\,T_0(s) = F(s)\,\frac{C(s)G(s)}{1 + C(s)G(s)}. \]

A disturbance \( D(s) \) entering at the plant input produces

\[ T_d(s) = \frac{Y(s)}{D(s)} = \frac{G(s)}{1 + C(s)G(s)}. \]

Note that \( T_d(s) \) does not involve \( F(s) \). Consequently:

  • Command shaping modifies \( T_r(s) \) (tracking dynamics).
  • Command shaping does not change \( T_d(s) \) (disturbance rejection).

This separation allows us to tune \( C(s) \) primarily for stability and disturbance rejection (as in previous lessons), and then use \( F(s) \) to refine tracking behaviour.

3. Linear Prefilter Design via Model Matching

Suppose the closed-loop from internal reference to output has transfer function \( T_0(s) \), and we desire an effective reference-to-output transfer function \( T_{\text{des}}(s) \) that meets transient specifications (overshoot, settling time, bandwidth, etc.).

Ideally we want

\[ T_{\text{des}}(s) = \frac{Y(s)}{R(s)} = F(s)\,T_0(s). \]

Whenever \( T_0(s) \) is stable and minimum-phase (no right-half-plane zeros or time delay), a natural candidate is the model-matching prefilter

\[ F(s) = \frac{T_{\text{des}}(s)}{T_0(s)}. \]

Writing \( T_0(s) = \frac{N_0(s)}{D_0(s)} \) and \( T_{\text{des}}(s) = \frac{N_{\text{des}}(s)}{D_{\text{des}}(s)} \), we obtain

\[ F(s) = \frac{N_{\text{des}}(s)D_0(s)}{D_{\text{des}}(s)N_0(s)}. \]

For \( F(s) \) to be physically realizable and internally stabilizing, we need:

  • Properness: the degree of the numerator does not exceed that of the denominator, ensuring bounded gain as \( s \rightarrow \infty \).
  • Stability: all poles of \( F(s) \) lie in the left half-plane.
  • No unstable pole-zero cancellations: we must not cancel zeros of \( T_0(s) \) in the right half-plane. If \( T_0(s) \) has a factor \( (s - z_u) \) with \( \Re(z_u) > 0 \), then \( F(s) \) may not contain \( 1/(s - z_u) \).

A useful constraint is \( F(0) = 1 \), which guarantees that steady-state gains remain unchanged:

\[ \lim_{s \rightarrow 0} T_r(s) = \lim_{s \rightarrow 0} F(s)T_0(s) = F(0)\,T_0(0). \]

If \( F(0) = 1 \), then the final value of the response to a unit step remains determined by \( T_0(0) \), preserving steady-state error properties designed in earlier chapters.

4. Second-Order Closed-Loop Command Shaping

Many motion and servo systems are dominated by a pair of complex closed-loop poles, so that from internal reference to output we can approximate

\[ T_0(s) = \frac{\omega_n^2}{s^2 + 2\zeta_0\omega_n s + \omega_n^2}, \quad 0 < \zeta_0 < 1,\quad \omega_n > 0. \]

The unit-step response of this standard second-order form has overshoot

\[ M_p(\zeta_0) = \exp\!\left( -\frac{\pi \zeta_0}{\sqrt{1 - \zeta_0^2}} \right), \quad 0 < \zeta_0 < 1. \]

Suppose the existing feedback design gives \( \zeta_0 \) and \( \omega_n \), but we desire a more heavily damped reference tracking behaviour with effective damping ratio \( \zeta_1 > \zeta_0 \), while keeping the same natural frequency for simplicity:

\[ T_{\text{des}}(s) = \frac{\omega_n^2}{s^2 + 2\zeta_1\omega_n s + \omega_n^2}. \]

The model-matching prefilter is then

\[ F(s) = \frac{T_{\text{des}}(s)}{T_0(s)} = \frac{s^2 + 2\zeta_0\omega_n s + \omega_n^2} {s^2 + 2\zeta_1\omega_n s + \omega_n^2}. \]

Key properties:

  • Steady-state gain: \( F(0) = 1 \), hence steady-state tracking for steps is unchanged.
  • Effective damping: from \( R(s) \) to \( Y(s) \) we now have \( T_r(s) = T_{\text{des}}(s) \), so the step overshoot becomes \( M_p(\zeta_1) \). For example, a design might move from \( \zeta_0 = 0.4 \) (about 25% overshoot) to \( \zeta_1 \approx 1 \) (negligible overshoot).
  • Zeros and poles: \( F(s) \) has two poles at the more heavily damped locations (denominator) and two zeros close to the original poles (numerator). Implementing this filter is equivalent to adding a specific lead-lag network at the reference input.

In practice, we often choose \( \zeta_1 \) between \( 0.8 \) and \( 1.2 \), giving fast but well-damped motion commands for robot joints, drive axes, or positioning systems.

5. Polynomial Reference Profiling (Cubic Trajectories)

An alternative to filtering a given reference is to construct a smooth command trajectory that the closed loop will track. For a point-to-point motion from position \( q(0) = 0 \) to \( q(T) = q_f \), a common choice in robotics is a cubic polynomial with zero initial and final velocity:

\[ q(t) = a_0 + a_1 t + a_2 t^2 + a_3 t^3, \quad 0 \leq t \leq T. \]

The boundary conditions are

\[ q(0) = 0,\quad q(T) = q_f,\quad \dot{q}(0) = 0,\quad \dot{q}(T) = 0. \]

We compute the coefficients:

  • From \( q(0) = 0 \): \( a_0 = 0 \).
  • From \( \dot{q}(t) = a_1 + 2a_2 t + 3a_3 t^2 \) and \( \dot{q}(0) = 0 \) we get \( a_1 = 0 \).
  • From \( q(T) = a_2T^2 + a_3T^3 = q_f \) and \( \dot{q}(T) = 2a_2T + 3a_3T^2 = 0 \), we obtain \( a_2 = -\tfrac{3}{2}a_3T \). Substituting into \( q(T) = q_f \) gives

\[ -\tfrac{3}{2}a_3T\cdot T^2 + a_3T^3 = q_f \quad \Rightarrow \quad -\tfrac{1}{2}a_3T^3 = q_f \quad \Rightarrow \quad a_3 = -\frac{2q_f}{T^3}, \]

\[ a_2 = -\tfrac{3}{2}a_3T = \frac{3q_f}{T^2}. \]

Thus the cubic reference profile is

\[ q(t) = \frac{3q_f}{T^2}t^2 - \frac{2q_f}{T^3}t^3,\quad 0 \leq t \leq T. \]

The corresponding velocity and acceleration are

\[ \dot{q}(t) = \frac{6q_f}{T^2}t - \frac{6q_f}{T^3}t^2 = \frac{6q_f}{T^3}t(T - t), \]

\[ \ddot{q}(t) = \frac{6q_f}{T^2} - \frac{12q_f}{T^3}t. \]

Compared with a step command \( q(t) = q_f \), this polynomial profile limits velocity and acceleration peaks, reducing excitation of resonant modes and improving tracking in lightly damped systems. In robotics software, such cubic profiles are used as high-level reference trajectories whose samples are passed to the underlying linear servo loops.

6. Python Lab — Prefilter and Cubic Profile (with Robotics Context)

We now implement a second-order prefilter \( F(s) \) and a cubic reference profile in Python. The example uses the python-control library for transfer function operations and can be embedded in robotics simulation frameworks such as roboticstoolbox for joint-space motion.


import numpy as np
import control as ct   # python-control library
import matplotlib.pyplot as plt

# Closed-loop parameters (from previous controller design)
omega_n = 10.0           # natural frequency [rad/s]
zeta_0  = 0.4            # existing damping
zeta_1  = 0.9            # desired effective damping for reference tracking

# Closed-loop from internal reference to output:
# T0(s) = omega_n^2 / (s^2 + 2*zeta_0*omega_n*s + omega_n^2)
T0 = ct.TransferFunction(
    [omega_n**2],
    [1.0, 2.0*zeta_0*omega_n, omega_n**2]
)

# Prefilter F(s) implementing model matching:
# F(s) = (s^2 + 2*zeta_0*omega_n*s + omega_n^2)
#        / (s^2 + 2*zeta_1*omega_n*s + omega_n^2)
F = ct.TransferFunction(
    [1.0, 2.0*zeta_0*omega_n, omega_n**2],
    [1.0, 2.0*zeta_1*omega_n, omega_n**2]
)

# Effective closed-loop from external reference to output
T_ref = F * T0

# Step responses: with and without prefilter
t = np.linspace(0.0, 3.0, 1000)
t1, y_no_pref = ct.step_response(T0, T=t)
t2, y_pref    = ct.step_response(T_ref, T=t)

plt.figure()
plt.plot(t1, y_no_pref, label="Without prefilter")
plt.plot(t2, y_pref,    label="With prefilter F(s)")
plt.xlabel("Time [s]")
plt.ylabel("Output y(t)")
plt.legend()
plt.grid(True)
plt.title("Command shaping by linear prefilter")
plt.show()

# --- Cubic reference profile generator (for robot joint motion) ---

def cubic_profile(q_f, T, t_array):
    """Return cubic point-to-point trajectory q(t) from 0 to q_f over [0, T]."""
    t = np.clip(np.array(t_array), 0.0, T)
    s = t / T
    q = 3.0*q_f*s**2 - 2.0*q_f*s**3
    return q

T_move = 1.0      # motion duration [s]
q_f    = 1.0      # target position [rad]

t_traj = np.linspace(0.0, T_move, 500)
q_traj = cubic_profile(q_f, T_move, t_traj)

plt.figure()
plt.plot(t_traj, q_traj)
plt.xlabel("Time [s]")
plt.ylabel("Reference position q(t) [rad]")
plt.title("Cubic reference trajectory")
plt.grid(True)
plt.show()

# In a robotics framework (e.g., roboticstoolbox), q_traj samples would be
# streamed as joint position setpoints to a linear PID or state-feedback servo.
      

This code illustrates how command shaping at the reference level can be prototyped and visualized in Python before deployment in a robotics control stack.

7. C++ Implementation — Cubic Reference Generator for Embedded Control

On embedded controllers (microcontrollers, real-time Linux, or ROS nodes), command shaping is often implemented as a small reference-generation module that outputs a position (and possibly velocity) setpoint each control cycle. The following C++ code implements the cubic profile of Section 5.


#include <cmath>

// Simple cubic point-to-point trajectory generator.
// Designed to run inside a real-time control loop, e.g. a ROS "joint_trajectory" node.
class CubicTrajectory {
public:
    CubicTrajectory(double q_final, double T_move)
        : q_f_(q_final),
          T_(T_move)
    {}

    // Position profile q(t) for 0 <= t <= T.
    double position(double t) const {
        if (t <= 0.0) return 0.0;
        if (t >= T_) return q_f_;
        double s = t / T_;
        return 3.0 * q_f_ * s * s - 2.0 * q_f_ * s * s * s;
    }

    // Velocity profile dq/dt (optional use for feedforward).
    double velocity(double t) const {
        if (t <= 0.0 || t >= T_) return 0.0;
        double s = t / T_;
        // dq/dt = (6*q_f/T^2)*t - (6*q_f/T^3)*t^2
        return (6.0 * q_f_ / (T_ * T_)) * t
             - (6.0 * q_f_ / (T_ * T_ * T_)) * t * t;
    }

private:
    double q_f_;
    double T_;
};

// Example usage inside a control loop (e.g. in ROS):
//
// CubicTrajectory traj(1.0, 1.0);
// double t = 0.0;
// double dt = 0.001;
// while (ros::ok()) {
//     double q_ref = traj.position(t);
//     // send q_ref to joint PID controller as setpoint
//     t += dt;
// }
      

In a robotics context (e.g. ROS roscpp), this class would be used to generate joint-level setpoints that are then tracked by linear PID controllers designed in earlier chapters. The command shaping resides entirely at the reference level and does not modify the feedback gains.

8. Java Implementation — Command Profile for Motion Control

Java-based control stacks (for example, some industrial motion controllers or robotics frameworks such as rosjava or WPILib in mobile robots) can implement the same cubic command profile as a reusable class.


public class CubicTrajectory {
    private final double qFinal;
    private final double T;

    public CubicTrajectory(double qFinal, double Tmove) {
        this.qFinal = qFinal;
        this.T = Tmove;
    }

    public double position(double t) {
        if (t <= 0.0) return 0.0;
        if (t >= T)   return qFinal;
        double s = t / T;
        return 3.0 * qFinal * s * s - 2.0 * qFinal * s * s * s;
    }

    public double velocity(double t) {
        if (t <= 0.0 || t >= T) return 0.0;
        return (6.0 * qFinal / (T * T)) * t
             - (6.0 * qFinal / (T * T * T)) * t * t;
    }

    // Example integration with a Java-based control loop:
    // CubicTrajectory traj = new CubicTrajectory(1.0, 1.0);
    // double t = 0.0;
    // double dt = 0.001;
    // while (robotIsEnabled()) {
    //     double qRef = traj.position(t);
    //     // send qRef to a PID controller for the joint or axis
    //     t += dt;
    // }
}
      

The Java implementation mirrors the C++ logic and can be integrated into higher-level robotics or motion control frameworks, providing a purely linear reference trajectory for existing feedback controllers.

9. MATLAB/Simulink Implementation — Prefilter and Reference Profiling

MATLAB and Simulink are standard tools in control engineering and robotics for prototyping command shaping. The following script constructs \( T_0(s) \), \( F(s) \), and the cubic reference profile, and then simulates the shaped response.


% Parameters
omega_n = 10;      % natural frequency
zeta0   = 0.4;     % existing damping
zeta1   = 0.9;     % desired effective damping

s = tf('s');

% Closed-loop from internal reference to output
T0 = omega_n^2 / (s^2 + 2*zeta0*omega_n*s + omega_n^2);

% Prefilter F(s)
F  = (s^2 + 2*zeta0*omega_n*s + omega_n^2) ...
   / (s^2 + 2*zeta1*omega_n*s + omega_n^2);

% Reference-to-output transfer with prefilter
T_ref = F * T0;

% Step responses
figure;
step(T0, T_ref);
legend('Without prefilter', 'With prefilter F(s)');
grid on;
title('Command shaping via prefilter');

% Cubic reference profile
q_f = 1;   % final position
Tmove = 1; % move duration
t = linspace(0, Tmove, 500);
s_norm = t / Tmove;
q = 3*q_f*s_norm.^2 - 2*q_f*s_norm.^3;

figure;
plot(t, q);
xlabel('Time [s]');
ylabel('q(t)');
title('Cubic reference trajectory');
grid on;

% Simulink implementation:
% - Use a "Transfer Fcn" block for F(s).
% - Use a "Transfer Fcn" block for the plant closed-loop model or the plant
%   and controller separately.
% - Generate q(t) (cubic profile) with a MATLAB Function block or a
%   polynomial block, then feed it through F(s) into the existing servo loop.
      

Simulink diagrams built from these blocks can be directly connected to robotics toolboxes (e.g. Robotics System Toolbox) for more elaborate multi-axis simulations.

10. Mathematica Implementation — Symbolic and Numeric Study

Wolfram Mathematica is well suited for symbolic manipulation of transfer functions and exact derivations of prefilters and trajectories. The following example constructs \( T_0(s) \), \( F(s) \), and symbolic expressions for the cubic profile.


(* Parameters *)
omegaN = 10.0;
zeta0  = 0.4;
zeta1  = 0.9;

s = LaplaceTransformVariable[];

(* T0(s) = omega_n^2 / (s^2 + 2*zeta0*omega_n*s + omega_n^2) *)
T0 = TransferFunctionModel[
   omegaN^2/(s^2 + 2 zeta0 omegaN s + omegaN^2),
   s
];

(* F(s) *)
F  = TransferFunctionModel[
   (s^2 + 2 zeta0 omegaN s + omegaN^2)/
   (s^2 + 2 zeta1 omegaN s + omegaN^2),
   s
];

Tref = SeriesConnection[F, T0]; (* F(s)*T0(s) *)

(* Step response comparison *)
stepNoPref = StepResponse[T0, {t, 0, 3}];
stepPref   = StepResponse[Tref, {t, 0, 3}];

Show[
  {
    Plot[Evaluate[stepNoPref["ValuesOnGrid"]], {t, 0, 3},
      PlotLegends -> {"Without prefilter"}],
    Plot[Evaluate[stepPref["ValuesOnGrid"]], {t, 0, 3},
      PlotStyle -> Dashed,
      PlotLegends -> {"With prefilter F(s)"}]
  },
  AxesLabel -> {"t", "y(t)"}
];

(* Symbolic cubic trajectory q(t) *)
Clear[q, qf, Tmove];
q[t_, qf_, Tmove_] := 3 qf (t/Tmove)^2 - 2 qf (t/Tmove)^3;

D[q[t, qf, Tmove], t]   (* velocity *)
D[q[t, qf, Tmove], {t, 2}]  (* acceleration *)

(* Numeric plot for qf = 1, Tmove = 1 *)
Plot[q[t, 1.0, 1.0], {t, 0, 1},
  AxesLabel -> {"t", "q(t)"},
  PlotRange -> All
]
      

Symbolic expressions obtained in Mathematica can be used to verify analytic derivations of overshoot, rise time, and acceleration bounds for the shaped command.

11. Problems and Solutions

Problem 1 (Steady-State Invariance with Prefilter): Consider a stable closed-loop transfer function \( T_0(s) \) from internal reference to output, and a stable proper prefilter \( F(s) \). Show that if \( F(0) = 1 \), then the steady-state output to a unit step reference is unchanged by the prefilter.

Solution:

For a unit step input, \( R(s) = 1/s \). Without prefilter, the output Laplace transform is \( Y_0(s) = T_0(s)\tfrac{1}{s} \). With prefilter, the output is \( Y(s) = F(s)T_0(s)\tfrac{1}{s} \). The final-value theorem gives

\[ y_0(\infty) = \lim_{t \rightarrow \infty} y_0(t) = \lim_{s \rightarrow 0} s Y_0(s) = \lim_{s \rightarrow 0} T_0(s), \]

\[ y(\infty) = \lim_{s \rightarrow 0} s Y(s) = \lim_{s \rightarrow 0} F(s)T_0(s) = F(0)\,T_0(0). \]

Thus if \( F(0) = 1 \), then \( y(\infty) = y_0(\infty) \). The prefilter does not change steady-state tracking to a step but can change transient behaviour.

Problem 2 (Second-Order Prefilter Design): A closed-loop from internal reference to output is approximated by

\[ T_0(s) = \frac{25}{s^2 + 4s + 25}, \]

which corresponds to \( \omega_n = 5 \) and \( \zeta_0 = 0.4 \). You would like the effective reference-to-output transfer function to have the same natural frequency but critically damped dynamics (\( \zeta_1 = 1 \)). Construct the prefilter \( F(s) \) and verify that \( F(0) = 1 \).

Solution:

The desired transfer function is

\[ T_{\text{des}}(s) = \frac{25}{s^2 + 10s + 25}. \]

The model-matching prefilter is

\[ F(s) = \frac{T_{\text{des}}(s)}{T_0(s)} = \frac{s^2 + 4s + 25}{s^2 + 10s + 25}. \]

Evaluating at \( s = 0 \) yields \( F(0) = \tfrac{25}{25} = 1 \), so the step steady-state value is preserved. The new effective transfer function from \( R(s) \) to \( Y(s) \) is \( T_{\text{des}}(s) \), which has zero overshoot because it is critically damped.

Problem 3 (Feasibility with Non-Minimum-Phase Zeros): Suppose \( T_0(s) \) has a right-half-plane zero at \( s = +1 \), so that

\[ T_0(s) = \frac{(s-1)N_1(s)}{D_0(s)}, \]

with all other poles and zeros stable. Explain why an exact model-matching prefilter that cancels \( (s-1) \) in the numerator of \( T_0(s) \) is not acceptable.

Solution:

Any exact model-matching prefilter would need a factor \( 1/(s-1) \) in its transfer function. This factor has a pole at \( s = 1 \), so the prefilter itself would be unstable. Implementing such a filter would make the overall system unstable even if the original feedback loop is stable. Therefore, for non-minimum-phase systems, exact model matching by inversion is not feasible; instead, we design an approximate stable \( F(s) \) that does not cancel right-half-plane zeros.

Problem 4 (Properties of Cubic Reference Profile): For the cubic trajectory

\[ q(t) = \frac{3q_f}{T^2}t^2 - \frac{2q_f}{T^3}t^3,\quad 0 \leq t \leq T, \]

show that \( q(0) = 0 \), \( q(T) = q_f \) and that \( \dot{q}(0) = \dot{q}(T) = 0 \). Compute the maximum velocity and the time at which it occurs.

Solution:

Substituting \( t = 0 \) clearly yields \( q(0) = 0 \). For \( t = T \),

\[ q(T) = \frac{3q_f}{T^2}T^2 - \frac{2q_f}{T^3}T^3 = 3q_f - 2q_f = q_f. \]

The velocity is

\[ \dot{q}(t) = \frac{6q_f}{T^2}t - \frac{6q_f}{T^3}t^2 = \frac{6q_f}{T^3}t(T - t), \]

hence \( \dot{q}(0) = 0 \) and \( \dot{q}(T) = 0 \). To find the maximum velocity, set \( \ddot{q}(t) = 0 \). Since

\[ \ddot{q}(t) = \frac{6q_f}{T^2} - \frac{12q_f}{T^3}t, \]

solving \( \ddot{q}(t) = 0 \) gives \( t^\star = T/2 \). The corresponding maximum velocity is

\[ \dot{q}(t^\star) = \frac{6q_f}{T^3}\frac{T}{2}\left(T - \frac{T}{2}\right) = \frac{6q_f}{T^3}\frac{T^2}{4} = \frac{3q_f}{2T}. \]

Thus the cubic profile achieves its maximum velocity \( \tfrac{3q_f}{2T} \) at mid-trajectory \( t = T/2 \).

Problem 5 (Frequency-Domain Effect of a First-Order Prefilter): Consider a first-order closed-loop

\[ T_0(s) = \frac{10}{s + 10}, \]

and a first-order prefilter \( F(s) = \frac{1}{\alpha s + 1} \) with \( \alpha > 0 \). For a sinusoidal reference \( r(t) = \sin(\omega t) \), show that the steady-state output amplitude with the prefilter is

\[ |Y(j\omega)| = \frac{10}{\sqrt{\omega^2 + 10^2}\,\sqrt{\alpha^2\omega^2 + 1}}, \]

and deduce that the prefilter always attenuates the sinusoidal reference (\( |F(j\omega)| \leq 1 \)).

Solution:

The magnitude of \( T_0(j\omega) \) is \( |T_0(j\omega)| = 10/\sqrt{\omega^2 + 10^2} \). The magnitude of the prefilter is \( |F(j\omega)| = 1/\sqrt{\alpha^2\omega^2 + 1} \). The total reference-to-output gain is

\[ |T_r(j\omega)| = |F(j\omega)||T_0(j\omega)| = \frac{10}{\sqrt{\omega^2 + 10^2}\,\sqrt{\alpha^2\omega^2 + 1}}. \]

Because \( \alpha^2\omega^2 \geq 0 \) for all \( \omega \), the denominator \( \sqrt{\alpha^2\omega^2 + 1} \geq 1 \), therefore \( |F(j\omega)| \leq 1 \) for all \( \omega \). The first-order prefilter acts as a low-pass filter that cannot amplify any sinusoidal component of the reference signal.

12. Summary

This lesson developed linear command shaping and reference profiling as tools for improving tracking performance without altering disturbance rejection. We derived the closed-loop structure with a prefilter, emphasized model matching through \( F(s) = T_{\text{des}}(s)/T_0(s) \), and studied second-order examples where overshoot and damping are tuned at the reference level while preserving steady-state tracking.

We introduced polynomial (cubic) reference profiles widely used in robotics and motion control, and showed how they limit velocity and acceleration. Implementation examples in Python, C++, Java, MATLAB/Simulink, and Mathematica demonstrated how to embed these ideas in software. The problem set highlighted key theoretical aspects: steady-state invariance, feasibility under non-minimum-phase zeros, and both time- and frequency-domain viewpoints of command shaping.

13. References

  1. Singer, N.C., & Seering, W.P. (1990). Preshaping command inputs to reduce system vibration. Journal of Dynamic Systems, Measurement, and Control, 112(1), 76–82.
  2. Tomizuka, M. (1987). Zero phase error tracking algorithm for digital control. Journal of Dynamic Systems, Measurement, and Control, 109(1), 65–68.
  3. Manabe, S. (1998). S-curve trajectory for motion control. Electrical Engineering in Japan, 124(2), 9–15.
  4. Middleton, R.H., & Goodwin, G.C. (1990). Improved finite word length characteristics in digital control using delta operators. IEEE Transactions on Automatic Control, 35(8), 1041–1048.
  5. Horowitz, I., & Sidi, M. (1972). Synthesis of feedback systems with large plant ignorance for prescribed time-domain tolerances. International Journal of Control, 16(2), 287–309.
  6. Shibata, M., & Tomizuka, M. (1995). High-speed positioning in mechatronic systems using versatile filters for canceling residual vibration. Journal of Dynamic Systems, Measurement, and Control, 117(1), 98–105.
  7. Gutman, S. (1979). Uncertain dynamical systems — a Lyapunov min-max approach. IEEE Transactions on Automatic Control, 24(3), 437–443.
  8. Armstrong, B. (1988). On finding exciting trajectories for identification experiments involving systems with nonlinear dynamics. International Journal of Robotics Research, 7(2), 3–20.
  9. Messner, W., Horowitz, R., Kao, I., & Littlejohn, R. (1991). A new class of command shaping filters for cancelling multiple mode vibration. IEEE International Conference on Robotics and Automation, 2199–2204.
  10. Åström, K.J., & Hägglund, T. (1989). The future of PID control. Control Engineering Practice, various theoretical contributions on set-point weighting and prefilters.