Motion equations for following a Bezier Curve

1k Views Asked by At

I am trying to make a rocket follow a certain path (specified by a Bezier curve).

The rocket has a certain mass and I can apply a certain force to it (turning on the engines). To simplify let's say that I can apply the force in any direction (omnidirectional engine) and there's no external forces (such as gravity)

In order to follow the curve, I was thinking about discretizing the curve into points, then from the first point try to reach the next one and repeat this procedure for all the points.

The rocket has an engine that provides certain acceleration to the rocket, and I can decide the direction of this force.

So my problem is to find the angle to apply the force for each point of the Bezier curve in order to reach the next point.

The equations of motion I'm using are:

pos1_x = pos0_x + vel0_x * t + 0.5 * a*sin(angle)*t^2
pos1_y = pos0_y + vel0_y * t + 0.5 * a*cos(angle)*t^2

Here I can use a solver to find t and angle

The I can use the equations:

V_x = V0_x + cos(angle) * t
V_y = V0_y + sin(angle) * t

To find the speed at the destination point (and then repeat the procedure again with pos0 = pos1 and vel0 = vel1)

My question is: Is this a good approach? In order to be precise the distance between points has to be small, and the solver used to find the angle needs computation.

Is there a better approach to solve this problem in order to follow a certain curve?

1

There are 1 best solutions below

0
On

You don't specify the order of the Bezier curve: let's take for example the quadratic one.

The parametric equation of a quadratic Bezier curve, going along the points $ {\bf P}_{0},{\bf P}_{1},{\bf P}_{2}$ is $$ {\bf B}(t) = \left( {1 - t} \right)^{\,2} {\bf P}_0 + 2t\left( {1 - t} \right){\bf P}_1 + t^{\,2} {\bf P}_2 \quad \left| {\;0 \le t \le 1} \right. $$ where the ${\bf B}(t)$ and the ${\bf P}_{n}$ are vectors.

Then you have already the path parametrized in unitary time. If the time taken to complete the path is $T$ then you just need to replace $t$ with $t/T$.

Then starting position is given (${\bf P}_{0}$).
The problem here, is that also the initial speed is given and is finite and equal to $2({\bf P}_{1}-{\bf P}_{0})$.
In the intermediate paths you can take that into account, but at the starting path I imagine you want it to be null. To render it in a computational program, it means that you shall fix an appropriate $\Delta t$, take ${\bf P}_{1}={\bf P}_{0}$, and fix ${\bf P}_{2}$ appropriately.