Saturday, October 6, 2018

mathematics - Projected trajectory of a vehicle?



In the game I am developing, I have to calculate if my vehicle (1) which in the example is travelling north with a speed V, can reach its target (2). The example depict the problem from atop:


enter image description here


There are actually two possible scenarios: V is constant (resulting in trajectory 4, an arc of a circle) or the vehicle has the capacity to accelerate/decelerate (trajectory 3, an arc of a spiral).



I would like to know if there is a straightforward way to verify if the vehicle is able to reach its target (as opposed to overshooting it). I'm particularly interested in trajectory #3, as I the only thing I could think of is integrating the position of the vehicle over time.



EDIT: of course the vehicle has always the capacity to steer, but the steer radius vary with its speed (think to a maximum lateral g-force).


EDIT2: also notice that (as most of the vehicles in real life) there is a minimum steering radius for the in-game ones too).



Answer



If you can vary your speed (thus your angle of steer) you will always find a solution, starting from the degenerate one where the entity is almost stopped rotating in a little circle until pointing the target.



If you can't vary your speed, you can think about unreachable areas or shadows that you can not reach even using your better steer, if the target is in those areas you cant reach it (unless "overshoot" you can even surpass them and put them out of the shadow area).


Your best steer let you to turn left/right on an arc of a circle, letting you to draw a complete circumference:


shadows


As you can see what is inside one of the two circles cant be reached directly.


A body of mass m that is steering over a curve with radius of curvature r, experiences a radial apparent Centrifugal force caused by the inertial behavior of the body, equal to:


Fc = mV^2/r


where V is the speed of the body (the lenght of the velocity vector); being the acceleration of a body due a force being:


a=F/m


our acceleration is:


a=V^2/r



If we say that am is the maximum acceleration we obtain that:


rm=V^2/am


where rm is the mimimum radius using the maximum acceleration.


When you want to test if the veicle in P moving at speed V can reach the target in T you have to:


1) compute C1 and C2 as:


c1 and c2


2) test the miminum distance of P from C1 and C2 as follow:


radius test


If d is greater than rm this means that T is outside both the shadows and then is reachable by the vehicle simply adjusting the steer under the steer constraint. (to be more precise there is a path under constraints that let the function of distance between T and P be monotonically decreasing)


[UPDATE]



If it possible to change the velocity, is always possible to get an arc (i.e. a velocity/radial accelleration couple) that goes from P to T. This is possible because the radius becomes a truly degree of freedom.


This is a possible construction:


target path


The black line is the axis where the center of circles may lay: it is perpendicular to the current facing of the vehicle and passes through its center of rotation.


The green segment represents the line that is perpendicular to the one that connects the center of the vehicle with the target and passes through the middle of that distance.


The green line crosses the black one exactly at the center of the desired arc. The length of the orange segment tell us the radius of turning that can be achieved by regulating the velocity and turning at maximum steer or regulating both the velocity and the steer to stay under the constraint


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...