# Curvilinear coordinates

by Roberto Lot and Matteo Massaro

In this worksheet the differential equations necessary to use the curvilinear coordines are derived.
Curvilinear coordinates are useful in vehicle modeling to trace the position and orientation on the road of the vehicle moving frame.
With curvilinear coordinates, the position of the vehicle on the road is defined by its longitudinal position along the road s, its lateral position with respect to the road center line n, and its angle cwith respect to the road center line. The road center line is defined by means of its local curvature Q.

> restart: libname := libname, "C:/MBSymba": with(MBSymba_r6): List of variables used

> C(t);origin of the blue moving frame
s(t);longitudinal curvilinear coordinate, i.e. position of the blue moving frame along the road

> n(t);lateral curvilinear coordinate, i.e. distance of the blue moving frame w.r.t. the road center line

chi(t);angle between the tangent to the road center line and the blue moving frame

> u(t);longitudinal velocity of the origin of the blue moving frame

> v(t);lateral velocity of the origin of the blue moving frame

> psi(t);orientation of the blue moving frame         define a moving reference frame moving along the road center line, MF_R

> MF_R:= use_moving_frame(diff(s(t),t),0,0, 0,0,diff(theta(t),t)):

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

define another moving frame MF_Vwith origin in C, at a distance n(t)from the road center line, whose orientation differs from that of the road tangent by c(t)(blue in the picture above)
note that this frame is defined with a translation and a rotation from the previous MF_R

> MF_V:= translate(0,n(t),0)*rotate('Z',chi(t)):
C:= origin(MF_V):C:=project(C,moving_frame):show(C); compute the velocity of C in terms of curvilinear coordinates

> VC_R:= velocity(C):show(VC_R); express the velocity of C in terms of MF_V coordinates

> VC_V:= make_VECTOR( MF_V , u(t),v(t),0): show(VC_V); obtain the 3 differential equations to compute the curvilinear coordinates s, n, cfrom the MF_V variables u, v, yand the road curvature Q,

> comp_X(VC_R,moving_frame)=comp_X(VC_V,moving_frame):
comp_Y(VC_R,moving_frame)=comp_Y(VC_V,moving_frame):

> 1/Theta(s(t))*diff(theta(t),t)=diff(s(t),t):
e:=subs( theta(t)=psi(t)-chi(t), [%%%,%%,%]): 'e'=Vector(e); obtain ODE formulation

> e_ode:= op(solve(e,[diff(s(t),t),diff(n(t),t),diff(chi(t),t)])): 'e_ode'=Vector(simplify(e_ode,size)); >