updated on June 25 , 2019
A Proportional-Integrative-Derivative (PID) control is a control loop feedback mechanism widely used in industrial control systems and a variety of other applications requiring continuously modulated control.
A PID controller continuously calculates an error value, as the difference between a desired setpoint and a measured process variable, and applies a correction based on proportional, integral, and derivative terms (denoted P, I, and D respectively), hence the name.
The control of a non-minimum phase system like bikes or motorcycles could not be an easy task for a somehow simple control set like the PID.
A human being is trained from a young age to manage a slow, light and practically gyroscopic effects-free bike, and learns to manage the heavier, faster and more dynamically complicated motorbikes with time and training.
To drive a bike at low speeds is necessary to apply continuous corrections to the controls because of the capsize instability of the system.
At high speeds one need to anticipate the maneuvers by a conspicuous amount of time because of the delay in the force generation by the tires (relaxation length) and the necessity to lean the bike to turn.
These are the main characteristic an automatic system must take account of to control the system.
In this work is described a set of PID controls able, controlling the torques on wheels and steering, to make a schematic motorbike perform a wheelie, a standard lane change and finally a stoppie.
This simulation has been set up to learn how to manage the control toolbox of the multibody software MSC Adams and test if this kind of control can lead to a satisfactory management of a standard 3×21 m lane change test.
The first step was to create a basic control on a simpler situation like the wheelie.
Achieved that, the target became a satisfactory management (i.e. a sufficiently low error between the rear contact point trajectory and a target one) of a standard 3×21 m lane change with a control circuit controlling the steering torque.
Furthermore an ending phase with a controlled stoppie and a kickstand rest has been added.
The modelling problem
The global reference system is SAE standard (X towards front, Y towards right side and Z towards ground).
The motorcyle has been modeled in a schematic way with a “plate” body representing the frame, a single arm (cylindrical and centered) fork and a single arm (also cylindrical and centered) swingarm and a purely aesthetic dummy.
The principal measures (wheelbase, fork trail and angle … ) defining the points used to model the motorbike geometry have been inspired by a moto3 Honda model.
The wheels have been created from two of the .tir files Adams comes with: pac_mc_180_55R17.tir for the rear wheel and pac_mc_120_70R17_cross.tir for the front one.
The road is a flat road we used during the course: 2d_flat.rdf .
Hinges connect the frame to the swingarm (swingarm pivot) and to the slider of the fork (steering axis), as well as the rear wheel to the swingarm and the front one with the stanchion of the fork (wheels pivots).
A prismatic joint let the stanchion move inside the slider, representing in a single arm also the rotational constraint of the real pair of arms.
A rotational damped spring between the frame and the swingarm represents the rear suspension while a linear damped spring between the slider and the stanchion of the fork represents the front suspension.
Masses, mass centers, springs elastic constant and damping are approximately adjusted to obtain a dynamic response plausible to the eye.
The kickstand is a massless cylinder joined to the frame with an hinge.
There are some additional bodies without a dynamic function but only a graphic reference one.
LCpath is a spline, defined by points, representing the target trajectory of a standard 3×21 m lane change test.
ContactPlane is a plane, fixed to the ground, that models the contact surface for the kickstand.
There are then three small ellipses (figure 1) called GuidePoint, RefPoint, and targetRCpoint, created to have a visual correspondence of the points generating controls quantities.
GuidePoint is a point that represents the motorcycle direction and position: it is placed on the bike’s axis projection on the ground, advanced on this axis by a quantity established by design variable (Advance).
This is achieved by the calculation, taking into account roll and yaw angles, of the rear tire contact point’s X and Y coordinates summed with the decomposition of the advance length in the bike direction.
These coordinates will be imposed to the body via a General Point Motion constraint.
This point’s lateral (Y) position will be subtracted to the Y coordinate of the target trajectory to generate the lane change error quantity.
The Y coordinate of the target trajectory is represented by the RefPoint to which has been imposed the same X coordinate of GuidePoint (with a Point Motion constraint) and the coincidence with the spline by a Point-curve constraint.
The last body, targetRCpoint, represents the target position of the rear contact point and is defined similarly to RefPoint: to it has been imposed the same X of the actual contact point (not represented graphically) and the coincidence with the spline by a Point-curve constraint.
A torque between the rear wheel and the frame represents the engine torque and a torque between the front wheel and the stanchion represents the brake torque.
A torque between the frame and the slider models the steering torque.
The first one (drive_trq) is controlled by a dedicated PID (W_PID) during the stable phase of the wheelie while four steps function regulate the two torque impulses to rise the front wheel before and to land it smoothly after.
The PID input is limited to a value represented by a design variable called Drive_trq_limit.
A proportional control inside the function regulates the speed during the lane change: a speed_error measure is created subtracting the actual frame speed measure to a target speed design variable, then that quantity will multiply a manual adjusted gain to compose the torque needed to maintain the desired speed.
The second torque (brake_trq) is very similar to the first one: it is controlled by another dedicated PID (S_PID) during the steady stoppie phase and two impulses, manually adjusted, rise the rear wheel and land it smoothly after the maneuver.
The steering torque (Steering_trq) is controlled by the sum of two PIDs (PIDsum=pos_PID+roll_PID) as will be explained later, and limited to a value represented by the design variable str_trq_limit.
Lastly, a continuous impact-type contact models the force between ground (contact_plane) and the kickstand’s tip.
The torques’ functions have several nested IF and STEP function to activate/suppress the main functions at specific moments.
The control circuit consists in 4 PIDs : one is dedicated to the wheelie phase (W_PID), one to the stoppie phase (S_PID) and two to the lane change (pos_PID and roll_PID).
With refer to the scheme 1, from top to bottom, the first is the block scheme of the wheelie control, the second is the one for the stoppie while the third is dedicated to the steering.
Wheelie: the error is generated subtracting the X coordinate of the rear wheel pivot (rear_pivot_X) from the X coordinate of the mass center of the frame (frame_CM).
The error is then amplified and, due to the fact that the PID block’s setup in ADAMS requires the derivative of the error as an input, is multiplied by a transfer function.
This transfer function has, in addition to the derivation, a gain and a low-pass filter: an ideal derivation would be infinite in correspondence of a step variation of the error.
The PID output is referenced by the rear wheel torque (Drive_trq) and saturated at the imposed limit.
Stoppie: the stoppie control is identical to the wheelie one but for the saturation and the front pivot’s X input instead of the rear one.
Lane change: there are two PIDs concurring in the sum block called PIDsum, which will be referenced and saturated by the steering torque function.
The first PID, called position PID (pos_PID), has as input an error calculated as the difference between the Y position of GuidePoint and the Y position of RefPoint, running along the LCpath spline.
It is, essentially, the difference in Y (lateral) between the desired path and the position that the bike will occupy if it would run straight for a certain distance, defined in the Advance variable.
The second PID, called roll_PID, had directly the roll angle measure as input.
The setup of the two PIDs is very similar to the ones dedicated to wheelie and stoppie but for the transfer function: this one has a low-pass filter with a lower cut frequency (around 1 Hz), to filter “rapid” oscillations and maintain a stable control.
To ease the lane change control tuning a dialog box has been created: it allows to modify roll_PID gains, pos_PID gains and Advance variable from a single dialog box.
It must be imported in the model, the file’s name is “CONTROLS.cmd” .
Simulations and analysis of results
There are two simulation scripts: EIGEN_SCRIPT and W_LC_S_SCRIPT.
The former is a precautionary simulation, to analyze the stability of the model and estimate a convenient speed at which perform the lane change, the latter is the principal simulation in which the wheelie, the lane change and the stoppie are performed in sequence.
The EIGEN_SCRIPT deactivates the unnecessary motions and forces (the wheels lock, the kickstand motion, the steering lock, the torques at the two wheels and at the steering) leaving a motion that makes the bike accelerate and stabilize repeatedly.
In this way the simulation has multiple steady-running moments at increasing speed and it can calculate eigenvalues at each one: it computes this operation at 12 different speeds starting at 2.55 m/s and ending at 30.6 m/s.
The eigenvalues graph is then plottable and it suggests the stable range of speeds (negative real part).
A speed of 11 m/s has been decided for the lane change phase: it sees as stable most of the modes and the Advance is reasonable.
The Advance, as observed in literature and verified in the model, is about 1 second of running so about 11 meters at 11 m/s.
A high advance tends to “filter” the shape of a smoothed step-like input as the line change trajectory and could possibly worsen the control performances.
This simulation disables the motion created for the eigenvalues simulation (Eigen_acceleration) and the wheel lock, which will be activated at the end to stop the bike.
With the steering lock activated, the drive torque function performs the wheelie.
A first, manually regulated, impulse rise the front wheel, then the control is entrusted to the PID, and finally a second impulse softens the landing.
At this point the steering lock is deactivated by the simulation script and the steering control entrusted to the steering torque, controlled by PIDsum.
Performed the lane change, after some seconds to allow the control to stabilize the bike on the straight path, the steer is locked again and the stoppie phase begins.
The stoppie torque acts similarly as the drive one: a manually adjusted impulse rise the rear wheel, then the control is entrusted to the S_PID and finally another impulse helps landing the bike.
Unlike the wheelie landing, the stoppie landing is managed not only by a manually adjusted impulse but also with a basic automatic control inside the function: it regulates the braking torque linearly with the product between the bike’s pitch angle and the front wheel’s angular velocity.
Just before the landing, a motion opens the kickstand and the steering lock motion operates a small manual correction to the steering to compensate for the initial inevitable bike’s disalignment.
When the bike is sufficiently still the wheels lock is activated.
From the measures of roll speed and steering torque we can calculare the bike’s LCRI
The Lane Change Roll Index (LCRI) can be computed from the following data:
- Positive roll speed peak = 33.12 °/s = 0.5781 rad/s
- Negative roll speed peak = -38.59 °/s = -0.6735 rad/s
- Positive torque peak = 6152 Nmm = 6.152 Nm
- Negative torque peak = -5912 Nmm = -5.912 Nm
Peak-to-peak roll speed: Φpp= 0.5781 – (-0.6735) = 1.252 rad/s
Peak-to-peak steering torque: Tpp= 6.152 – (-5.912) = 12.06 Nm
Speed: V= 11 m/s
LCRI= Tpp/ (Φpp *V) = 0.87 Ns^2/rad
This value is proper of a motorcycle with a good maneuverability because it requires a low steering torque to achieve high roll velocities.
Wheelie phase with torque plot.
Lane change from top; steering angle on left plot and steering torque on right one.
Entire principal simulation video: on the up-right corner GuidePoint and RefPoint are visible.
Lane change phase from the top.
Link to the simulation files: Google Drive link
After the correction of an error in the GuidePoint position function which was making the control tuning impossible (the main reason why the CONTROLS dialog box and the roll_PID have been created), it revealed itself rather simple to tune and unexpectedly effective.
The achieved error on the trajectory is more than satisfactory: the spline trajectory is not necessarily achievable by the motorcycle.
The stabilization after the maneuver is less satisfactory but probably improvable with a further PID tuning.
The PID tuning for the stoppie and the wheelie has been rather easy.
In the stoppie phase, the proportional gain of the PID has been maintained deliberately low to have a steady error and slow down the bike.
Probably, without the roll_PID, the control would have been capable of a satisfactory trajectory with a slightly greater error: it would be interesting to set all its gains to zero and try to re-tune the pos_PID to compare the two configurations.
Some mentioned details, as the torque impulses in wheelie and stoppie and the instant in which start the stoppie have been manually tuned (with intensity and/or time range).
A more intelligent/automatic method to achieve those maneuvers would be interesting to develop.
About the torque impulses: the PIDs that regulate the steady phase of the maneuver weren’t suitable for the starting and ending of it and another control would be necessary.
About the stoppie starting instant: an intelligent control which starts the maneuver after the ERRORE measure (trajectory error) has been lower than a certain tolerance for enough time would be more elegant.
Finally, the actual control tuning is suitable only for this standard lane change and a limited range of speeds: the development of a control capable of a satisfactory trajectory in a wider range of speeds and with more than one standard lane change size would be interesting