# Vehicle modelling in moving frame

> restart: libname := libname, "C:/MBSymba": with(MBSymba_r6):LA:=LinearAlgebra:

>

> PDEtools[declare]({u(t),omega(t),delta(t)},prime=t,quiet);

MBSymba release 6 - Copyright (C) 2011 by R. Lot, M. Massaro - University of Padova (Italy)

## Definition of the Moving Frame

> use_moving_frame(u(t),0,0,0,0,omega(t)):

Warning, The base frame <moving_frame> has been selected.

> W = VM;

The cehicle CG is located on the origin of the moving frame

> R := origin(moving_frame): show(R);

velocity

> VR := velocity(R): show(VR);

acceleration

> AR := acceleration(R): show(AR);

### front tire

> TF := translate(w,0,0) . rotate('Z',delta(t));

contact point

> F := origin(TF): show(F);

> VF := project( velocity(F) , TF): show(VF);

> comp_Y(VF,TF);

> no_sideslip := op(solve({%},{omega(t)}));

>

>

>

# Vehicle modelling in absolute coordinates

> restart: libname := libname, "C:/MBSymba": with(MBSymba_r6):LA:=LinearAlgebra:

> PDEtools[declare]({x(t),y(t),psi(t),u(t),v(t),omega(t),delta(t)},prime=t,quiet);

MBSymba release 6 - Copyright (C) 2011 by R. Lot, M. Massaro - University of Padova (Italy)

## Definition of the vehicleframe Frame

> TV := translate(x(t),y(t),0) . rotate('Z',psi(t));

The cehicle CG is located on the origin of the moving frame

> R := origin(TV): show(R);

velocity

> VR := project(velocity(R),TV): show(VR);

acceleration

> AR := project(acceleration(R),TV): show(AR);

introducuction of holonomic constraints

> no_rear_sideslip := op(solve ( [comp_X(VR)=u(t) , comp_Y(VR)=0] , diff([x(t),y(t)],t)));

> VR[comps] := simplify(subs(no_rear_sideslip,VR[comps])): show(VR);

> AR := project(velocity(VR),TV): show(AR);

# Vehicle modelling in moving frame and trajectory tracking

> restart: libname := libname, "C:/MBSymba": with(MBSymba_r6):LA:=LinearAlgebra:

> PDEtools[declare]({omega(t),delta(t) , x(t),y(t),psi(t)},prime=t,quiet);

MBSymba release 6 - Copyright (C) 2011 by R. Lot, M. Massaro - University of Padova (Italy)

## Definition of the Moving Frame

> TV := translate(x(t),y(t),0) . rotate('Z',psi(t));

> track_eqns := use_moving_frame(u,0,0,0,0,omega(t) , TV):
track_eqns; Vector(track_eqns);

Warning, The base frame <moving_frame> has been selected.

> track_ODE := op(solve(track_eqns, diff( [x(t),y(t),psi(t)],t) )): Vector(track_ODE);

### front tire without sideslip

> TF := translate(w,0,0) . rotate('Z',delta(t));

contact point

> F := origin(TF): show(F);

> VF := project( velocity(F) , TF): show(VF);

> comp_Y(VF,TF);

> no_sideslip := op(solve({%},{omega(t)}));

> track_ODE := subs(no_sideslip, track_ODE): Vector(%);

# Numerical simulation

> w := 2.2; wheelbase

> u := 25; vehicle (constant) speed

> delta := t -> piecewise(t<1,0 ,t<2, 0.1*(t-1), t<4.5, 0.1, 0):
plot( delta(t),t=0..5,title="Steering angle [rad]",thickness=2);

> motion := dsolve( track_ODE union [x(0)=1,y(0)=2,psi(0)=0.3], type=numeric, range=0..6):

> plots[odeplot](motion,[ [ x(t), y(t), color=blue,thickness=2 ]] , labels=["x [m]","y [m]"], scaling=constrained);