Jump to content

Car testdrive (lane change manoeuvre): Difference between revisions

From mintOC
Ckirches (talk | contribs)
Ckirches (talk | contribs)
Line 118: Line 118:
The differential equations in C code:
The differential equations in C code:
<source lang="cpp">
<source lang="cpp">
        // Controls
// Controls
double C_steer = u[0];
double C_steer = u[0];
double C_brake = u[1];
double C_brake = u[1];
double C_acc  = u[2];
double C_acc  = u[2];


// Differential states
// Differential states
double X_v    = xd[2];
double X_v    = xd[2];
double X_beta  = xd[3];
double X_beta  = xd[3];
double X_psi  = xd[4];
double X_psi  = xd[4];
double X_wz    = xd[5];
double X_wz    = xd[5];
double X_delta = xd[6];
double X_delta = xd[6];


// Intermediate values
// Intermediate values
double alpha_f, alpha_r, v_km_h, v_km_h2;
double alpha_f, alpha_r, v_km_h, v_km_h2;
double F_Ax, F_Ay, F_Bf, F_Br, F_Rf, F_Rr, F_sf, F_sr, F_lr, F_lf;
double F_Ax, F_Ay, F_Bf, F_Br, F_Rf, F_Rr, F_sf, F_sr, F_lr, F_lf;
double f_R, f_1, w_mot, f_2, f_3, M_mot, M_wheel;
double f_R, f_1, w_mot, f_2, f_3, M_mot, M_wheel;
double X_v_cos_X_beta, X_v_sin_X_beta;
double X_v_cos_X_beta, X_v_sin_X_beta;


        X_v_cos_X_beta = X_v * cos ( X_beta );
X_v_cos_X_beta = X_v * cos ( X_beta );
X_v_sin_X_beta = X_v * sin ( X_beta );
X_v_sin_X_beta = X_v * sin ( X_beta );
alpha_f        = X_delta - atan( ( P_l_f * X_wz - X_v_sin_X_beta ) / X_v_cos_X_beta );
alpha_f        = X_delta - atan( ( P_l_f * X_wz - X_v_sin_X_beta ) / X_v_cos_X_beta );
alpha_r        =          atan( ( P_l_r * X_wz + X_v_sin_X_beta ) / X_v_cos_X_beta );
alpha_r        =          atan( ( P_l_r * X_wz + X_v_sin_X_beta ) / X_v_cos_X_beta );


F_sf    = P_D_f * sin( P_C_f * atan( P_B_f*alpha_f - P_E_f*(P_B_f*alpha_f - atan(P_B_f*alpha_f)) ) );
F_sf    = P_D_f * sin( P_C_f * atan( P_B_f*alpha_f - P_E_f*(P_B_f*alpha_f - atan(P_B_f*alpha_f)) ) );
F_sr    = P_D_r * sin( P_C_r * atan( P_B_r*alpha_r - P_E_r*(P_B_r*alpha_r - atan(P_B_r*alpha_r)) ) );
F_sr    = P_D_r * sin( P_C_r * atan( P_B_r*alpha_r - P_E_r*(P_B_r*alpha_r - atan(P_B_r*alpha_r)) ) );


F_Ax    = 0.5 * P_c_w * P_rho * P_A * X_v*X_v;
F_Ax    = 0.5 * P_c_w * P_rho * P_A * X_v*X_v;
F_Ay    = 0.0;
F_Ay    = 0.0;
F_Bf    = 2.0/3.0 * C_brake;
F_Bf    = 2.0/3.0 * C_brake;
F_Br    = 1.0/3.0 * C_brake;
F_Br    = 1.0/3.0 * C_brake;


v_km_h  = X_v / 100.0 * 3.6;
v_km_h  = X_v / 100.0 * 3.6;
v_km_h2 = v_km_h * v_km_h;
v_km_h2 = v_km_h * v_km_h;
f_R    = P_f_R0 + P_f_R1 * v_km_h + P_f_R4 * v_km_h2 * v_km_h2;
f_R    = P_f_R0 + P_f_R1 * v_km_h + P_f_R4 * v_km_h2 * v_km_h2;
F_Rf    = f_R * P_F_zf;
F_Rf    = f_R * P_F_zf;
F_Rr    = f_R * P_F_zr;
F_Rr    = f_R * P_F_zr;


f_1    = 1.0 - exp( -3.0 * C_acc );
f_1    = 1.0 - exp( -3.0 * C_acc );
w_mot  = X_v * P_ig * P_i_t / P_R;
w_mot  = X_v * P_ig * P_i_t / P_R;
f_2    = -37.8 + (1.54 - 0.0019 * w_mot_i) * w_mot;
f_2    = -37.8 + (1.54 - 0.0019 * w_mot_i) * w_mot;
f_3    = -34.9 - 0.04775 * w_mot;
f_3    = -34.9 - 0.04775 * w_mot;
M_mot  = f_1 * f_2_i + ( 1.0 - f_1 ) * f_3_i;
M_mot  = f_1 * f_2_i + ( 1.0 - f_1 ) * f_3_i;
M_wheel = P_ig * P_i_t * M_mot_i;
M_wheel = P_ig * P_i_t * M_mot_i;
F_lr    = M_wheel / P_R - F_Br - F_Rr;
F_lr    = M_wheel / P_R - F_Br - F_Rr;
F_lf    = - F_Bf - F_Rf;
F_lf    = - F_Bf - F_Rf;


// 0 Horizontal position x
// 0 Horizontal position x
rhs[0] = X_v * cos( X_psi - X_beta );
rhs[0] = X_v * cos( X_psi - X_beta );
// 1 Vertical position y
// 1 Vertical position y
rhs[1] = X_v * sin( X_psi - X_beta );
rhs[1] = X_v * sin( X_psi - X_beta );
// 2 Velocity v
// 2 Velocity v
rhs[2] = 1.0 / P_m * (
rhs[2] = 1.0 / P_m * (
  (F_lr - F_Ax) * cos(X_beta) + F_lf * cos(X_delta + X_beta)
  (F_lr - F_Ax) * cos(X_beta) + F_lf * cos(X_delta + X_beta)
- (F_sr - F_Ay) * sin(X_beta) - F_sf * sin(X_delta + X_beta) );
- (F_sr - F_Ay) * sin(X_beta) - F_sf * sin(X_delta + X_beta) );
// 3 Side slip angle beta
// 3 Side slip angle beta
rhs[3] = X_wz - 1.0 / (P_m * X_v) * (
rhs[3] = X_wz - 1.0 / (P_m * X_v) * (
  (F_lr - F_Ax) * sin(X_beta) + F_lf * sin(X_delta + X_beta)
  (F_lr - F_Ax) * sin(X_beta) + F_lf * sin(X_delta + X_beta)
+ (F_sr - F_Ay) * cos(X_beta) + F_sf * cos(X_delta + X_beta) );
+ (F_sr - F_Ay) * cos(X_beta) + F_sf * cos(X_delta + X_beta) );
// 4 Yaw angle psi
// 4 Yaw angle psi
rhs[4] = X_wz;
rhs[4] = X_wz;
// 5 Velocity of yaw angle w_z
// 5 Velocity of yaw angle w_z
rhs[5] = 1.0 / P_I_zz * (
rhs[5] = 1.0 / P_I_zz * (
  F_sf * P_l_f * cos(X_delta) - F_sr * P_l_r
  F_sf * P_l_f * cos(X_delta) - F_sr * P_l_r
+ F_lf * P_l_f * sin(X_delta) - F_Ay * P_e_SP );
+ F_lf * P_l_f * sin(X_delta) - F_Ay * P_e_SP );
// 6 Steering angle delta
// 6 Steering angle delta
rhs[6] = C_steer;
rhs[6] = C_steer;
</source>
</source>



Revision as of 12:19, 25 November 2008

Car testdrive (lane change manoeuvre)
State dimension: 1
Differential states: 7
Continuous control functions: 3
Discrete control functions: 1
Interior point inequalities: 7


The mathematical equations form a small-scale ODE model.

Motivation

Mathematical formulation

We consider a single-track model, derived under the simplifying assumption that rolling and pitching of the car body can be neglected. Consequentially, only a single front and rear wheel is modeled, located in the virtual center of the original two wheels. Motion of the car body is considered on the horizontal plane only.

Four controls represent the driver's choice on steering and velocity. We denote with wδ the steering wheel's angular velocity. The force FB controls the total braking force, while the accelerator pedal position ϕ is translated into an accelerating force. Finally, the selected gear μ influences the effective engine torque's transmission.

Resulting MIOCP

For t[t0,tf] almost everywhere the mixed-integer optimal control problem is given by

minx(),u(),μ()tfs.t.x˙(t)=f(t,x(t),u(t),μ(t)),x(t0)=x0,r(t,x(t),u(t))0,μ(t){1,2,3,4,5}.

Parameters

These fixed values are used within the model.

ParameterValueUnitDescriptionm1.239103kgMass of the carg9.81ms2Gravity constantlf1.19016mFront wheel distance to center of gravitylr1.37484mRear wheel distance to center of gravityeSP0.5mDrag mount point distance to center of gravityR0.302mWheel radiusIzz1.752103kg m2Moment of inertiacw0.3Air drag coefficientρ1.249512kgm3Air densityA1.4378946874m2Effective flow surfaceig13.09Transmission ratio of first gearig22.002Transmission ratio of second gearig31.33Transmission ratio of third gearig41.0Transmission ratio of fourth gearig50.805Transmission ratio of fifth gearit3.91Engine torque transmission ratioBf1.096101Pacejka coefficients (stiffness)Br1.267101Cf1.3Pacejka coefficients (shape)Cr1.3Df4.5604103Pacejka coefficients (peak)Dr3.94781103Ef0.5Pacejka coefficients (curvature)Er0.5

Test course

The double-lane change manoeuvre presented in <bibref>Gerdts2005</bibref> is realized by constraining the car's position onto a prescribed track at any time t[t0,tf]. Starting in the left position with an initial prescribed velocity, the driver is asked to manage a change of lanes modeled by an offset of 3.5 meters in the track. Afterwards he is asked to return to the starting lane. This manoeuvre can be regarded as an overtaking move or as an evasive action taken to avoid hitting an obstacle suddenly appearing on the starting lane.

From a mathematical point of view, the test track is described by setting up piecewise cubic spline functions Pl(x) and Pr(x) modeling the top and bottom track boundary, given a horizontal position x.

Pl(x):={0if x44,4h2(x44)3if 44<x44.5,4h2(x45)3+h2if 44.5<x45,h2if 45<x70,4h2(70x)3+h2if 70<x70.5,4h2(71x)3if 70.5<x71,0if 71<x.Pu(x):={h1if x15,4(h3h1)(x15)3+h1if 15<x15.5,4(h3h1)(x16)3+h3if 15.5<x16,h3if 16<x94,4(h3h4)(94x)3+h3if 94<x94.5,4(h3h4)(95x)3+h4if 94.5<x95,h4if 95<x.

where B=1.5m is the car's width and

h1:=1.1B+0.25,h2:=3.5,h3:=1.2B+3.75,h4:=1.3B+0.25.

Test course for the double lane change manoeuvre

Reference Solutions

Reference solutions for the case of a fixed time-grid are given in <bibref>Gerdts2005</bibref>. Solutions for a non-fixed time grid are given in <bibref>Gerdts2006</bibref>.

Source Code

C

The differential equations in C code:

// Controls
double C_steer = u[0];
double C_brake = u[1];
double C_acc   = u[2];

// Differential states
double X_v     = xd[2];
double X_beta  = xd[3];
double X_psi   = xd[4];
double X_wz    = xd[5];
double X_delta = xd[6];

// Intermediate values
double alpha_f, alpha_r, v_km_h, v_km_h2;
double F_Ax, F_Ay, F_Bf, F_Br, F_Rf, F_Rr, F_sf, F_sr, F_lr, F_lf;
double f_R, f_1, w_mot, f_2, f_3, M_mot, M_wheel;
double X_v_cos_X_beta, X_v_sin_X_beta;

X_v_cos_X_beta = X_v * cos ( X_beta );
X_v_sin_X_beta = X_v * sin ( X_beta );
alpha_f        = X_delta - atan( ( P_l_f * X_wz - X_v_sin_X_beta ) / X_v_cos_X_beta );
alpha_r        =           atan( ( P_l_r * X_wz + X_v_sin_X_beta ) / X_v_cos_X_beta );

F_sf    = P_D_f * sin( P_C_f * atan( P_B_f*alpha_f - P_E_f*(P_B_f*alpha_f - atan(P_B_f*alpha_f)) ) );
F_sr    = P_D_r * sin( P_C_r * atan( P_B_r*alpha_r - P_E_r*(P_B_r*alpha_r - atan(P_B_r*alpha_r)) ) );

F_Ax    = 0.5 * P_c_w * P_rho * P_A * X_v*X_v;
F_Ay    = 0.0;
F_Bf    = 2.0/3.0 * C_brake;
F_Br    = 1.0/3.0 * C_brake;

v_km_h  = X_v / 100.0 * 3.6;
v_km_h2 = v_km_h * v_km_h;
f_R     = P_f_R0 + P_f_R1 * v_km_h + P_f_R4 * v_km_h2 * v_km_h2;
F_Rf    = f_R * P_F_zf;
F_Rr    = f_R * P_F_zr;

f_1     = 1.0 - exp( -3.0 * C_acc );
w_mot   = X_v * P_ig * P_i_t / P_R;
f_2     = -37.8 + (1.54 - 0.0019 * w_mot_i) * w_mot;
f_3     = -34.9 - 0.04775 * w_mot;
M_mot   = f_1 * f_2_i + ( 1.0 - f_1 ) * f_3_i;
M_wheel = P_ig * P_i_t * M_mot_i;
	
F_lr    = M_wheel / P_R - F_Br - F_Rr;
F_lf    = - F_Bf - F_Rf;

// 0 Horizontal position x
rhs[0] = X_v * cos( X_psi - X_beta );
// 1 Vertical position y
rhs[1] = X_v * sin( X_psi - X_beta );
// 2 Velocity v
rhs[2] = 1.0 / P_m * (
	  (F_lr - F_Ax) * cos(X_beta) + F_lf * cos(X_delta + X_beta)
	- (F_sr - F_Ay) * sin(X_beta) - F_sf * sin(X_delta + X_beta) );
// 3 Side slip angle beta
rhs[3] = X_wz - 1.0 / (P_m * X_v) * (
	  (F_lr - F_Ax) * sin(X_beta) + F_lf * sin(X_delta + X_beta)
	+ (F_sr - F_Ay) * cos(X_beta) + F_sf * cos(X_delta + X_beta) );
// 4 Yaw angle psi
rhs[4] = X_wz;
// 5 Velocity of yaw angle w_z
rhs[5] = 1.0 / P_I_zz * (
	  F_sf * P_l_f * cos(X_delta) - F_sr * P_l_r
	+ F_lf * P_l_f * sin(X_delta) - F_Ay * P_e_SP );
// 6 Steering angle delta
rhs[6] = C_steer;

Variants

See testdrive overview page.

References

<bibreferences/>